Skip to content

Commit

Permalink
Feat: add tls encryption for obfuscation
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrime-ru committed Aug 10, 2024
1 parent ea7702e commit ac4c2b6
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 4 deletions.
3 changes: 2 additions & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

echo "nameserver 1.1.1.1" >> /etc/resolv.conf

nohup bash -c "sleep 1 && cd /root/antizapret/ && ./process.sh && journalctl -f" &
start=$(date +%T)
nohup bash -c "sleep 1 && cd /root/antizapret/ && ./process.sh && journalctl -f --since=$start" &

/root/generate.sh \
&& exec /usr/sbin/init
1 change: 1 addition & 0 deletions keys/server/antizapret-tcp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ ca keys/ca.crt
cert keys/antizapret-server.crt
key keys/antizapret-server.key # This file should be kept secret
dh keys/dh2048.pem
tls-crypt keys/antizapret-tls-crypt.key 0

data-ciphers "AES-128-GCM:AES-256-GCM"
1 change: 1 addition & 0 deletions keys/server/antizapret.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ ca keys/ca.crt
cert keys/antizapret-server.crt
key keys/antizapret-server.key # This file should be kept secret
dh keys/dh2048.pem
tls-crypt keys/antizapret-tls-crypt.key 0

data-ciphers "AES-128-GCM:AES-256-GCM"
5 changes: 5 additions & 0 deletions keys/templates/openvpn-tcp-unified.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ client
remote ${SERVER}

remote-cert-tls server
key-direction 1

dev tun
proto tcp
Expand All @@ -60,3 +61,7 @@ ${CLIENT_CERT}
<key>
${CLIENT_KEY}
</key>

<tls-crypt>
${CLIENT_TLS_CRYPT}
</tls-crypt>
5 changes: 5 additions & 0 deletions keys/templates/openvpn-udp-unified.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ client
remote ${SERVER}

remote-cert-tls server
key-direction 1

dev tun
proto udp
Expand Down Expand Up @@ -61,3 +62,7 @@ ${CLIENT_CERT}
<key>
${CLIENT_KEY}
</key>

<tls-crypt>
${CLIENT_TLS_CRYPT}
</tls-crypt>
5 changes: 3 additions & 2 deletions rootfs/root/fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ ytimg.com
ggpht.com
googleusercontent.com
googlevideo.com
google.com
" >> /root/antizapret/config/include-hosts-dist.txt

sort --merge --unique /root/antizapret/config/include-hosts-dist.txt -o /root/antizapret/config/include-hosts-dist.txt
sed -i '/^[[:space:]]*$/d' /root/antizapret/config/include-hosts-dist.txt

sort --unique /root/antizapret/config/include-hosts-dist.txt -o /root/antizapret/config/include-hosts-dist.txt
8 changes: 7 additions & 1 deletion rootfs/root/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ load_key() {
CA_CERT=$(grep -A 999 'BEGIN CERTIFICATE' -- "/etc/openvpn/server/keys/ca.crt")
CLIENT_CERT=$(grep -A 999 'BEGIN CERTIFICATE' -- "/etc/openvpn/client/keys/antizapret-client.crt")
CLIENT_KEY=$(cat -- "/etc/openvpn/client/keys/antizapret-client.key")
if [ ! "$CA_CERT" ] || [ ! "$CLIENT_CERT" ] || [ ! "$CLIENT_KEY" ]
CLIENT_TLS_CRYPT=$(grep -v '^#' -- "/etc/openvpn/server/keys/antizapret-tls-crypt.key")
if [ ! "$CA_CERT" ] || [ ! "$CLIENT_CERT" ] || [ ! "$CLIENT_KEY" ] || [ ! "$CLIENT_TLS_CRYPT" ]
then
echo "Can't load client keys!"
exit 7
Expand All @@ -61,6 +62,11 @@ copy_keys() {
}


if [[ ! -f /etc/openvpn/server/keys/antizapret-tls-crypt.key ]]
then
openvpn --genkey secret /etc/openvpn/server/keys/antizapret-tls-crypt.key
fi

if [[ ! -f /etc/openvpn/server/keys/ca.crt ]] || \
[[ ! -f /etc/openvpn/server/keys/antizapret-server.crt ]] || \
[[ ! -f /etc/openvpn/server/keys/antizapret-server.key ]] || \
Expand Down

0 comments on commit ac4c2b6

Please sign in to comment.