Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SNI filtering #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions data/nginx-terminate/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,23 @@ http {
}

stream {

map $ssl_preread_server_name $proxy {
DOMAIN_NAME_HERE real;
default deny;
}
upstream relay {
server nginx-relay:4433;
}

upstream real {
server 127.0.0.1:8443;
}
upstream deny {
server 127.0.0.1:9443;
}

server {
listen 443 ssl;
listen 8443 ssl;
proxy_pass relay;

access_log off;
error_log /dev/null;

Expand All @@ -37,5 +45,12 @@ stream {
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
listen 443 ;
proxy_pass $proxy;
access_log off;
error_log /dev/null;
ssl_preread on;
}

}
2 changes: 2 additions & 0 deletions init-certificate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if ! [ -x "$(command -v docker-compose)" ]; then
fi

data_path="./data/certbot"
conf_path="./data/nginx-terminate"

read -p "Enter domain name (eg. www.example.com): " domains

Expand All @@ -16,6 +17,7 @@ if [ -d "$data_path" ]; then
fi
fi

sed -i -r "s/DOMAIN_NAME_HERE/$domains/" $conf_path/nginx.conf

if [ ! -e "$data_path/conf/options-ssl-nginx.conf" ] || [ ! -e "$data_path/conf/ssl-dhparams.pem" ]; then
echo "### Downloading recommended TLS parameters ..."
Expand Down
4 changes: 2 additions & 2 deletions nginx-terminate/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ RUN apt-get update && apt-get -y upgrade && \

WORKDIR /opt

RUN wget https://nginx.org/download/nginx-1.18.0.tar.gz && \
RUN wget https://nginx.org/download/nginx-1.19.4.tar.gz && \
tar -zxvf nginx-1.*.tar.gz && \
cd nginx-1.* && \
./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-http_ssl_module --with-ipv6 --with-threads --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module && \
./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-stream_ssl_preread_module --with-http_ssl_module --with-ipv6 --with-threads --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module && \
make && make install && \
cd .. && rm -rf nginx-1.*

Expand Down