Adds method to force regeneration of certs #21

Merged
merged 2 commits into from Apr 25, 2016

Conversation

Projects
None yet
2 participants
Contributor

chuckbutler commented Apr 25, 2016

WIP - For talking points presently

Introduces the 'tls.regenerate_certificates' state, which allows consumer layers to reconfigure the primary ssl configuration certificate (on the master)

This has a side-effect of removing the flat file PKI database that is initially generated during TLS setup. This is unfortunate, but is a work-around to conform to expectations of the leader.

Follower behavior should be unchanged with this behavior.

Adds method to force regeneration of certs
Introduces the 'tls.regenerate_certificates' state, which allows consumer layers to reconfigure the primary ssl configuration certificate (on the master)

This has a side-effect of removing the flat file PKI database that is initially generated during TLS setup. This is unfortunate, but is a work-around to conform to expectations of the leader.

Follower behavior should be unchanged with this behavior.

@chuckbutler chuckbutler referenced this pull request in juju-solutions/layer-swarm Apr 25, 2016

Merged

SSL Termination with custom SSL Config #4

Contributor

chuckbutler commented Apr 25, 2016

This also seems to correct the behavior of #22 when adding the force param.

reactive/tls.py
+ ''' Allow the calling layer to modify settings, and trigger the
+ certificates to be re-generated (perhaps we updated the openssl conf)
+ '''
+ print(' ==> regenerating certificates')
@mbruzek

mbruzek Apr 25, 2016

Contributor

replace this print with a log message.

Contributor

mbruzek commented Apr 25, 2016

I took a preliminary look at this code change. It seems a bit drastic to delete the entire easy-rsa directory to configure easy-rsa. Perhaps the reason you were having trouble configuring easy-rsa before it generated the certificate is the reactive framework runs all valid states asynchronously, the theory being your valid state was racing with the ca certificate creation.

As an alternate solution: How about adding an intermediary state between install() and the check_ca_status() method. This state could be triggered when easy-rsa installed and do some configuration. And then change the check_ca_status() to use the decorator @When('easy-rsa configured') or something like that? If that is not possible I would be curious to why it does not work.

Transitional State
After speaking with cory_fu, the transitional state seems to be working as expected.
Contributor

chuckbutler commented Apr 25, 2016

@mbruzek - Point taken regarding wholesale removal of the PKI DB. After some additional poking, this has been refactored to introduce and use an intermediary state which will invoke the proper reactive handler in the calling layer (in this case, swarm) letting it reconfigure the easyrsa configuration prior to generating the certs, without deleting anything.

can you TAL?

@@ -15,6 +15,7 @@
from charmhelpers.core import hookenv
from charmhelpers.core import unitdata
+from charmhelpers.core.hookenv import log
@mbruzek

mbruzek Apr 25, 2016

Contributor

Minor nit, I don't see any of your new code using the log import. pep8 would not approve

Contributor

mbruzek commented Apr 25, 2016

One minor nit that should not prevent this code from going in. I did not test this code, but watched it work on @chuckbutler 's console.

@mbruzek mbruzek merged commit bba7ec5 into juju-solutions:master Apr 25, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment