acmesh-install-deploy/README.md

58 lines
2.6 KiB
Markdown
Raw Normal View History

2024-09-13 14:57:34 +02:00
# Install acme.sh with CF and multidomain
## Purpose
This role install the [acme.sh](https://acme.sh) project on a Linux server and sets up domain(s) with DNS challenge with Cloudflare.
2024-09-13 14:57:34 +02:00
## Variables
All variables are in the defaults folder, however the most importants are:
All domains are in the list, so the list can contains multiple domain configs. In the example we set only one cert with wildcard domain.
- Domains is a list in list format. You can set root domain and wildcard domain. However it is important that the first element used in the filenames, so avoid to use wildcard in the first position!
- Hooks: Refer acme.sh help or documentation, these are runs in the different stages of issue and renew. Everytime scripts runs in the domain directory so you can use relative command to copy the cert as source.
- acme_sh_issue_env_vars: Following the acme.sh documentation you need to optain three data (two API keys and a zone ID) from Cloudflare and need to set them here.
And again, you need to set these vars for every single cert issue (that can contain multiple subdoms, see CA for more info and limitations).
Most important of global variables are
- acme_sh_email: The e-mail address at acme.sh installation
- acme_sh_user_groups: Add acme user to groups. In this example add to docker so can manage containers and certs related to them.
```
acme_sh_domains:
- domains:
- "yourdomain.com" # it is the root domain
- "*.yourdomain.com" # get wildcard
pre_hook:
post_hook: |
#!/bin/sh
echo "OK" > ~/domtest.txt
echo "$PWD" >> ~/domtest.txt
renew_hook: |
#!/bin/sh
echo "OK" > ~/domtest.txt
echo "$PWD" >> ~/domtest.txt
acme_sh_issue_env_vars:
CF_Token: ""
CF_Zone_ID: ""
CF_Account_ID: ""
acme_sh_user_groups: ["docker"]
acme_sh_email: ""
```
## Paths
You can look for every variables in the defaults folder and can set up the user, additional groups (e.g. if you want to use this with Docker), paths. It is important that every cert got an own folder and all of files stored here.
Hooks are different shell scripts to make easier to manage or modify them later.
It is a good practice to create new user with the role for acme.sh. You can add it to Docker group or give limited sudo privileges (see sudoers.d) so a possible attack can make harder to impact your server negative.
2024-09-13 14:57:34 +02:00
## todo
- Avoid resetting the default CA on every run
- List commands if needed to give limited sudo privileges for acme user. List commands in an array that can run by acme.
- Set up notification system of acme.sh
- Reconnect after adding acme to groups to avoid possible access denied problems