|
|
6 months ago | |
|---|---|---|
| .gitignore | 2 years ago | |
| LICENSE | 4 years ago | |
| README.md | 8 months ago | |
| actions.go | 6 months ago | |
| amqp.go | 6 months ago | |
| api.go | 6 months ago | |
| go.mod | 10 months ago | |
| go.sum | 10 months ago | |
| leapi.service | 2 years ago | |
| leapi_config.json.sample | 6 months ago | |
| main.go | 6 months ago | |
| sync.go | 6 months ago | |
| util.go | 6 months ago | |
LEAPI is a clustered server API system, written in Go, for managing Lets Encrypt certificate renewals.
LEAPI uses the excellent getssl Bash script for the actual renewal of certificates.
It can be used on a single server, but is particularly useful for clusters of servers, with many domains. You can use it standalone, for acquiring/renewing certificates for non web services, or with an external webserver like Nginx, Caddy, etc.
LEAPI operates in a multi-master configuration. When you add or delete a server or domain on any server, it automatically replicates the changes to all other servers, and renews your certificate. Replication is accomplished via HTTP.
[GET] https://leapiserver.tld/api/servers --- List Servers
[PUT] https://leapiserver.tld/api/servers/web1.mybackend.com --- Add New Server
[DELETE] https://leapiserver.tld/api/servers/web1.mybackend.com --- Remove Server
[GET] https://leapiserver.tld/api/domains --- List Domains
[PUT] https://leapiserver.tld/api/domains/mycoolsite.com --- Add New Domain
[PUT] https://leapiserver.tld/api/domains/%2A.example.com {"domain":"mycoolsite} --- Add New Domain (wildcard--urlencoded)
[PUT] https://leapiserver.tld/api/domains {"domain":"*.example.com"} --- Add New Domain (wildcard domain in request body)
[PUT] https://leapiserver.tld/api/domains {"domain":"*.example.com", "check_domain":"web1.example.com"} --- Add New Domain (wildcard domain in request body, with domain to use for checking if cert was installed [otherwise api.example.com will be used for check])
[DELETE] https://leapiserver.tld/api/domains/mycoolsite.com --- Remove Domain
[POST] https://leapiserver.tld/api/renew --- Force Renewal
[GET] https://leapiserver.tld/up --- Uptime Check
/opt/leapileapi_config.json file for your needs, leaving production set to false until setup is complete. Set the sync_type to either ssh or https. If you choose ssh you must create and copy keys and verify you can login to all servers that need to share files between each other. Note: if you enable https_server_port in the config file, LEAPI needs a certificate to be able to start (it requires the tls_chain_path_prefix and tls_key_path_prefix). You can generate a temporary self signed certificate and key with OpenSSL:openssl req -x509 -nodes -newkey rsa:4096 -keyout privkey.key -out cert.crt -sha256 -days 365
cp cert.crt {tls_chain_path_prefix}00.crt # example: 'cp cert.crt /etc/ssl/leapi/chain00.crt'
cp privkey.key {tls_key_path_prefix}00.key
/opt/leapi or /etc.curl --silent https://raw.githubusercontent.com/srvrco/getssl/latest/getssl > /opt/leapi/getssl ; chmod 700 /opt/leapi/getssl
/opt/leapi/getssl -w /opt/leapi -c mycoolsite.com
systemctl start leapicurl -X PUT http://localhost/api/servers/server1.mydomain.com -H 'Authorization: Bearer mySeCrEtKeY'
curl -X PUT http://localhost/api/servers/server2.mydomain.com -H 'Authorization: Bearer mySeCrEtKeY'
curl -X PUT http://localhost/api/servers/server3.mydomain.com -H 'Authorization: Bearer mySeCrEtKeY'
curl -X PUT http://localhost/api/domains/mycoolsite.com -H 'Authorization: Bearer mySeCrEtKeY'
curl -X PUT http://localhost/api/domains/myothersite.com -H 'Authorization: Bearer mySeCrEtKeY'
leapi_config.json file and change production to true.curl -X POST http://localhost/api/renew -H 'Authorization: Bearer mySeCrEtKeY'
cd leapi
go build
mkdir -p /opt/leapi
cp ./leapi /opt/leapi
cp ./leapi.service /etc/systemd/system/
cp ./leapi_config.json.sample /opt/leapi/leapi_config.json
systemctl daemon-reload
systemctl enable leapi
systemctl start leapi