-
Notifications
You must be signed in to change notification settings - Fork 27
implement ssl-skip-verify to forward to self-signed-certificates #29
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
base: master
Are you sure you want to change the base?
Changes from all commits
46844ce
6c0ab30
64c0448
5e9ffb2
e67473b
d4b1c5a
fff2754
19fe0a5
aaa724f
94ffb00
c4d0097
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: Makefile CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ master ] | ||
| pull_request: | ||
| branches: [ master ] | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: make all | ||
| run: make gets test application |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,6 @@ src/code.google.com/* | |
| log | ||
| log/* | ||
| etc | ||
| __debug_bin | ||
| clammit.exe | ||
| clammit.cfg | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,5 +27,8 @@ application: | |
| gets: | ||
| go get | ||
|
|
||
| build: | ||
| go build | ||
|
|
||
| release: | ||
| goreleaser release | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
| package forwarder | ||
|
|
||
| import ( | ||
| "crypto/tls" | ||
| "io" | ||
| "io/ioutil" | ||
| "log" | ||
|
|
@@ -48,17 +49,19 @@ type Forwarder struct { | |
| logger *log.Logger | ||
| debug bool | ||
| contentMemoryThreshold int64 | ||
| sslSkipVerify bool | ||
| } | ||
|
|
||
| /* | ||
| * Constructs a new forwarder. Pass in the application URL and the interceptor. | ||
| */ | ||
| func NewForwarder(applicationURL *url.URL, contentMemoryThreshold int64, interceptor Interceptor) *Forwarder { | ||
| func NewForwarder(applicationURL *url.URL, contentMemoryThreshold int64, interceptor Interceptor, sslSkipVerify bool) *Forwarder { | ||
| return &Forwarder{ | ||
| applicationURL: applicationURL, | ||
| interceptor: interceptor, | ||
| logger: log.New(ioutil.Discard, "", 0), | ||
| contentMemoryThreshold: contentMemoryThreshold, | ||
| sslSkipVerify: sslSkipVerify, | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -236,6 +239,11 @@ func (f *Forwarder) getClient(req *http.Request) (*http.Client, *url.URL) { | |
| }, url | ||
| } else { | ||
| f.logger.Printf("Forwarding to %s", applicationURL.String()) | ||
| return &http.Client{}, url | ||
| // allow for | ||
| // https://stackoverflow.com/questions/12122159/how-to-do-a-https-request-with-bad-certificate | ||
| tr := &http.Transport{ | ||
| TLSClientConfig: &tls.Config{InsecureSkipVerify: f.sslSkipVerify}, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks OK as today we only have a single option. For the future, we’ll want to pass the tls config object in the forwarder struct directly, that’ll allow us to drive any tls config options from clammit configuration without adding more fields to the Forwarder struct.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree - I was not happy also. But I did not wanted to do a full refactoring .... |
||
| } | ||
| return &http.Client{Transport: tr}, url | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.