Hoe activeer je TLSV1.3 op Ninx. Vestacp / centos of ubuntu

In deze tutorial leer je hoe activezi TLSv1.3 of NGINX. Wat betekent het TLSv 1.3,, wat helpt het en waarom je hebt nodig op de webserver als TLS kan worden ingeschakeld. Voor servers met beheersysteem VestaCP (CentOS of Ubuntu) is iets moeilijker om TLS 1.3 te activeren dan op een cPanel-server, maar het is niet onmogelijk.

Waarom is TLS 1.3 beter dan TLS 1.2?

TLS (Transport Layer Security) Het is een cryptografisch protocol wat ervoor zorgt verbindingsbeveiliging tussen de computer en een netwerk waarvan deze deel uitmaakt. TLS het wordt gebruikt in toepassingen zoals: e -mail,, boodschapper,, spraak- en video-oproepen ((VoIP), maar vooral bij HTTPS. Zorgen voor veilige communicatie tussen de computer of smartphone van de gebruiker en de webserver van de geopende pagina.

TLS 1.3 biedt een hogere snelheid klant inloggen – server en een Plus beveiliging door een aantal algoritmen te elimineren. Verschillen tussen TLSv1.2 en TLSv1.3.

Over HTTPS,, SSL ((Secure Sockets Layer) Ik zei ook in andere artikelen:

Hoe TLS 1.3 op NGINX in te schakelen. Server met VestaCP / CentOS-beheer

Voordat we kijken hoe u TLSv1.3 op NGINX kunt inschakelen, zijn er enkele minimumvereisten waarmee u rekening moet houden TLS 1.3.

  1. NGINX 1.13.x of hoger
  2. Een geldig TLS-certificaat
  3. Actieve domeinnaam met correct geconfigureerde DNS – toegankelijk zijn op internet
  4. Een geldig TLS/SSL-certificaat. Het kan ook zo zijn Let’s Encrypt.

Op VestaCP dat lang geleden is geïnstalleerd, hebben we alleen het protocol beschikbaar TLS 1.2. Ik heb in veel tutorials gezien dat het voldoende is zoals in nginx.conf voeg de volgende regel toe om TLS 1.3 in te schakelen:

server {

  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  server_name example.com;
  root /var/www/example.com/public;

  ssl_certificate /path/to/your/certificate.crt;
  ssl_certificate_key /path/to/your/private.key;

  ssl_protocols TLSv1.2 TLSv1.3;

Vals. Als op een server CentOS cu-beheer VestaCP,, NGINX is niet gecompileerd met de minimale versie OpenSSL 1.1.1.1,, ssl_protocols TLSv1.2 TLSv1.3; in nginx.conf .. het helpt helemaal niet.

[root@north ~]# nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled

Dus in het bovenstaande voorbeeld is Nginx 1.22.0 compatibel met TLS versie 1.3, maar het helpt onze bibliotheek niet OpenSSL 1.0.2k-fips.

Om TLSv1.3 op Nginx in te schakelen, moet u eerst de onderliggende bibliotheken en ontwikkelingspakketten installeren. Development Tools. Voer in CentOS 7 de opdrachtregels uit:

yum install gcc gcc-c++ pcre-devel zlib-devel make unzip gd-devel perl-ExtUtils-Embed libxslt-devel openssl-devel perl-Test-Simple
yum groupinstall 'Development Tools'

1. Installeer de nieuwste versie OpenSSL

Op dit moment is de nieuwste versie OpenSSL 1.1.1p, maar voor zover ik heb gezien was er al OpenSSL 3. Je kunt de bronnen vinden op OpenSSL.org.

cd /usr/src
wget https://www.openssl.org/source/openssl-1.1.1p.tar.gz
tar xvf openssl-1.1.1p.tar.gz 
mv openssl-1.1.1p openssl
cd openssl
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl --libdir=/lib64 shared zlib-dynamic
make -j4
make test 
make install 

Heel belangrijk om te rennen make test voordat u de bibliotheek installeert. Als de test fouten bevat, voer deze dan niet uit make install totdat de fouten zijn gecorrigeerd.

In de volgende stap maken we een back-up van het huidige binaire bestand openssl en wij voegen toe symlink naar de nieuwe.

mv /usr/bin/openssl /usr/bin/openssl-backup
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

In /usr/local/openssl/bin uitvoeren ldd om openssl-afhankelijkheden te controleren. Eventueel kunnen we ook de versie van openssl controleren. Commando openssl version.

[root@north bin]# ldd openssl
	linux-vdso.so.1 =>  (0x00007ffd20bd7000)
	libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007fab09b62000)
	libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007fab09675000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fab09471000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fab09255000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fab08e87000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fab09df5000)
[root@north bin]# openssl version
OpenSSL 1.1.1p  21 Jun 2022

Momenteel hebben wij de nieuwste versie geïnstalleerd OpenSSL wat verdraagt TLSv1.3. Wij kunnen de versies controleren TLS / SSL ondersteund door boekhandels OpenSSL op bestelling:

[root@north bin]# openssl ciphers -v | awk '{print $2}' | sort | uniq
SSLv3
TLSv1
TLSv1.2
TLSv1.3
[root@north bin]# 

Dit betekent niet dat websites worden gehost met behulp van de beheerder VestaCP ze zullen het onmiddellijk hebben TLS 1.3.

Hoewel we hebben geïnstalleerd OpenSSL 1.1.1p, Nginx is gecompileerd met de oude versie OpenSSL 1.0.2k-fips.

[root@north bin]# nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
[root@north bin]# openssl version
OpenSSL 1.1.1p  21 Jun 2022
[root@north bin]# 

2. Compileer Nginx opnieuw voor het systeem VestaCP

In deze stap moeten we opnieuw compileren OpenSSL versie van Nginx al geïnstalleerd op het systeem CentOS / VestaCP. Zoals ik hierboven al zei, in mijn geval gaat het om nginx/1.22.0. Omdat we het hebben over een webserver die dat wel heeft VestaCP beheersysteem, voordat we beginnen met het opnieuw compileren is het goed om een ​​back-up te maken van de nginx-configuratiebestanden.

Maak een back-up van Nginx-stroom op het systeem VestaCP

Archiveer en bewaar de mappen ergens op de server “/etc/nginx” En “/usr/local/vesta/nginx“.

LOOP nginx -V en sla bestaande modules op in een bestand.

configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
Hoe TLSv1.3 op NGINX in te schakelen
Cum van zijn TLSv1.3-pagina NGINX

Hoe Nginx opnieuw te compileren voor OpenSSL / CentOS 7-upgrage

Ik herhaal. Als je dat hebt VestaCP, download de versie van Nginx die u al hebt geïnstalleerd. Je kunt alle archieven met Nginx-versies vinden op nginx.org.

cd /usr/src
wget https://nginx.org/download/nginx-1.22.0.tar.gz 
tar xvf nginx-1.22.0.tar.gz
cd nginx-1.22.0

We compileren de nginx-modules opnieuw:

./configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \ 
--modules-path=/usr/lib64/nginx/modules \ 
--conf-path=/etc/nginx/nginx.conf \ 
--error-log-path=/var/log/nginx/error.log  \
--http-log-path=/var/log/nginx/access.log  \
--pid-path=/var/run/nginx.pid  \
--lock-path=/var/run/nginx.lock  \
--http-client-body-temp-path=/var/cache/nginx/client_temp  \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp  \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp  \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp  \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp  \
--user=nginx  \
--group=nginx  \
--with-compat  \
--with-file-aio  \
--with-threads  \
--with-http_addition_module  \
--with-http_auth_request_module  \
--with-http_dav_module  \
--with-http_flv_module  \
--with-http_gunzip_module  \
--with-http_gzip_static_module  \
--with-http_mp4_module  \
--with-http_random_index_module  \
--with-http_realip_module  \
--with-http_secure_link_module  \
--with-http_slice_module  \
--with-http_ssl_module  \
--with-http_stub_status_module  \
--with-http_sub_module  \
--with-http_v2_module  \
--with-mail  \
--with-mail_ssl_module  \
--with-stream  \
--with-stream_realip_module  \
--with-stream_ssl_module  \
--with-stream_ssl_preread_module  \
--with-openssl=/usr/src/openssl  \
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong  \
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC'  \
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
make -j4
make install

We hebben nu Nginx geïnstalleerd en gecompileerd met de nieuwste versie van OpenSSL ondersteunt TLSv1.3.

[root@north bin]# nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.1.1p  21 Jun 2022
TLS SNI support enabled

*als nginx al op de server is geïnstalleerd, moet u deze verwijderen. Compileren werkt niet bij nginx-upgrade.

TLSv1.3 inschakelen voor domeinen op VestaCP

In het bestand /etc/nginx/nginx.conf we voegen de volgende regels toe:

ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';

Op domeinniveau heb ik iets veranderd in de templates VestaCP en om HTTP/2 in te schakelen. Dus wanneer ik een nieuw domein (example.com) toevoeg met Let's Encrypt ingeschakeld, heb ik het volgende configuratiebestand voor SSL:

cat /home/vestacpuser/conf/web/example.com.nginx.ssl.conf 

server {
    listen      IP.IP.IP.IP:443 ssl http2;
    server_name example.com www.example.com;
    root        /home/vestacpuser/web/example.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/example.com.log combined;
    access_log  /var/log/nginx/domains/example.com.bytes bytes;
    error_log   /var/log/nginx/domains/example.com.error.log error;

    ssl_certificate      /home/vestacpuser/conf/web/ssl.example.com.pem;
    ssl_certificate_key  /home/vestacpuser/conf/web/ssl.example.com.key;

....

ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';

Voordat u nginx opnieuw opstart, is het goed om eerst de configuratie ervan te testen.

[root@north web]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@north web]# systemctl restart nginx

Ik hoop dat je deze tutorial nuttig vindt en als je ergens mee vastzit, laat dan de probleemdetails achter in de reacties.

Gepassioneerd over technologie schrijf ik met plezier op StealthSetts.com beginnend met 2006. Ik heb een rijke ervaring in besturingssystemen: macOS, Windows en Linux, maar ook in programmeertalen en blogplatforms (WordPress) en voor online winkels (WooCommerce, Magento, Presashop).

Home Uw bron van IT -tutorials, nuttige tips en nieuws. Hoe activeer je TLSV1.3 op Ninx. Vestacp / centos of ubuntu
Laat een reactie achter