Valkey : SSL/TLS の設定2026/05/29 |
|
Valkey で SSL/TLS による暗号化通信の設定を有効にします。 |
|
| [1] | 自己署名の証明書を作成します。Let's Encrypt 等の正規の証明書を使用する場合は当作業は不要です。 |
|
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 # 国コード State or Province Name (full name) [Some-State]:Hiroshima # 地域(県) Locality Name (eg, city) []:Hiroshima # 都市 Organization Name (eg, company) [Internet Widgits Pty Ltd]:GTS # 組織名 Organizational Unit Name (eg, section) []:Server World # 組織の部門名 Common Name (e.g. server FQDN or YOUR name) []:dlp.srv.world # サーバーの FQDN Email Address []:root@srv.world # 管理者アドレスroot@dlp:/etc/ssl/private# chmod 600 valkey.pem |
| [2] | Valkey の SSL/TLS の設定です。 |
|
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 # 139行目 : 変更 : [0] 指定でリスン無効化 port 0
# 204行目 : コメント解除 tls-port 6379 # 210,211行目 : コメント解除して証明書を指定 tls-cert-file /etc/valkey/valkey.pem tls-key-file /etc/valkey/valkey.pem
# 255行目 : コメント解除 tls-auth-clients no systemctl restart valkey |
| [3] | クライアントからの接続です。他ホストから接続する場合は、事前に証明書をクライアントへ転送しておく必要があります。 |
|
root@node01:~# ll /etc/valkey total 136 drwxrws--- 2 valkey valkey 4096 May 29 00:33 ./ drwxr-xr-x 111 root root 4096 May 29 00:32 ../ -rw-r----- 1 valkey valkey 125569 Apr 14 14:45 valkey.conf -rw------- 1 valkey valkey 1307 May 29 00:32 valkey.pem # [tls] オプションと証明書を指定して接続する root@node01:~# valkey-cli -h dlp.srv.world --tls \ --cert /etc/valkey/valkey.pem \ --insecure dlp.srv.world:6379> auth password OK dlp.srv.world:6379> info # Server redis_version:7.2.4 server_name:valkey valkey_version:9.0.3 valkey_release_stage:ga redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:ee60e263987ad0f4 server_mode:standalone os:Linux 7.0.0-15-generic x86_64 arch_bits:64 monotonic_clock:POSIX clock_gettime multiplexing_api:epoll gcc_version:15.2.0 process_id:2265 process_supervised:systemd run_id:9c05d2ab52e64ced0091de330b6e713c00ef16a7 tcp_port:6379 server_time_usec:1780014860043702 uptime_in_seconds:386 uptime_in_days:0 hz:10 configured_hz:10 clients_hz:10 ..... ..... |
| Sponsored Link |
|
|