The user interface URI and the agent contact URI must be different. However, they can point to the same IP address.
To bind an SSL certificate to a UI URI:
Get an SSL certificate. This can be done in various ways.
Note
Please note that when generating keys (for example using certificate authority windows), extra entries may appear, which will lead to errors in nginx operation. General type of certificates:
* для сертификата.key: -----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY----- * для сертификата .crt: -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----
Place the private key and certificate on the server in the /var/lib/ibatyr/CA folder.
Create a copy of the configuration file /etc/nginx/sites-available/ssl.ibatyr
cp /etc/nginx/sites-available/ssl.ibatyr /etc/nginx/sites-available/ssl.ibatyrui
Edit the configuration file:
sudo nano /etc/nginx/sites-available/ssl.ibatyrChange the following fields to the specified form:
Field
Meaning
location
^/agent/$
server_name
Agent interface URI.
Multiple DNS records can be specified here.
Edit the created configuration file:
sudo nano /etc/nginx/sites-available/ssl.ibatyruiChange the following fields to the specified form:
Field
Meaning
server_name
User Interface URI.
Multiple DNS records can be specified here.ssl_certificate
Path to the ssl certificate for the UI.
ssl_certificate_key
Path to the private key of the SSL certificate for the UI.
ssl_client_certificate
Delete or comment out the line (put a # at the beginning).
ssl_verify_depth
1
ssl_verify_client
off
Note
To keep separate logs for the UI and the agent, specify the paths to the UI logs in the access_log and error_log fields.
Create a symbolic link to the new configuration file:
ln -s /etc/nginx/sites-available/ssl.ibatyrui /etc/nginx/sites-enabled
Check that the new nginx configuration is correct:
sudo nginx -t
Apply the new configuration:
systemctl reload nginx
Single configuration file
For ease of use, new settings can be added to an existing configuration file.
To do this:
Open the configuration file:
sudo nano /etc/nginx/sites-available/ssl.ibatyr
Bring it to this form:
client_max_body_size 10G; large_client_header_buffers 16 65536; server { server_name ui.iBatyr Monitor.local; listen 443 ssl http2; listen [::]:443 ssl http2; ssl on; ssl_certificate /var/lib/ibatyr/CA/server_UI.crt; ssl_certificate_key /var/lib/ibatyr/CA/server_UI.key; ssl_client_certificate /var/lib/ibatyr/CA/client_UI.crt; ssl_verify_depth 1; ssl_verify_client off; access_log /var/log/ibatyr/https.access.log; error_log /var/log/ibatyr/https.error.log; client_body_timeout 3600s; client_header_timeout 3600s; location / { include /etc/nginx/uwsgi_params_ibatyr; uwsgi_pass unix:/var/lib/ibatyr/ui_wsgi.sock; } include /etc/nginx/ibatyr_*; } server { server_name agent.iBatyr Monitor.local; listen 443 ssl http2; listen [::]:443 ssl http2; ssl on; ssl_certificate /var/lib/ibatyr/CA/server.crt; ssl_certificate_key /var/lib/ibatyr/CA/server.key; ssl_client_certificate /var/lib/ibatyr/CA/client.crt; ssl_verify_depth 2; ssl_verify_client optional; ssl_session_timeout 1d; ssl_session_tickets off; ssl_stapling on; ssl_protocols TLSv1.3 TLSv1.2; ssl_ecdh_curve secp384r1; ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384; access_log /var/log/ibatyr/https.access.log; error_log /var/log/ibatyr/https.error.log; client_body_timeout 3600s; client_header_timeout 3600s; location ~^/agent/$ { include /etc/nginx/uwsgi_params_ibatyr; uwsgi_pass unix:/var/lib/ibatyr/ui_wsgi.sock; } include /etc/nginx/ibatyr_*; }
Check that the new nginx configuration is correct:
sudo nginx -t
Apply the new configuration:
systemctl reload nginx