All Products
Search
Document Center

Container Service for Kubernetes:Konfigurasikan enkripsi TLS untuk NGINX Ingress Controller

Last Updated:Jun 24, 2026

Untuk beban kerja dengan persyaratan keamanan in-transit yang ketat, konfigurasikan dan verifikasi versi protokol TLS serta paket sandi (cipher suites) pada NGINX Ingress Controller.

Prasyarat

Pastikan hal berikut:

Pengaturan enkripsi TLS

Konfigurasikan versi protokol TLS dan paket sandi menggunakan bidang ssl-protocols dan ssl-ciphers dalam ConfigMap nginx-configuration di namespace kube-system.

Field Description Default value
ssl-protocols Versi protokol TLS yang diterima oleh ingress. Secara default TLS 1.2 dan TLS 1.3. Lihat ssl-protocols. TLSv1.2 TLSv1.3
ssl-ciphers Paket sandi yang diterima oleh ingress, dalam format OpenSSL. Paket sandi default mendukung berbagai klien TLS. Untuk menggunakan paket yang lebih restriktif, atur ssl-ciphers dalam ConfigMap untuk mengganti nilai default. Urutan menentukan prioritas algoritma — nilai default memprioritaskan paket yang mendukung PFS. Lihat ssl-ciphers. ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
Urutan paket sandi menentukan prioritas algoritma. Nilai default memprioritaskan paket yang mendukung PFS — pertahankan kecuali Anda memiliki persyaratan keamanan khusus.

Setelah menerapkan konfigurasi, verifikasi dengan testssl.sh atau SSL Labs.

Perbarui ConfigMap

Konsol

  1. Masuk ke Container Service Management Console. Di panel navigasi kiri, klik Clusters.

  2. Di halaman Clusters, klik nama kluster Anda. Di panel navigasi kiri, pilih Configurations > ConfigMaps.

  3. Di halaman ConfigMap, pilih kube-system dari menu drop-down Namespace. Cari nginx-configuration di kotak pencarian Name. Temukan nginx-configuration lalu klik Edit di kolom Actions.

  4. Di halaman Edit, klik +Add. Masukkan Name dan Value, lalu klik OK.

kubectl

Buka ConfigMap di editor Anda:

kubectl edit cm -n kube-system nginx-configuration

Tambahkan atau perbarui bidang ssl-protocols dan ssl-ciphers:

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-configuration
  namespace: kube-system
data:
  ssl-protocols: "TLSv1.2 TLSv1.3"  # Hanya TLS 1.2 dan TLS 1.3 yang diizinkan.
  ssl-ciphers: "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384"  # Daftar paket sandi default.

Verifikasi versi TLS dan paket sandi

Konfirmasi konfigurasi TLS dengan salah satu metode berikut.

  • Metode 1: Unduh testssl.sh dan jalankan:

    ./testssl.sh <site-domain-name>

    Paket sandi lemah atau versi TLS yang sudah usang akan ditandai merah. Contoh output yang diharapkan untuk ingress yang dikonfigurasi dengan benar:

     Testing protocols via sockets except NPN+ALPN
     SSLv2      not offered (OK)
     SSLv3      not offered (OK)
     TLS 1      not offered
     TLS 1.1    not offered
     TLS 1.2    offered (OK)
     TLS 1.3    offered (OK): final
     NPN/SPDY   not offered
     ALPN/HTTP2 h2, http/1.1 (offered)
     Testing cipher categories
     NULL ciphers (no encryption)                  not offered (OK)
     Anonymous NULL Ciphers (no authentication)    not offered (OK)
     Export ciphers (w/o ADH+NULL)                 not offered (OK)
     LOW: 64 Bit + DES, RC[2,4] (w/o export)       not offered (OK)
     Triple DES Ciphers / IDEA                     not offered
     Obsolete CBC ciphers (AES, ARIA etc.)         not offered
     Strong encryption (AEAD ciphers)              offered (OK)
     Testing robust (perfect) forward secrecy, (P)FS -- omitting Null Authentication/Encryption, 3DES, RC4
     PFS is offered (OK)          TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-CHACHA20-POLY1305
                                  TLS_AES_128_GCM_SHA256 ECDHE-RSA-AES128-GCM-SHA256
     Elliptic curves offered:     prime256v1 secp384r1 secp521r1 X25519 X448
     Finite field group:          ffdhe2048 ffdhe3072 ffdhe4096 ffdhe6144 ffdhe8192
     Testing server preferences
     Has server cipher order?     yes (OK) -- TLS 1.3 and below
     Negotiated protocol          TLSv1.3
     Negotiated cipher            TLS_AES_256_GCM_SHA384, 253 bit ECDH (X25519)
     Cipher order
        TLSv1.2:   ECDHE-RSA-AES128-GCM-SHA256 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-CHACHA20-POLY1305
        TLSv1.3:   TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 TLS_AES_128_GCM_SHA256
    ...
  • Metode 2: Masukkan domain Anda di SSL Labs SSL Server Test.

