To secure communications using TLS, add the --tls flag. You can provide specific certificate and key paths using --tls-cert and --tls-key. You can also enforce a minimum TLS version (e.g., 1.3) using --tls-min-ver 1.3.
For testing with self-signed certificates, you can generate unsigned keys using openssl:
openssl req -newkey rsa:2048 -nodes -x509 -keyout private_key -out public_key -days 365 -addext "subjectAltName = IP:127.0.0.1,DNS:yourdomain.com"
Client Configuration: When using self-signed certificates, you must distribute the public_key to every restic client and use the --cacert public_key flag in the restic command.