Skip to content

Let's Encrypt integrationΒ #54

@carlosbaraza

Description

@carlosbaraza

Yesterday I did a quick integration of Let's Encrypt in the deprecated MeteorUp repository. These are the pull requests: #873 and meteorhacks/mup-frontend-server#10

CLI

I would like to do this in a better way within this repo. After having a look to the architecture of this new MeteorUp, I thought that could be nice to create another module called tls or ssl, so we could use the following commands in the CLI:

  • mup tls status: Give current status of the certificate, expiration, register, etc.
  • mup tls renew: Renew the certificate.

Config

To configure Let's Encrypt generator, I was thinking about the following mup.js API:

...
"ssl": {
  "autogenerate": {
    "email": "[email protected]",
    "domains": "example.com"
  }
  ...
}
...

In order to use the renew, it should be needed to include the autogenerate option in the mup.js file.

Frontend server generating certificates

The way I would like to approach the generation is using the Let's Encrypt plugins webroot and standalone. Both behaviours could be included in the meteorhacks/mup-frontend-server container, as Let's Encrypt needs to expose a challenge file using a webserver that will be fetched by the certificate authority using the given domains as URL base. If the file is correctly fetched by them using the domains, the certificate is validated.

The usage I was thinking is mounting a volume to the container including the certificates.

  • If certificate volume already include a valid certificate: Container should run like it runs right now, using the certificate.
  • If certificate volume includes a valid certificate but it is close to expire and the autogenerate is set up: Container should run a cron job every week to check if the certificate will expire soon and renew the certificate, persisting it through the volume. This will use the webroot plugin, to avoid having downtime for the generation of the certificate.
  • If the certificate is not existing or not valid, and the autogenerate is set up: The container should generate a new certificate using the standalone plugin, as nginx can not boot up without the certificate (Another option is having two nginx.conf files). Once the certificate is generated, nginx would boot normally.

Impressions and improvements

If you have any suggestion to improve this implementation, let me know and we can work on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions