Skip to content

Commit

Permalink
Close #152 add option to skip verification of jira server's certifica…
Browse files Browse the repository at this point in the history
…te chain and hostname
  • Loading branch information
anandsudhir committed Jun 14, 2018
1 parent 2833ec8 commit 3a519c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions _site/content/posts/modules/jira.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jira:
project: "JIRA"
refreshInterval: 900
username: "chris.cummer"
verifyServerCertificate: true
```
### Attributes
Expand Down Expand Up @@ -86,3 +87,8 @@ Values: A positive integer, `0..n`.

`username` <br />
Your Jira username. <br />

`verifyServerCertificate` <br />
_Optional_ <br />
Determines whether or not the server's certificate chain and host name are verified. <br />
Values: `true`, `false`.
9 changes: 8 additions & 1 deletion jira/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package jira

import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"io"
Expand Down Expand Up @@ -59,7 +60,13 @@ func jiraRequest(path string) (*http.Response, error) {
}
req.SetBasicAuth(Config.UString("wtf.mods.jira.email"), os.Getenv("WTF_JIRA_API_KEY"))

httpClient := &http.Client{}
verifyServerCertificate := Config.UBool("wtf.mods.jira.verifyServerCertificate", true)
httpClient := &http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: !verifyServerCertificate,
},
},
}
resp, err := httpClient.Do(req)
if err != nil {
return nil, err
Expand Down

0 comments on commit 3a519c4

Please sign in to comment.