-
Notifications
You must be signed in to change notification settings - Fork 74
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
initial implementation of persistence [RFC/WIP] #63
base: master
Are you sure you want to change the base?
Conversation
Nice one! Would it make sense to be compatible with the |
renamed data bag item key "crt" to "cert" which should make it compatible if the combination of "key", "crt"/"cert" and "chain" is used. |
So this is definitely a great start, just thinking what we would need before it can be merged in. Of the top if my head I'm thinking:
|
ca0ec40
to
7422d76
Compare
@thoutenbos can you add a basic chefspec setup to the master branch? kitchen integration tests are IMHO worthless because they fail all the time and have such a big overhead. |
… and we need chef13 compatibility. |
7422d76
to
fbb6023
Compare
changes in SAN need to be covered, too. This is broken in the main part, too (see #35). Reagarding SAN changes: IMHO this should be part of the core |
Now that we have Chef 13 support and the build fixes this should be able to go to master. Would you be able to add the README and integration tests to make it ready ? |
Chef::Log.error("certificate file #{crt || fullchain} exists but is broken: #{e}") | ||
end | ||
|
||
item = load_data_bag_item(data_bag_name, 'id:' + cn, secret) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don’t need this custom method, and can instead use the built-in data_bag_item()
method, since you’re in a scope that has it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My solution was supposed to support three cases:
- no encrypted data bag -> empty secret
- custom data bag secret -> manual set secret
- default data bag secret -> manual set secret
using chef's data_bag_item
without a secret automatically falls back to the secret defined in Chef::Config[:encrypted_data_bag_secret]
in case of an encrypted data bag (no way to customize and iirc providing nil
as secret throws an exception, too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmoriz ah! I forgot about the nil
throwing an exception. In that case, this is great.
(This is currently a RFC which I just hacked together.)
Motivation:
In complex setups, when you have more than one front-facing httpd, like in anycast/cdn setups, you have the following problems with acme workflows:
I've seen many suggestions like using s3,
syncthing
,rsync
… however I don't like the complexity and more single points of failure.My implementation
Limitation
The master client needs the correct permission to create/upload data bags to the chef server. This may have security implications.
One must configure one and only one node which acts as master. This can be a simple node attribute, or some DSL method like
tagged?
. fail-over must be implemented manually or by automatically updating attributes on the chef-server by a 3rd party (e.g. monitoring).Key/Cert on workers may lag one converge cycle, this can be reduced by triggering converges on workers with tools like chef's "push jobs".
Usage:
Chef
Example recipe code:
on the master node with
node['acme']['master']
set to truefirst run
save
toacme_persistence
.acme_persistence
uploads data to server.subsequent runs/ renew
save
toacme_persistence
acme_persistence
uploads data to server.on workers, without
node['acme']['master']
first run
acme_persistence
does not find certificates in the data bagacme_selfsigned
will create dummies so the webserver can start.subsequent runs/ renew
acme_persistence
finds a data bag item and renders out the data and triggers a webserver reload (same logic as in the master)Webserver
Workers must proxy acme verification requests to the
.well-known
URL to the master node. This can easily be scripted inside a virtual host template and triggered by the same source as above (e.g. a node attribute)e.g.
related: #15