Lihat paket sandi yang dikonfigurasi

Lihat paket sandi aktif dalam konfigurasi NGINX:

kubectl -n kube-system exec deploy/nginx-ingress-controller -- nginx -T | grep ssl_ciphers

Output yang diharapkan:

Defaulted container "nginx-ingress-controller" out of: nginx-ingress-controller, init-sysctl (init)
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
        ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
nginx: configuration file /etc/nginx/nginx.conf test is successful

FAQ

Apakah Nginx Ingress Controller mendukung algoritma kriptografi Tiongkok?

Tidak. NGINX Ingress Controller ACK didasarkan pada proyek ingress-nginx komunitas Kubernetes dan saat ini tidak mendukung algoritma kriptografi Tiongkok.

Paket sandi apa saja yang didukung oleh Nginx Ingress?

NGINX menggunakan OpenSSL untuk enkripsi. Untuk melihat daftar paket sandi yang tersedia, masuk ke pod controller:

kubectl exec -it -n kube-system <nginx-ingress-pod-name> bash

Di dalam kontainer, jalankan nginx -V untuk memeriksa versi NGINX dan OpenSSL:

nginx-ingress-controller-5c455d7d9f-nr7dd:/etc/nginx$ nginx -V

Output yang diharapkan:

nginx version: nginx/1.21.6
built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r10)
built with OpenSSL 3.1.3 19 Sep 2023 (running with OpenSSL 3.1.5 30 Jan 2024)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --modules-path=/etc/nginx/modules --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-compat --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_geoip_module --with-http_gzip_static_module --with-http_sub_module --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_realip_module --with-stream_ssl_preread_module --with-threads --with-http_secure_link_module --with-http_gunzip_module --with-file-aio --without-mail_pop3_module --without-mail_smtp_module --without-mail_imap_module --without-http_uwsgi_module --without-http_scgi_module --with-cc-opt='-g -O3 -flto -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wno-deprecated-declarations -fno-strict-aliasing -D_FORTIFY_SOURCE=2 --param=ssp-buffer-size=4 -DTCP_FASTOPEN=23 -fPIC -I/root/.hunter/_Base/d45d77d/aab92d8/3b7ee27/Install/include -Wno-cast-function-type -m64 -mtune=generic' --with-ld-opt='-flto -fPIE -fPIC -pie -Wl,-z,relro -Wl,-z,now -L/root/.hunter/_Base/d45d77d/aab92d8/3b7ee27/Install/lib' --user=www-data --group=www-data --add-module=/tmp/build/ngx_devel_kit-0.3.2 --add-module=/tmp/build/set-misc-nginx-module-0.33 --add-module=/tmp/build/headers-more-nginx-module-0.34 --add-module=/tmp/build/ngx_http_substitutions_filter_module-b8a71eacc7f986ba091282ab8b1bbbc6ae1807e0 --add-module=/tmp/build/lua-nginx-module-0.10.25 --add-module=/tmp/build/stream-lua-nginx-module-0.0.13 --add-module=/tmp/build/lua-upstream-nginx-module-8aa93ead98ba2060d4efd594ae33a35d153589bf --add-dynamic-module=/tmp/build/nginx-http-auth-digest-1.0.0 --add-dynamic-module=/tmp/build/nginx-opentracing-0.19.0/opentracing --add-dynamic-module=/tmp/build/ModSecurity-nginx-1.0.3 --add-dynamic-module=/tmp/build/ngx_http_geoip2_module-a26c6beed77e81553686852dceb6c7fdacc5970d --add-dynamic-module=/tmp/build/ngx_brotli

