File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+
3+ set -e
4+ umask 077
5+
6+ if [ " $# " -lt 2 ] || [ " $# " -gt 3 ]; then
7+ echo " Usage: $0 <public-name> <filename> [max-name-length (default 64)]" >&2
8+ exit 1
9+ fi
10+
11+ if [ -s " /data/tls/ech/${2% .ech} -current.ech" ]; then mv " /data/tls/ech/${2% .ech} -current.ech" " /data/tls/ech/${2% .ech} -previous.ech" ; fi
12+
13+ ECHPK=/tmp/private-key-${2% .ech} .bin
14+ ECHCL=/tmp/config-list-${2% .ech} .bin
15+
16+ bssl generate-ech \
17+ -public-name " $1 " \
18+ -max-name-length " ${3:- 64} " \
19+ -config-id " $( hexdump -n 1 -e ' "%u"' /dev/urandom) " \
20+ -out-ech-config /dev/null \
21+ -out-ech-config-list " $ECHCL " \
22+ -out-private-key " $ECHPK "
23+
24+ {
25+ echo " -----BEGIN PRIVATE KEY-----"
26+ ( printf ' \060\056\002\001\000\060\005\006\003\053\145\156\004\042\004\040' ; cat " $ECHPK " ) | openssl base64
27+ echo " -----END PRIVATE KEY-----"
28+ echo " -----BEGIN ECHCONFIG-----"
29+ openssl base64 -in " $ECHCL "
30+ echo " -----END ECHCONFIG-----"
31+ } > " /data/tls/ech/${2% .ech} -current.ech"
32+
33+ openssl base64 -A -in " $ECHCL "
34+ echo
35+
36+ rm " $ECHPK " " $ECHCL "
Original file line number Diff line number Diff line change @@ -84,5 +84,17 @@ if [ "$GOA" = "true" ]; then set -f; while true; do if [ -s /data/nginx/logs/acc
8484 --date-format=" %d/%b/%Y" --log-format=' [%d:%t %^] %v %h %T "%r" %s %b %b %R %u' --unix-socket=/run/goaccess.sock --log-file=/data/nginx/logs/access.log \
8585 --real-time-html --output=/tmp/goa/index.html --db-path=/data/goaccess/data --restore --persist \
8686 --browsers-file=/etc/goaccess/browsers.list --browsers-file=/etc/goaccess/podcast.list $GOACLA ; else sleep 10s; fi ; done ; fi &
87+ while true ; do
88+ if [ -s " /data/tls/ech/cron.sh" ]; then
89+ chmod +x /data/tls/ech/cron.sh
90+ /data/tls/ech/cron.sh
91+ sed -i " s|#ssl_ech_file|ssl_ech_file|g" /usr/local/nginx/conf/nginx.conf
92+ nginx -s reload
93+ elif grep -q ' ^[^#]*ssl_ech_file' /usr/local/nginx/conf/nginx.conf; then
94+ sed -i " s|ssl_ech_file|#ssl_ech_file|g" /usr/local/nginx/conf/nginx.conf
95+ nginx -s reload
96+ fi
97+ sleep 1h
98+ done &
8799while true ; do nginx -e stderr; done &
88100while true ; do index.js; done
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ mkdir -vp /data/npmplus/gravatar \
114114 /data/tls/certbot/renewal \
115115 /data/tls/certbot/acme-challenge \
116116 /data/tls/custom \
117+ /data/tls/ech \
117118 /data/html \
118119 /data/access \
119120 /data/anubis \
@@ -229,7 +230,8 @@ rm -vrf /data/letsencrypt-acme-challenge \
229230 /data/nginx/temp \
230231 /data/logs
231232
232- touch /data/html/index.html \
233+ touch /data/tls/ech/cron.sh \
234+ /data/html/index.html \
233235 /data/anubis/happy.webp \
234236 /data/anubis/reject.webp \
235237 /data/anubis/pensive.webp \
463465find /data/tls \
464466 /data/access \
465467 /data/npmplus \
466- -not -perm 770 \
467- -exec chmod 770 {} \;
468+ /data/nginx/logs \
469+ -not -perm 600 \
470+ -exec chmod 600 {} \;
468471
469472rm -vf /usr/local/nginx/logs/nginx.pid
470473rm -vf /run/* .sock
You can’t perform that action at this time.
0 commit comments