Hamish Burke | 2025-06-30


TLS/SSL Certificates

When a client wants to access a server, the server will present their digital certificate to prove it authentic and the desired destination.

Pasted image 20250628173517.png

Contains

Handshake process

  1. ClientHello: Client initiates connections: Gives CipherSuite and other details
  2. ServerHello: Selects encryption method, and sends TLS certificate to client
  3. Key Exchange: Client encrypts PMS with servers public key
  4. Both client and server use the PMS to generate a session key, which is used for symmetrically encrypting/decrypting data during the session

Creating a TLS Certificate

Using OpenSSL

Making a selfsigned certificate to as CA

Make servers privates key and CSR (certificate signing request)

Sign the server certificate request

Verify a certificate

https://github.com/acmesh-official/acme.sh

When installing, it adds acme.sh to path, then adds a crontab to run acme.sh everyday

cat /var/spool/cron/burkehami    
28 9 * * * "/home/burkehami/.acme.sh"/acme.sh --cron --home "/home/burkehami/.acme.sh" > /dev/null  

On windows can created a scheduled task in Task Scheduler:

schtasks /create /tn "acme-renew" /tr "\"C:\Program Files\Git\bin\bash.exe\" -c '~/.acme.sh/acme.sh --cron'" /sc daily /st 09:00

ACME.sh options

 --csr <file> Specifies the input csr.
 
 --notify-level <0|1|2|3> Set the notification level:  Default value is 2.  
   0: disabled, no notification will be sent.  
   1: send notifications only when there is an error.  
   2: send notifications when a cert is successfully renewed, or there is an
   error.

--openssl-bin <file>  Specifies a custom openssl bin location.

-se, --stop-renew-on-error 
Only valid for '--renew-all' command. Stop if one cert has error in renewal.

--days <ndays>   
Specifies the days to renew the cert when using '--issue' command. The default value is 60 days.

--reloadcmd <command>             
Command to execute after issue/renew to reload the server.

--register-account       Register account key. (if wanting to use smth like digicert with this)

--force (will force rotation of keys)

--install-cert -d <domain> \
	--key-file /etc/ssl/private/domain.priv.key \
	--fullchain-file /etc/ssl/certs/domain.cert \ (this is all public certs up to root)
	--reloadcmd "systemctl reload nginx"
This will save all specifies paths, and will rerun this every time certs are renewed (even with crontab). Saves paths to ~/.acme.sh/domain/domain.conf