Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Let's Encrypt Certbot Alternatives
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Let's Encrypt Certbot Alternatives

I'm switching the sites I run to Let's Encrypt. I really don't like how certbot wants to run as root because I don't like things running as root, especially if it's technically not needed. I played around with running it as a separate user and while I got it to work, it feels a little messy.

I am looking for alternatives and acme-tiny seems nice. I like Python and plan to use a CSR for all the requests so it seems like a good fit.

At the end of the day I'm looking for something I can run as an unprivileged user.

Anyone else used acme-tiny or anything else? How was your experience?

Comments

  • perennateperennate Member, Host Rep

    I've used this one for something once (don't remember what it was) and it worked nicely: https://github.com/lukas2511/dehydrated

    But if you are going to interact with it programatically then acme-tiny is probably a better choice.

    Thanked by 2JustAMacUser Catalin
  • rm_rm_ IPv6 Advocate, Veteran
    edited September 2016

    JustAMacUser said: At the end of the day I'm looking for something I can run as an unprivileged user.

    https://github.com/lukas2511/letsencrypt.sh can do that. Oh nevermind, turns out he renamed it "dehydrated" so it was just mentioned above.

  • Currently we are using acme.sh (has been officially integrated into VPSSIM too).

    This tiny script can be run as regular user.

    I am a fan of VPSSIm btw. :)

  • geekalotgeekalot Member
    edited September 2016

    @perennate said:
    I've used this one for something once (don't remember what it was) and it worked nicely: https://github.com/lukas2511/dehydrated

    But if you are going to interact with it programatically then acme-tiny is probably a better choice.

    Bash FTW

  • @JustAMacUser said:
    [...] I really don't like how certbot wants to run as root because I don't like things running as root, especially if it's technically not needed. I played around with running it as a separate user and while I got it to work, it feels a little messy.

    Well, "technically not needed" is not completely right. As far as I know, there are two things that currently require root:
    If you for example want to use the standalone pluging, which binds to ports 80 and 443, you have to be either root or simply use setcap to let a non-root user bind to a port below 1023.
    Furthermore the certbot-auto requires root, because it also updates system dependencies and wants to be able to use alle plugin. Apache and nginx for example would need root too, to allow for a graceful restart.
    So you have three options to run it without root: Use the standalone plugin with setcap, or use the webroot and manual plugin.

    However, this doesn't change the fact, that the client is somehow "messy" compared to those alternatives, that only have a single executable...

    Thanked by 2yomero vimalware
  • rm_rm_ IPv6 Advocate, Veteran

    geekalot said: +LetsEncrypt Smart Renew to check remaining validity period to ratelimit your renewal attempts

    dehydrated does that on its own. Why do you need additional script?

  • @rm_ said:

    geekalot said: +LetsEncrypt Smart Renew to check remaining validity period to ratelimit your renewal attempts

    dehydrated does that on its own. Why do you need additional script?

    Correct me if I am wrong but Dehydrated only does that as part of actually renewing the certs ... isn't that what Issue/enhancement #108 is all about?

    Smart Renew just integrated better for my purposes and setup.

  • rm_rm_ IPv6 Advocate, Veteran

    geekalot said: Correct me if I am wrong but Dehydrated only does that as part of actually renewing the certs

    Processing xxx
     + Checking domain name(s) of existing cert... unchanged.
     + Checking expire date of existing cert...
     + Valid till Nov 15 01:09:00 2016 GMT (Longer than 30 days). Skipping renew!
    Processing yyy with alternative names: zzz
     + Checking domain name(s) of existing cert... unchanged.
     + Checking expire date of existing cert...
     + Valid till Dec 24 01:09:00 2016 GMT (Longer than 30 days). Skipping renew!
    Processing bbb
     + Checking domain name(s) of existing cert... unchanged.
     + Checking expire date of existing cert...
     + Valid till Dec 10 01:09:00 2016 GMT (Longer than 30 days). Skipping renew!
    Processing qqq
     + Checking domain name(s) of existing cert... unchanged.
     + Checking expire date of existing cert...
     + Valid till Dec  1 13:01:00 2016 GMT (Longer than 30 days). Skipping renew!
  • @rm_ said:

    geekalot said: Correct me if I am wrong but Dehydrated only does that as part of actually renewing the certs

    Processing xxx
    >  + Checking domain name(s) of existing cert... unchanged.
    >  + Checking expire date of existing cert...
    >  + Valid till Nov 15 01:09:00 2016 GMT (Longer than 30 days). Skipping renew!
    > Processing yyy with alternative names: zzz
    >  + Checking domain name(s) of existing cert... unchanged.
    >  + Checking expire date of existing cert...
    >  + Valid till Dec 24 01:09:00 2016 GMT (Longer than 30 days). Skipping renew!
    > Processing bbb
    >  + Checking domain name(s) of existing cert... unchanged.
    >  + Checking expire date of existing cert...
    >  + Valid till Dec 10 01:09:00 2016 GMT (Longer than 30 days). Skipping renew!
    > Processing qqq
    >  + Checking domain name(s) of existing cert... unchanged.
    >  + Checking expire date of existing cert...
    >  + Valid till Dec  1 13:01:00 2016 GMT (Longer than 30 days). Skipping renew!

    Understood, but I've got to do other actions for some custom (read: PITA) DNS setups in support of renewals. Your point is well taken though, for most users you would not have to use Smart Renew.

  • @perennate said:
    I've used this one for something once (don't remember what it was) and it worked nicely: https://github.com/lukas2511/dehydrated

    Thanks. Looked at it over the weekend and it seems to be a pretty complete package. Quite nice that it's all done in Bash.

    Between acme-tiny and dehydrated I think I'll be able to do what I want, but does anyone have any other thoughts?

  • joepie91joepie91 Member, Patron Provider

    Not a direct answer to your question, but Caddy has Let's Encrypt support built in, so that you don't need to use a separate tool at all.

    Thanked by 1mholt
  • @joepie91 said:

    I'm pretty comfortable with Nginx and Apache at the moment, but I'll take a look at it because it's new to me and I like to tinker. :)

  • raindog308raindog308 Administrator, Veteran

    JustAMacUser said: I really don't like how certbot wants to run as root

    That is so stupid and harmonizes well with my overall opinion of the intelligence behind Let's Encrypt.

    Thanked by 1JustAMacUser
  • raindog308 said: That is so stupid and harmonizes well with my overall opinion of the intelligence behind Let's Encrypt.

    That's a bit disingenuous. You think requiring root privileges is stupid?

    Anyway, you can use the DNS challenge which doesn't require opening a listener.

  • I use letsencrypt.sh (which is now renamed to dehydrated) and I've not had any issues with it AND I don't run as root.

    What I've done is roughly:

    a) Slightly modified letsencrypt.sh script (essentially uses an openssl config file instead of passing the SAN via cmdline options - not much of a change as such).

    b) Uses sshfs to mount a remote directory locally (via ssh-agent/keys so no interaction required). This allows the letsencrypt.sh script to just work as if everything was local.

    c) Apache/Nginx (httpd) is setup on the remote server so that the acme-challenge folder is actually what (b) above uses - so letsencrypt.sh writes to the sshfs mounted folder and those random files are accessible via the domain/web-server to issue certs (note that this is a one time setup of aliases/whatever to allow httpd to serve files from the normal-user-owned acme-challenge folder which can live anywhere on the file system).

    d) My private keys never leave my system.

    e) Once the process completes and the cert is issued, I rsync the cert to whatever remote ssl httpd directory is setup so that httpd can pick it up on a restart.

    f) NO Root required at all (except for the one time setup of the acme-challenge folder via httpd configuration settings). The acme-challenge folder is owned by the user running the script (normal user) who has full write permissions etc. and the only need is to ensure that the files created are world readable so that httpd can serve them when referenced (these are the ephemeral files created by the letsencrypt.sh script to validate domain ownership etc.)

    g) All this is completely scripted via the wrapper which is what I really run (which calls the letsencrypt.sh script as required for whatever domain).

    h) Of course I manually run the wrapper once every 2-3 months but I don't see why that can't be automated as well (letsencrypt.sh handles renewal if required - so no harm in running more often as it won't do anything).

    Any holes to poke?

  • rm_rm_ IPv6 Advocate, Veteran
    edited October 2016

    @nullnothere I'm not sure why so complicated? Why not just run dehydrated on the actual HTTPS serving hosts?

    nullnothere said: Slightly modified letsencrypt.sh script

    Gj, now enjoy porting your changes every time as you upgrade it to a new version. Why not write a small wrapper around the script instead. In your case such wrapper could read your openssl config file, read SANs and pass those to letsencrypt.sh via command line.

    Uses sshfs to mount a remote directory locally

    What is even the point. Also requires a *nix machine locally, which many people don't have.

    nullnothere said: My private keys never leave my system.

    Keys to what? To the cert? They need to be present on the HTTPS web server machine anyway.

    nullnothere said: NO Root required at all

    Sure enough, letsencrypt.sh doesn't require root, in fact mine even gets launched via "sudo -u nobody". On the other hand the wrapper script that I wrote (and therefore trust) runs as root, checks if letsencrypt.sh has renewed or updated anything and then reloads the web server.

    nullnothere said: manually run the wrapper once every 2-3 months

    That's a monumental hassle and easy to forget, would be a non-starter for me if this was actually required.

  • I use Dehydrated using dns-01 challenge using a hook script to add the record via cloudflare api, like @rm_ i use a wrapper script too running as root to be able to reload Dovecot/Nginx/Postfix etc.

    Dehydrated is run via a unprivileged user as it dose not need any write access to website files, as it using a hook script to do a few curl to cloudflare api to add the dns-01 challenge.

  • @rm_
    Sure enough, letsencrypt.sh doesn't require root, in fact mine even gets launched via "sudo -u nobody". On the other hand the wrapper script that I wrote (and therefore trust) runs as root, checks if letsencrypt.sh has renewed or updated anything and then reloads the web server.

    This is what I decided to do as well. After code reviewing dehydrated I decided to go with it. A wrapper script handles the specifics and uses dehydrated to renew the cert from a CSR. Seems like the simplest approach and keeps privileges where they belong.

  • @rm_,

    In my particular case, I have other stuff around openssl config files and so find it easier to just have a one line patch for letsencrypt.sh. Also, I find it much easier to centrally manage my SSLs/configurations instead of having them on multiple servers (as masters instead of just replicated setups).

    Other points are of course all personal preferences.

    As for the private key, I meant my account key which need not be present on the public webserver(s). The certs' private key is of course on the https server as you point out.

    In my case I have cron scripts to remind me about upcoming SSL expiry dates and so the manual run option hasn't been a pain at all (and of course, as I said, it's quite straight forward to automate should I need it).

    The key point though was that it is possible to use letsencrypt.sh without root privileges and it works well enough as you and others have attested.

    Thanked by 1Blazing
Sign In or Register to comment.