From 3a519c4910efb19fae4de6059de53c220d4c2d53 Mon Sep 17 00:00:00 2001 From: Anand Sudhir Prayaga Date: Thu, 14 Jun 2018 15:59:00 +0200 Subject: [PATCH 1/2] Close #152 add option to skip verification of jira server's certificate chain and hostname --- _site/content/posts/modules/jira.md | 6 ++++++ jira/client.go | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/_site/content/posts/modules/jira.md b/_site/content/posts/modules/jira.md index 08479c62..d1cf2752 100644 --- a/_site/content/posts/modules/jira.md +++ b/_site/content/posts/modules/jira.md @@ -43,6 +43,7 @@ jira: project: "JIRA" refreshInterval: 900 username: "chris.cummer" + verifyServerCertificate: true ``` ### Attributes @@ -86,3 +87,8 @@ Values: A positive integer, `0..n`. `username`
Your Jira username.
+ +`verifyServerCertificate`
+_Optional_
+Determines whether or not the server's certificate chain and host name are verified.
+Values: `true`, `false`. diff --git a/jira/client.go b/jira/client.go index b7903018..ca03152e 100644 --- a/jira/client.go +++ b/jira/client.go @@ -2,6 +2,7 @@ package jira import ( "bytes" + "crypto/tls" "encoding/json" "fmt" "io" @@ -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 From 9fce0b769e1099c8a6662ca494f1e4c61f7813f9 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Thu, 14 Jun 2018 08:37:03 -0700 Subject: [PATCH 2/2] Add verifyServerCertificate to single-use Jira config example --- _site/content/posts/modules/jira.md | 1 + docs/index.xml | 4 ++-- docs/posts/index.xml | 4 ++-- docs/posts/modules/jira/index.html | 11 +++++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/_site/content/posts/modules/jira.md b/_site/content/posts/modules/jira.md index 81f2fc9a..3daf62b7 100644 --- a/_site/content/posts/modules/jira.md +++ b/_site/content/posts/modules/jira.md @@ -45,6 +45,7 @@ jira: project: "ProjectA" refreshInterval: 900 username: "chris.cummer" + verifyServerCertificate: true ``` ### Multiple Jira Projects diff --git a/docs/index.xml b/docs/index.xml index 06220520..d5b16ac5 100644 --- a/docs/index.xml +++ b/docs/index.xml @@ -266,8 +266,8 @@ Key: j Action: Select the next item in the list. Displays all Jira issues assigned to you for the specified project. Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key. Keyboard Commands None. -Configuration Single Jira Project jira:colors:rows:even:"lightblue"odd:"white"domain:"https://umbrellacorp.atlassian.net"email:"chriscummer@me.com"enabled:truejql:"issueType = Story"position:top:4left:1height:1width:2project:"ProjectA"refreshInterval:900username:"chris.cummer" Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project): -jira:colors:rows:even:"lightblue"odd:"white"domain:"https://umbrellacorp.atlassian.net"email:"chriscummer@me.com"enabled:truejql:"issueType = Story"position:top:4left:1height:1width:2project:["ProjectA","ProjectB"]refreshInterval:900username:"chris.cummer" Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name. +Configuration Single Jira Project jira:colors:rows:even:"lightblue"odd:"white"domain:"https://umbrellacorp.atlassian.net"email:"chriscummer@me.com"enabled:truejql:"issueType = Story"position:top:4left:1height:1width:2project:"ProjectA"refreshInterval:900username:"chris.cummer"verifyServerCertificate:true Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project): +jira:colors:rows:even:"lightblue"odd:"white"domain:"https://umbrellacorp.atlassian.net"email:"chriscummer@me.com"enabled:truejql:"issueType = Story"position:top:4left:1height:1width:2project:["ProjectA","ProjectB"]refreshInterval:900username:"chris.cummer"verifyServerCertificate:true Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name. diff --git a/docs/posts/index.xml b/docs/posts/index.xml index f35cc613..82b0045a 100644 --- a/docs/posts/index.xml +++ b/docs/posts/index.xml @@ -266,8 +266,8 @@ Key: j Action: Select the next item in the list. Displays all Jira issues assigned to you for the specified project. Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key. Keyboard Commands None. -Configuration Single Jira Project jira:colors:rows:even:"lightblue"odd:"white"domain:"https://umbrellacorp.atlassian.net"email:"chriscummer@me.com"enabled:truejql:"issueType = Story"position:top:4left:1height:1width:2project:"ProjectA"refreshInterval:900username:"chris.cummer" Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project): -jira:colors:rows:even:"lightblue"odd:"white"domain:"https://umbrellacorp.atlassian.net"email:"chriscummer@me.com"enabled:truejql:"issueType = Story"position:top:4left:1height:1width:2project:["ProjectA","ProjectB"]refreshInterval:900username:"chris.cummer" Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name. +Configuration Single Jira Project jira:colors:rows:even:"lightblue"odd:"white"domain:"https://umbrellacorp.atlassian.net"email:"chriscummer@me.com"enabled:truejql:"issueType = Story"position:top:4left:1height:1width:2project:"ProjectA"refreshInterval:900username:"chris.cummer"verifyServerCertificate:true Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project): +jira:colors:rows:even:"lightblue"odd:"white"domain:"https://umbrellacorp.atlassian.net"email:"chriscummer@me.com"enabled:truejql:"issueType = Story"position:top:4left:1height:1width:2project:["ProjectA","ProjectB"]refreshInterval:900username:"chris.cummer"verifyServerCertificate:true Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name. diff --git a/docs/posts/modules/jira/index.html b/docs/posts/modules/jira/index.html index f101522c..aa8d189b 100644 --- a/docs/posts/modules/jira/index.html +++ b/docs/posts/modules/jira/index.html @@ -153,7 +153,8 @@ width: 2 project: "ProjectA" refreshInterval: 900 - username: "chris.cummer" + username: "chris.cummer" + verifyServerCertificate: true

Multiple Jira Projects

If you want to monitor multiple Jira projects, use the following @@ -174,7 +175,8 @@ configuration (note the difference in project):

width: 2 project: ["ProjectA", "ProjectB"] refreshInterval: 900 - username: "chris.cummer" + username: "chris.cummer" + verifyServerCertificate: true

Attributes

colors.rows.even
@@ -217,6 +219,11 @@ Values: A positive integer, 0..n.

username
Your Jira username.

+

verifyServerCertificate
+Optional
+Determines whether or not the server’s certificate chain and host name are verified.
+Values: true, false.

+