|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +if [[ -z "$1" ]] |
| 4 | + then echo "You must provide a domain.tld for hastebin (e.g. example.com)" |
| 5 | + exit |
| 6 | +fi |
| 7 | + |
| 8 | +echo '.__ __ ___. .__ ' |
| 9 | +echo '| |__ _____ _______/ |_ ____\_ |__ |__| ____ ' |
| 10 | +echo '| | \\__ \ / ___/\ __\/ __ \| __ \| |/ \ ' |
| 11 | +echo '| Y \/ __ \_\___ \ | | \ ___/| \_\ \ | | \' |
| 12 | +echo '|___| (____ /____ > |__| \___ >___ /__|___| /' |
| 13 | +echo ' \/ \/ \/ \/ \/ \/ ' |
| 14 | + |
| 15 | +docker run --name hastebin -d -p 8082:7777 jmvrbanac/hastebin |
| 16 | +echo "server { |
| 17 | + listen 443 ssl http2; |
| 18 | + listen [::]:443 ssl http2; |
| 19 | + server_name paste.$1; |
| 20 | + server_tokens off; |
| 21 | + ssl on; |
| 22 | + ssl_certificate /etc/ssl/$1/nginx.crt; |
| 23 | + ssl_certificate_key /etc/ssl/$1/nginx.key; |
| 24 | + ssl_prefer_server_ciphers on; |
| 25 | + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; |
| 26 | + ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA25$ |
| 27 | + ssl_dhparam /etc/ssl/mail/dhparams.pem; |
| 28 | + add_header Strict-Transport-Security max-age=15768000; |
| 29 | + ssl_session_timeout 30m; |
| 30 | + client_max_body_size 150m; |
| 31 | + location / { |
| 32 | + proxy_set_header X-Real-IP \$remote_addr; |
| 33 | + proxy_set_header X-Forwarded-For \$remote_addr; |
| 34 | + proxy_set_header Host \$host; |
| 35 | + proxy_pass http://127.0.0.1:8082; |
| 36 | + } |
| 37 | + include /etc/nginx/conf.d/letsencrypt-auth.conf; |
| 38 | +} |
| 39 | +" | sudo tee /etc/nginx/sites-available/paste.$1 > /dev/null |
| 40 | + |
| 41 | +sudo ln -s /etc/nginx/sites-available/paste.$1 /etc/nginx/sites-enabled/003-paste.$1 |
| 42 | +sudo nginx -t |
| 43 | + |
| 44 | +echo "Don't forget to add a Let's Encrypt certificate for $1" |
| 45 | +echo "If nginx syntax is ok, don´t forget to perform sudo service nginx restart" |
0 commit comments