Security
>
TLS/HTTPS

TLS/HTTPS

To use TLS, you need to start Pogocache with TLS-specific program flags.

Example TLS certificate generation

You’ll need:

  • CA certificate: ca.crt
  • Server certificate: pogocache.crt
  • Server private key: pogocache.key
# Generate CA key and cert
openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes \
  -keyout ca.key -out ca.crt -subj "/CN=My Pogocache CA"

# Generate server key and CSR
openssl req -newkey rsa:4096 -nodes -keyout pogocache.key -out pogocache.csr -subj "/CN=localhost"

# Sign server cert with CA
openssl x509 -req -sha256 -days 365 -in pogocache.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out pogocache.crt

Start Pogocache with TLS

pogocache -p 0             \
   --tlsport 9401          \
   --tlscert pogocache.crt \
   --tlskey pogocache.key  \
   --tlscacert ca.crt

The -p 0 disables the plain-text port.

Connect to Pogocache with TLS

Using valkey/redis cli
valkey-cli --tls         \
    --cert pogocache.crt \
    --key pogocache.key  \
    --cacert ca.crt      \
    -h localhost -p 9401
Using curl
curl "https://localhost:9401" \
  --cert pogocache.crt        \
  --key pogocache.key         \
  --cacert ca.crt

Auth password

An optional auth password may be provide to Pogocache through the --auth program flag. When an auth password is being used on the server, that password must be provided with all client request.

pogocache --auth mypass

Now all connection must supply the auth password

valkey-cli -p 9401 -a mypass
# Sending auth with header
curl -H "Authorization: Bearer mypass" "http://localhost:9401/mykey"

# Sending auth with querystring
curl "http://localhost:9401/mykey?auth=mypass"