network-manager-openvpn
package, hoping for simple integration with the network manager. It turned out that this plugin is not suitable for use.… it is a handshake-free protocol without any distinguishing signature or feature (such as a header or protocol handshake sequence) that would mark the ciphertext packets as being generated by OpenVPN. Anyone eavesdropping on the wire would see nothing but random-looking data.
… it is a handshake-free protocol without any distinguishing signature or feature (such as a header or protocol handshake sequence) that would mark the ciphertext packets as being generated by OpenVPN. Anyone eavesdropping on the wire would see nothing but random-looking data.
Or, in Russian, encrypted data looks like a random set of bytes and it is impossible to determine what it is.dev ovpn
dev-type tun
remote 10.10.10.10 5555 udp
nobind
secret /etc/openvpn/vpn.key 1
cipher AES-256-CBC
mlock
link-mtu 500
#mtu-test
mode p2p
ifconfig 192.168.1.2 192.168.1.1
route-up /etc/openvpn/vpn.routeup.sh
comp-lzo
up-delay
down /etc/openvpn/vpn.down.sh
down-pre
persist-key
persist-tun
ping 30
daemon
verb 1
management 127.0.0.1 4444
management-hold
management-signal
/etc/openvpn/vpn.routeup.sh
, sets the correct routing when the tunnel is raised and writes the local DNS to resolv.conf
:#!/bin/sh
vpn="10.10.10.10"
ns="127.0.0.1"
routedown="/etc/openvpn/$dev.routedown.sh"
[ -z "$dev" ] && { echo "should be run by openvpn" >&2; exit 1; }
origgw=`ip route get $vpn |grep ' via ' |sed -re 's/^.*via +([^ ]+).*$/\1/'`
origdev=`ip route get $vpn |grep ' dev ' |sed -re 's/^.*dev +([^ ]+).*$/\1/'`
[ -z "$origdev" ] && { echo "no route to VPN server, something wrong" >&2; exit 1; }
sed -i -e "1 s/^/nameserver $ns # added for OpenVPN\n/" /etc/resolv.conf
if [ -z "$origgw" ]; then
ip route replace $vpn dev $origdev
else
ip route replace $vpn via $origgw dev $origdev
fi
ip route replace default dev $dev
# Assume route to VPN is equal to default route.
if [ -z "$origgw" ]; then
echo "ip route replace default dev $origdev" >$routedown
else
echo "ip route replace default via $origgw dev $origdev" >$routedown
fi
echo "ip route del $vpn" >>$routedown
echo "sed -i -e '/# added for OpenVPN/ d' /etc/resolv.conf" >>$routedown
/etc/openvpn/vpn.down.sh
, returns the routing and DNS to its original state:#!/bin/sh
routedown="/etc/openvpn/$dev.routedown.sh"
if [ -f $routedown ]; then
. $routedown
rm -f $routedown
fi
Source: https://habr.com/ru/post/73915/
All Articles