Jalankan openssl ciphers untuk melihat semua paket sandi yang didukung:

nginx-ingress-controller-5c455d7d9f-nr7dd:/etc/nginx$ openssl ciphers

Output yang diharapkan:

TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:RSA-PSK-AES256-GCM-SHA384:DHE-PSK-AES256-GCM-SHA384:RSA-PSK-CHACHA20-POLY1305:DHE-PSK-CHACHA20-POLY1305:ECDHE-PSK-CHACHA20-POLY1305:AES256-GCM-SHA384:PSK-AES256-GCM-SHA384:PSK-CHACHA20-POLY1305:RSA-PSK-AES128-GCM-SHA256:DHE-PSK-AES128-GCM-SHA256:AES128-GCM-SHA256:PSK-AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:ECDHE-PSK-AES256-CBC-SHA384:ECDHE-PSK-AES256-CBC-SHA:SRP-RSA-AES-256-CBC-SHA:SRP-AES-256-CBC-SHA:RSA-PSK-AES256-CBC-SHA384:DHE-PSK-AES256-CBC-SHA384:RSA-PSK-AES256-CBC-SHA:DHE-PSK-AES256-CBC-SHA:AES256-SHA:PSK-AES256-CBC-SHA384:PSK-AES256-CBC-SHA:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-CBC-SHA:SRP-RSA-AES-128-CBC-SHA:SRP-AES-128-CBC-SHA:RSA-PSK-AES128-CBC-SHA256:DHE-PSK-AES128-CBC-SHA256:RSA-PSK-AES128-CBC-SHA:DHE-PSK-AES128-CBC-SHA:AES128-SHA:PSK-AES128-CBC-SHA256:PSK-AES128-CBC-SHA

Jalankan openssl ciphers -tls1_2 -v untuk melihat paket sandi TLS 1.2:

nginx-ingress-controller-5c455d7d9f-nr7dd:/etc/nginx$ openssl ciphers -tls1_2 -v

Output yang diharapkan:

TLS_AES_256_GCM_SHA384         TLSv1.3 Kx=any      Au=any   Enc=AESGCM(256)            Mac=AEAD
TLS_CHACHA20_POLY1305_SHA256   TLSv1.3 Kx=any      Au=any   Enc=CHACHA20/POLY1305(256) Mac=AEAD
TLS_AES_128_GCM_SHA256         TLSv1.3 Kx=any      Au=any   Enc=AESGCM(128)            Mac=AEAD
ECDHE-ECDSA-AES256-GCM-SHA384  TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AESGCM(256)            Mac=AEAD
ECDHE-RSA-AES256-GCM-SHA384    TLSv1.2 Kx=ECDH     Au=RSA   Enc=AESGCM(256)            Mac=AEAD
DHE-RSA-AES256-GCM-SHA384      TLSv1.2 Kx=DH       Au=RSA   Enc=AESGCM(256)            Mac=AEAD
ECDHE-ECDSA-CHACHA20-POLY1305  TLSv1.2 Kx=ECDH     Au=ECDSA Enc=CHACHA20/POLY1305(256) Mac=AEAD
ECDHE-RSA-CHACHA20-POLY1305    TLSv1.2 Kx=ECDH     Au=RSA   Enc=CHACHA20/POLY1305(256) Mac=AEAD
...

Bagaimana cara mendapatkan nama OpenSSL untuk nama paket sandi IANA/RFC?

Paket sandi memiliki dua konvensi penamaan: OpenSSL (misalnya, AES128-SHA) dan IANA/RFC (misalnya, TLS_RSA_WITH_AES_128_CBC_SHA).

Untuk mengonversi nama IANA ke padanan OpenSSL-nya, gunakan salah satu metode berikut:

  • Cari pemetaannya di Tabel pemetaan nama paket sandi OpenSSL–IANA.

  • Jalankan openssl ciphers -convert <IANA-cipher-suite-name> di dalam kontainer controller. Contohnya:

    nginx-ingress-controller-5c455d7d9f-nr7dd:/etc/nginx$ openssl ciphers -convert TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
    OpenSSL cipher name: ECDHE-RSA-AES128-GCM-SHA256