Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support self signed certificate #2

Open
tranmh opened this issue Aug 6, 2020 · 0 comments
Open

Support self signed certificate #2

tranmh opened this issue Aug 6, 2020 · 0 comments

Comments

@tranmh
Copy link

tranmh commented Aug 6, 2020

Hi,

in certain situation it is not possible to have a valid certificate, i.e. because it is self signed and you are in a testing environment. Nonethless I would like to have the watchdog support. So therefore I follow this question:
https://stackoverflow.com/questions/12122159/how-to-do-a-https-request-with-bad-certificate
and change watchdog-tomcat.go adding InsecureSkipVerify: true.

Would you please so kind and bring my change to branch master? Thx.

Here is the diff:

diff --git a/watchdog-tomcat.go b/watchdog-tomcat.go
index cf792d3..5621d23 100644
--- a/watchdog-tomcat.go
+++ b/watchdog-tomcat.go
@@ -7,6 +7,7 @@ import (
     "fmt"
     "io"
     "net/http"
+    "crypto/tls"
     "os"
     "os/exec"
     "strconv"
@@ -70,7 +71,11 @@ func runWatchedApp(application string) (pid int, err error) {
 }
 
 func healthCheck(check_url string, timeout time.Duration) (bool, error) {
+    tr := &http.Transport{
+        TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
+    }
     var netClient = &http.Client{
+        Transport: tr,
         Timeout: time.Second * timeout,
         CheckRedirect: func(req *http.Request, via []*http.Request) error {
             return http.ErrUseLastResponse

tranmh added a commit to tranmh/systemd-watchdog-tomcat that referenced this issue Jun 21, 2022
tranmh added a commit to tranmh/systemd-watchdog-tomcat that referenced this issue Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant