31 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
c1cf5699c2
letsencrypt: Use privileged decorator for actions
Tests:

- DONE: Initial setup works
- DONE: Certificate events on FreedomBox startup work
- DONE: Basic operations work: obtain, revoke, delete
- DONE: Status of certificates is shown properly
- DONE: Domain add/remove hooks work, errors are handled
- Not tested: Removing old hooks
- DONE: Errors are shown properly on failure: revoke, obtain, reobtain, delete

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:52:17 -04:00
Sunil Mohan Adapa
3c7bc4a192
*: pylint: Explicitly specify encoding when open a file
This is recommended by PEP-0597: https://peps.python.org/pep-0597/

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 19:45:57 -04:00
Sunil Mohan Adapa
5327f65db0
actions/letsencrypt: Drop use of managed_paths and use LE component
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:36:22 -05:00
Sunil Mohan Adapa
eada506b23
actions/*: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:39:36 +02:00
Veiko Aasa
ed646d84a5
actions: Check with flake8
Also fix flake8 warnings.

Closes: #1613

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil@medhas.org split multi strings differently to avoid spaces]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-10-10 19:08:45 -07:00
Sunil Mohan Adapa
8ece36893c
letsencrypt: Revoke certificate only if it exists
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-11 18:39:58 -04:00
Sunil Mohan Adapa
254b8a98a9
letsencrypt: Handling certificate renewals when daemon is offline
During boot or in other situations when FreedomBox Service is offline, Let's
Encrypt certificate renewals might happen. When FreedomBox Service starts, check
on such certificates and run certificate setup mechanism in each app to use the
latest renewed certificate.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-16 15:13:21 +05:30
Sunil Mohan Adapa
da366636d8
letsencrypt: Implement action to compare copied certificates
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-16 15:12:16 +05:30
Sunil Mohan Adapa
ebbc9912d2
letsencyrpt: Implement action to copy certificates
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-16 15:12:05 +05:30
Sunil Mohan Adapa
c042ff5a2e
letsencrypt: Add lineage information in status
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-16 15:11:57 +05:30
Sunil Mohan Adapa
486f91d129
letsencrypt: Remove old style hooks from all configuration files
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-16 15:10:56 +05:30
Sunil Mohan Adapa
d8647aaf18
letsencrypt: Remove renewal hooks implementation
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-16 15:10:38 +05:30
Sunil Mohan Adapa
a134311663
letsencrypt: Force commands to be non-interactive
This fixes issues with revoking certificates.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-16 15:10:27 +05:30
Sunil Mohan Adapa
cf06aa3d56
letsencrypt: Pre-enable necessary apache modules
To avoid restart during installation (although since letsencrypt is an essential
app and this is not an issue).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-28 20:13:38 -05:00
Joseph Nuthalapati
a918f9a885
matrix-synapse: Use Let's Encrypt certificates
Matrix requires valid certificates for federation with other servers from
version 1.0 onward. If the FreedomBox server already has LE cert and private
key, copy them into /etc/matrix-synapse

- Add certificate renewal hooks for Matrix Synapse. Reusing the certificate
  renewal mechanism built for ejabberd with matrix-synapse as well. One notable
  difference is that Matrix Synapse doesn't support switching the domain name or
  dropping the Let's Encrypt certificate.

- Use self-signed certificate if there is no LE certificate. Matrix Synapse
  server startup fails if the files homeserver.tls.crt and homeserver.tls.key
  are missing.

- Copy Apache's snakeoil certificates to /etc/matrix-synapse when LE
  certificates are not available. Prefer LE certificates if available.

- Display warning if no valid LE certificate is found.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-02-13 11:29:36 -08:00
Sunil Mohan Adapa
91ba56e3ce
letsencrypt: Use macros for configuring sites
Makes it trivial to alter site configuration for all domains at once. Also
possible to easily switch to TLS modules other than mod_gnutls.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-26 09:20:05 -05:00
Sunil Mohan Adapa
6bf5109108
Rename Plinth to FreedomBox in code messages
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:51 -05:00
Sunil Mohan Adapa
90f2117554
Rename Plinth to FreedomBox in comments
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:45 -05:00
Sunil Mohan Adapa
dea4af17fb
Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
RaviBolla
644b4ef4e5
config: refactoring of config.py into views and form
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-11-13 12:52:21 -05:00
Johannes Keyser
f628eb2cc2
ejabberd: Use Let's Encrypt certificate, also across renewals.
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-10-01 10:48:39 -04:00
James Valleroy
3ea5868ec1
pylint and spelling fixes 2017-07-19 21:47:07 -04:00
Johannes Keyser
1069f84154
letsencrypt: Add option to let Plinth "manage" certbot's renewal hooks
- add action commands for managing and running hooks

- adding template, view and url for managing and running hooks

- disable Plinth hook management on domain change
2017-07-19 21:47:00 -04:00
Johannes Keyser
1a39ec0267
letsencrypt: add option to delete certificates 2017-07-06 22:30:10 -04:00
Johannes Keyser
57e96b298c
letsencrypt: show more info on cert validity status 2017-07-06 22:30:01 -04:00
Johannes Keyser
320b993c4d
letsencrypt: directly call certbot in action script 2017-06-24 11:34:33 -04:00
Johannes Keyser
634afef1c9
actions: Make subparsers mandatory, fixes calls without arguments
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2017-04-10 11:54:23 +05:30
Sunil Mohan Adapa
7025cf099e
letsencrypt: Fix spelling (Dietmar) 2016-08-26 21:52:01 -04:00
Saúl Ibarra Corretgé
b0b67db35e
letsencrypt: Force text mode
This avoids letsencrypt trying to launch a dialog interface in case of
certain errors.
2016-02-19 19:54:09 +05:30
caitlin
429d26d961
letsencrypt: Don't fail if live dir does not exist 2016-01-14 14:18:53 +05:30
Sunil Mohan Adapa
1a17819380
letsencrypt: New basic module for SSL certficates
This is the first implementation for obtaining certificates from Let's
Encrypt.  Following the features and limitations.

- Requires manual operation.

- Registrations are done anonymously.

- Supports revoking and re-obtaining certificates.  Does not have a way
  to show if a certficate is already renewed.

- Automatic renewal is not available.

- Details messages in case of errors.

- Has ability to switch to testing mode by using LE's staging servers.

- Sets up Apache configuration for the domain and enables/disables it.
  When certificates are not available for a domain, default website
  configuration is used.  When certificates are available, separate
  SSL website configuration for each domain is used.

- Many domain will work with a single IP address with the help of Server
  Name Indication (SNI) which is supported by all modern browsers.

- Supports diagnostics on websites.
2016-01-14 14:18:43 +05:30