Install newest Caddy version with role nvjacobo.caddy and update template and pre-generated certs
This commit will also allow Caddy to properly generate certs with longer lifetimes than 12 hours, and by default it has been set to 1 month. This commit removes the pre-generated certs for safety reasons. This commit also updates the README.md thoroughly with some guides about the certs and how to use the role in general.
This commit is contained in:
parent
733c3ed250
commit
7c614ae8ff
8 changed files with 20 additions and 48 deletions
22
README.MD
22
README.MD
|
|
@ -1,13 +1,17 @@
|
|||
# Kifi Caddy
|
||||
|
||||
Installs and configures Caddy for use as a local ACME CA server allowing certificates to be issued in testing.
|
||||
This role should function as of now, but for example certificate lifetime changes don't work (defaults to 12h).
|
||||
Installs and configures Caddy for use as a local ACME CA server allowing certificates to be issued in testing.\
|
||||
By default, the Caddyfile defaults to 1 month for the leaf certificates and 1 year for the intermediate certificate.\
|
||||
To use the same certificates for all VM's that use this role, create directory `./files/certs` in the root of the repo, and using for example scp or sshfs move the certificates from one your VM's to the directory.\
|
||||
The location of the certs is usually `/var/lib/caddy/.local/share/caddy/pki/authorities/local`. Simple copy-paste everything from there to your host machine and into the role directory.\
|
||||
This is for mostly convenience, as multiple VM's might use this role so you only need to import the `root.crt` to your browser once.
|
||||
|
||||
|
||||
## Example usage
|
||||
|
||||
In your playbook, define the role and config paths. Most likely the defaults are fine, so you can just simply add the role. Remember to add this before any certbot role. The ACME server is hosted at port 8443. You can also change the `templates/Caddyfile.j2` to fit your own needs.
|
||||
|
||||
Example for tilastot.kirjastot.fi.local:
|
||||
In your playbook, define the role and config paths. Most likely the defaults are fine, so you can just simply add the role. Remember to add this before any certbot role. The ACME server is hosted at port 8443. You can also change the `templates/Caddyfile.j2` to fit your own needs.\
|
||||
\
|
||||
Example:
|
||||
```
|
||||
- role: kifi.caddy
|
||||
caddy_config_path: /etc/caddy/Caddyfile
|
||||
|
|
@ -15,7 +19,7 @@ Example for tilastot.kirjastot.fi.local:
|
|||
caddy_service_name: caddy
|
||||
```
|
||||
|
||||
Another example of how to use this in combination with the kifi.certbot role:
|
||||
Another example of how to use this in combination with the kifi.certbot role on domain tilastot.kirjastot.fi.local:
|
||||
```
|
||||
tasks:
|
||||
- name: Run Certbot role
|
||||
|
|
@ -41,4 +45,8 @@ tasks:
|
|||
```
|
||||
|
||||
Note that the domains get looped over, so you can have multiple of them.
|
||||
Certificates for domains can be found in the folder /etc/letsencrypt/live/domainname though it might be wise to change this
|
||||
Certificates for domains can be found in the folder /etc/letsencrypt/live/domainname though it might be wise to change this
|
||||
|
||||
# Dependencies
|
||||
|
||||
[nvjacobo.caddy](https://github.com/nvjacobo/caddy.git) - Used for installing Caddy
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIBtDCCAVqgAwIBAgIRAMHp+q/ddqH+S9fE5V7QhhkwCgYIKoZIzj0EAwIwJjEk
|
||||
MCIGA1UEAxMbTXkgTG9jYWwgQ0EgLSAyMDI1IEVDQyBSb290MB4XDTI1MTIwMTEz
|
||||
MTg1M1oXDTI1MTIwODEzMTg1M1owKTEnMCUGA1UEAxMeTXkgTG9jYWwgQ0EgLSBF
|
||||
Q0MgSW50ZXJtZWRpYXRlMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEZL83Hyar
|
||||
iIsBkRtRNxRtHoiW7KEUuxq4gVyNrJjtdYZwlfZE+qOCYo5I6E99zZiVD2SZNe1x
|
||||
uVXYV6mcERDnC6NmMGQwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8C
|
||||
AQAwHQYDVR0OBBYEFJII7wjwySNFSJWt700GYE1JfsGxMB8GA1UdIwQYMBaAFHCv
|
||||
EafSET7wyiMUOd3eZrQx3lw8MAoGCCqGSM49BAMCA0gAMEUCIQCCj54nwceSHHJ+
|
||||
RCN2CyEByqMh/RdDd/FijJ800x3J6gIgemnp9J3CrKN/Fzy3JOhetVCRkVqjDNLc
|
||||
ZH4K1pYnDBA=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIDLfKjCXLIseInlVmkL1dx6K/Iv6uxjhJjRmI4xr9kXNoAoGCCqGSM49
|
||||
AwEHoUQDQgAEZL83HyariIsBkRtRNxRtHoiW7KEUuxq4gVyNrJjtdYZwlfZE+qOC
|
||||
Yo5I6E99zZiVD2SZNe1xuVXYV6mcERDnCw==
|
||||
-----END EC PRIVATE KEY-----
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIBjzCCATWgAwIBAgIQMNAFWqphrzOxuSOWVbSr4jAKBggqhkjOPQQDAjAmMSQw
|
||||
IgYDVQQDExtNeSBMb2NhbCBDQSAtIDIwMjUgRUNDIFJvb3QwHhcNMjUxMjAxMTMx
|
||||
ODUzWhcNMzUxMDEwMTMxODUzWjAmMSQwIgYDVQQDExtNeSBMb2NhbCBDQSAtIDIw
|
||||
MjUgRUNDIFJvb3QwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASD2byYNpauRUOg
|
||||
LggkyrY/ZRMZIQMT+rXlQMctxnV77VOdaXccTC2vfpOS2tqwcwySyP1NYg1DqvD0
|
||||
L4VjUb/To0UwQzAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAd
|
||||
BgNVHQ4EFgQUcK8Rp9IRPvDKIxQ53d5mtDHeXDwwCgYIKoZIzj0EAwIDSAAwRQIh
|
||||
AI4rOGX/GNjlUnwixzcXM1FFrBrarzRZd/6+z99I+1yhAiAqxxK69h4ae0nylgVO
|
||||
pKlmiO5bk38ZfwjN6qAIqMaCcg==
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEICFWtuowkCW/82uhRaJUuisuQFQ3kQc6WH2xopi6aID8oAoGCCqGSM49
|
||||
AwEHoUQDQgAEg9m8mDaWrkVDoC4IJMq2P2UTGSEDE/q15UDHLcZ1e+1TnWl3HEwt
|
||||
r36TktrasHMMksj9TWINQ6rw9C+FY1G/0w==
|
||||
-----END EC PRIVATE KEY-----
|
||||
|
|
@ -9,4 +9,5 @@ galaxy_info:
|
|||
- caddy
|
||||
- tls
|
||||
- localca
|
||||
dependencies: []
|
||||
dependencies:
|
||||
- role: nvjacobo.caddy
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
- name: Ensure Caddy is installed
|
||||
ansible.builtin.package:
|
||||
name: caddy
|
||||
state: present
|
||||
|
||||
- name: Create Caddy configuration directory
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
pki {
|
||||
ca local {
|
||||
name "My Local CA"
|
||||
intermediate_lifetime 365d
|
||||
}
|
||||
}
|
||||
http_port 8080
|
||||
|
|
@ -11,6 +12,6 @@
|
|||
localhost:8443 {
|
||||
acme_server {
|
||||
ca local
|
||||
lifetime 720h
|
||||
lifetime 30d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue