-
Notifications
You must be signed in to change notification settings - Fork 140
Rework letsencrypt::certonly for #175 #177
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
Conversation
Tests were failing due to timeout. I relaunched them and now its ok. |
@cFire can you add |
The reason I've removed the WIP from the title is because it's ready for review (as far as I'm concerned). Sorry I did not explicitly mention that. |
manifests/certonly.pp
Outdated
], | ||
} | ||
} else { | ||
file { "${config_dir}/live/${live_path_domain}/": |
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.
Did some testing to see what this'd do out of curiosity/concern. I'd personally look at running an exec to have certbot itself delete the certificate as rm -rf'ing the directory isn't quite sufficient to clean it all up. There are still files left behind in /etc/letsencrypt/renewal and /etc/letsencrypt/archive.
/etc/letsencrypt/renewal/certone.test.rawr.no.conf
/etc/letsencrypt/archive/certone.test.rawr.no
Certbot is unhappy about them as well:
$ certbot certificates
...
Renewal configuration file /etc/letsencrypt/renewal/certone.test.rawr.no.conf produced an unexpected error: expected /etc/letsencrypt/live/certone.test.rawr.no/cert.pem to be a symlink. Skipping.
Creating a new certificate again with the same name without cleaning up these files makes it append a -0001 to it, still leaving the old files behind and generating a certificate name the module can't clean up by itself.
What about something like this?
exec { "letsencrypt cleanup ${title}":
command => "${letsencrypt_command} delete --cert-name ${title}",
path => $facts['path'],
onlyif => "test -d '${config_dir}/live/${live_path_domain}'",
}
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.
That's a much better idea. I'll look into implementing that over the coming week.
While working on implementing the delete function I noticed this;
I think this is wrong when using a custom name like Can someone please confirm I'm not seeing things that aren't there?
|
Pull request is ready for another round of reviews. All tests are passing and it seems to work well in my environments. |
@cFire The reason |
@cFire I'm sorry, you were right - the sneaky feeling got me testing and certbot does use
|
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.
Nice. Looks pretty good IMO.
I added a question in inline comment.
I'm mildly confused about what just happened, but besides ci needing to be re-triggered it seems to be in a correct state again. |
I relaunched the travis ci. |
Well, that somehow broke absolutely everything. Stand by... |
+ Added $ensure attribute + Renamed $ensure_cron back to $manage_cron + Returned $manage_cron back to a Boolean value + Made execute of "letsencrypt certonly ${title}" conditional to $ensure == 'present' + Added cleanup of directory for domain certs when $ensure == 'absent' + Used global $ensure to signal desired state of cronjobs
Fixed again. Used the wrong rebase strategy before. |
@cFire thank you for the job. |
WIP: Need to test it and update documentation etc.