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

Add support for TLSSkipVerify for https consul fabio check #268

Merged

Conversation

Ginja
Copy link
Contributor

@Ginja Ginja commented Apr 21, 2017

When serving the UI/API over HTTPS, the fabio consul health check will most likely fail as it's trying to connect to the page over its IP. Most certificates don't include IP SANs. This flag allows users to toggle whether or not to skip TLS verification for this particular check.

Edit: This will require Consul >= 0.7.2
hashicorp/consul#1984
hashicorp/consul#2530

@CLAassistant
Copy link

CLAassistant commented Apr 21, 2017

CLA assistant check
All committers have signed the CLA.

Register: true,
ServiceAddr: ":9998",
ServiceName: "fabio",
ServiceTLSSkipVerify: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can omit that since this is the default

@@ -426,6 +426,13 @@ func TestLoad(t *testing.T) {
},
},
{
args: []string{"-registry.consul.register.tlsskipverify=false"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls test with true since false is the default

config/config.go Outdated
Register bool
ServiceAddr string
ServiceName string
ServiceTLSSkipVerify bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be CheckTLSSkipVerify and pls move it to the bottom below CheckScheme

config/load.go Outdated
@@ -158,6 +158,7 @@ func load(cmdline, environ, envprefix []string, props *properties.Properties) (c
f.BoolVar(&cfg.Registry.Consul.Register, "registry.consul.register.enabled", defaultConfig.Registry.Consul.Register, "register fabio in consul")
f.StringVar(&cfg.Registry.Consul.ServiceAddr, "registry.consul.register.addr", defaultConfig.Registry.Consul.ServiceAddr, "service registration address")
f.StringVar(&cfg.Registry.Consul.ServiceName, "registry.consul.register.name", defaultConfig.Registry.Consul.ServiceName, "service registration name")
f.BoolVar(&cfg.Registry.Consul.ServiceTLSSkipVerify, "registry.consul.register.tlsskipverify", defaultConfig.Registry.Consul.ServiceTLSSkipVerify, "service tls verification")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls change to registry.consul.register.checkTLSSkipVerify since I've - unfortunately - used camelCase with the other check parameters as well. The comment should be service check TLS verifcation

@Ginja Ginja force-pushed the service-tls-skip-verification branch from 402ce99 to 4946b9e Compare April 22, 2017 05:15
@Ginja
Copy link
Contributor Author

Ginja commented Apr 22, 2017

@magiconair Thanks for the review! Made the changes, and squashed everything into one commit.

@Ginja Ginja force-pushed the service-tls-skip-verification branch from 4946b9e to 3703802 Compare April 22, 2017 05:20
CheckInterval: time.Second,
CheckTimeout: 3 * time.Second,
CheckScheme: "http",
CheckTLSSkipVerify: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls remove this since false is the default

Copy link
Contributor Author

@Ginja Ginja Apr 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, but then how do I expose the parameter?

https://github.com/fabiolb/fabio/pull/268/files?diff=unified#diff-f1ea9ed43b0b0ed74a6cf0f71dad3196R165

Do you want defaultConfig.Registry.Consul.CheckTLSSkipVerify just to be false in the link above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field itself is defined in config.Config and not here. The value that you are setting in defaultConfig is automatically set by the compiler and therefore redundant. false is the default value for any bool variable.

Copy link
Contributor Author

@Ginja Ginja Apr 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: Ignore that last question, need more coffee this morning! I'll update this PR later today.

Thanks for your help!

@magiconair
Copy link
Contributor

fabio.properties also needs to be updated. Could you please add that?

@magiconair
Copy link
Contributor

magiconair commented Apr 22, 2017 via email

When serving the UI/API over HTTPS, the fabio consul
health check will most likely fail as it's trying to
connect to the page over its IP. Most certificates don't
include IP SANs. This flag allows users to toggle whether
or not to skip TLS verification for this particular check.
@Ginja Ginja force-pushed the service-tls-skip-verification branch from 3703802 to 0db7b84 Compare April 22, 2017 17:05
@Ginja
Copy link
Contributor Author

Ginja commented Apr 22, 2017

Changes made.

Fix text and whitespace
@magiconair magiconair changed the title Added -registry.consul.register.tlsskipverify flag Add support for TLSSkipVerify for https consul fabio check Apr 22, 2017
@magiconair magiconair merged commit 8e74533 into fabiolb:master Apr 22, 2017
@magiconair
Copy link
Contributor

Made some minor text changes in the fabio.properties and then merged it. Thanks for providing this patch! :)

@magiconair magiconair added this to the 1.4.3 milestone Oct 10, 2017
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

Successfully merging this pull request may close these issues.

None yet

3 participants