Valkey : SSL/TLS Setting2025/09/17 |
|
Configure SSL/TLS Setting on Valkey. |
|
| [1] | Create self-signed certificate. If you use valid certificate like Let's Encrypt or others, skip this section. |
|
root@dlp:~# cd /etc/ssl/private root@dlp:/etc/ssl/private# openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp384r1) -keyout valkey.pem -out valkey.pem -days 3650 Generating a RSA private key .................+++++ ........+++++ writing new private key to 'vsftpd.pem' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:JP # country code State or Province Name (full name) [Some-State]:Hiroshima # State Locality Name (eg, city) []:Hiroshima # city Organization Name (eg, company) [Internet Widgits Pty Ltd]:GTS # company Organizational Unit Name (eg, section) []:Server World # department Common Name (e.g. server FQDN or YOUR name) []:dlp.srv.world # server's FQDN Email Address []:root@srv.world # admin's emailroot@dlp:/etc/ssl/private# chmod 600 valkey.pem |
| [2] | Configure Valkey. |
|
root@dlp:~#
cp /etc/ssl/private/valkey.pem /etc/valkey/ root@dlp:~# chown valkey:valkey /etc/valkey/valkey.pem root@dlp:~# vi /etc/valkey/valkey.conf # line 139 : change : disable it with [0] port 0
# line 194 : uncomment tls-port 6379 # line 200, 201 : uncomment and specify certificate tls-cert-file /etc/valkey/valkey.pem tls-key-file /etc/valkey/valkey.pem
# line 245 : uncomment tls-auth-clients no systemctl restart valkey |
| [3] | Connect to Valkey with SSL/TLS from clients. If connect from other Hosts, it needs to transfer certificate to them. |
|
root@node01:~# ll /etc/valkey total 124 -rw-r----- 1 valkey valkey 120011 Jul 9 17:53 valkey.conf -rw------- 1 valkey valkey 1307 Sep 17 08:56 valkey.pem # specify [tls] option and certificate root@node01:~# valkey-cli -h dlp.srv.world --tls \ --cert /etc/valkey/valkey.pem \ --key /etc/valkey/valkey.pem \ --cacert /etc/valkey/valkey.pem dlp.srv.world:6379> auth password OK dlp.srv.world:6379> info # Server redis_version:7.2.4 server_name:valkey valkey_version:8.1.1 valkey_release_stage:ga redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:fa41aec701bdce55 server_mode:standalone os:Linux 6.12.43+deb13-amd64 x86_64 arch_bits:64 monotonic_clock:POSIX clock_gettime multiplexing_api:epoll gcc_version:14.2.0 process_id:1013 process_supervised:systemd run_id:d7455520fba51176b06188af4677dc2438f3cf41 tcp_port:6379 server_time_usec:1758067052746027 uptime_in_seconds:94 uptime_in_days:0 hz:10 configured_hz:10 clients_hz:10 lru_clock:13236588 executable:/usr/bin/valkey-server config_file:/etc/valkey/valkey.conf io_threads_active:0 availability_zone: listener2:name=tls,bind=0.0.0.0,bind=-::1,port=6379 ..... ..... |
| Sponsored Link |