Skip to content

Commit 3091c21

Browse files
jbowringjc21
authored andcommitted
Add SSL certificate to TCP streams if certificate in database
1 parent 498109a commit 3091c21

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

backend/templates/_certificates.conf

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{% if certificate.provider == "letsencrypt" %}
33
# Let's Encrypt SSL
44
include conf.d/include/letsencrypt-acme-challenge.conf;
5+
include conf.d/include/ssl-cache.conf;
56
include conf.d/include/ssl-ciphers.conf;
67
ssl_certificate /etc/letsencrypt/live/npm-{{ certificate_id }}/fullchain.pem;
78
ssl_certificate_key /etc/letsencrypt/live/npm-{{ certificate_id }}/privkey.pem;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% if certificate and certificate_id > 0 -%}
2+
{% if certificate.provider == "letsencrypt" %}
3+
# Let's Encrypt SSL
4+
include conf.d/include/ssl-cache-stream.conf;
5+
include conf.d/include/ssl-ciphers.conf;
6+
ssl_certificate /etc/letsencrypt/live/npm-{{ certificate_id }}/fullchain.pem;
7+
ssl_certificate_key /etc/letsencrypt/live/npm-{{ certificate_id }}/privkey.pem;
8+
{% else %}
9+
# Custom SSL
10+
ssl_certificate /data/custom_ssl/npm-{{ certificate_id }}/fullchain.pem;
11+
ssl_certificate_key /data/custom_ssl/npm-{{ certificate_id }}/privkey.pem;
12+
{% endif %}
13+
{% endif %}

backend/templates/stream.conf

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
{% if enabled %}
66
{% if tcp_forwarding == 1 or tcp_forwarding == true -%}
77
server {
8-
listen {{ incoming_port }};
8+
listen {{ incoming_port }}{% if certificate %} ssl{% endif %};
99
{% if ipv6 -%}
10-
listen [::]:{{ incoming_port }};
10+
listen [::]:{{ incoming_port }}{% if certificate %} ssl{% endif %};
1111
{% else -%}
12-
#listen [::]:{{ incoming_port }};
12+
#listen [::]:{{ incoming_port }}{% if certificate %} ssl{% endif %};
1313
{% endif %}
1414

15+
{% include "_certificates_stream.conf" %}
16+
1517
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
1618

1719
# Custom
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ssl_session_timeout 5m;
2+
ssl_session_cache shared:SSL_stream:50m;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ssl_session_timeout 5m;
2+
ssl_session_cache shared:SSL:50m;

docker/rootfs/etc/nginx/conf.d/include/ssl-ciphers.conf

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
ssl_session_timeout 5m;
2-
ssl_session_cache shared:SSL:50m;
3-
41
# intermediate configuration. tweak to your needs.
52
ssl_protocols TLSv1.2 TLSv1.3;
63
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';

0 commit comments

Comments
 (0)