X-Git-Url: https://git.deb.at/?p=debienna.git;a=blobdiff_plain;f=OpenVPN%2Findex.mdwn;h=7d4d6e3cf79b0effa34b3ab739b8feba081db9ed;hp=9371d438c9295f57e5ef7ad6879dc3a7bf3f51b1;hb=f1d9d6f2df40b7572314c01cc715ab3378a21a6b;hpb=096ccad2de573f503e177bb76164614337f92da3 diff --git a/OpenVPN/index.mdwn b/OpenVPN/index.mdwn index 9371d43..7d4d6e3 100644 --- a/OpenVPN/index.mdwn +++ b/OpenVPN/index.mdwn @@ -1,11 +1,12 @@ + Sample Configs für OpenVPN mit NAT für inet (redirect-gateway) auf einem Internet Server (+ OpenVZ) OpenVPN Sampe Server Config: -{{{ +[[!format txt """ port 1194 -proto tcp -dev tun +proto tcp +dev tun tls-server server 192.168.50.0 255.255.255.240 # NETZ ÄNDERN JE NACH BEDARF! @@ -18,7 +19,7 @@ dh /etc/openvpn/certs/dh2048.pem #push "route 192.168.0.0 255.255.255.192" #push "dhcp-option DNS 192.168.50.3" -#keepalive 10 120 +#keepalive 10 120 auth SHA1 @@ -28,17 +29,16 @@ group root persist-key persist-tun -verb 3 +verb 3 comp-lzo client-to-client status /etc/openvpn/openvpn-status.log log-append /var/log/openvpn.log -}}} - +"""]] Client Sample Config: -{{{ +[[!format txt """ client -dev tup +dev tup proto tcp-client remote example.net resolv-retry infinite @@ -51,14 +51,12 @@ cert certs/_cert_vpn.pem key certs/_key_vpn.pem comp-lzo verb 0 -port 143 +port 143 #tls-remote VPNServer persist-local-ip -}}} - - +"""]] Zertifikate bauen: (common name muss wie der Host heißen!) -{{{ +[[!format txt """ #!/bin/bash @@ -89,10 +87,9 @@ echo "" echo "Client Certs mit folgendem Commando vorbereiten:" echo "./clientcerts " -}}} - +"""]] Clientcerts -{{{ +[[!format txt """ #!/bin/bash @@ -109,11 +106,9 @@ echo "CSR Cert loeschen..." rm $1_csr_vpn.pem echo "Clientcert $1_cert_vpn.pem und Clientkey $1_key_vpn.pem erstellt..." cd .. -}}} - - +"""]] iptables für routing: -{{{ +[[!format txt """ #!/bin/bash case $1 in @@ -142,7 +137,7 @@ iptables -t nat -A POSTROUTING -o $VPNDEV -j MASQUERADE iptables -A INPUT -i $VPNDEV -s $VPNLAN -j ACCEPT iptables -A FORWARD -i $VPNDEV -o $EXTDEV -s $VPNLAN -j ACCEPT iptables -A FORWARD -i $EXTDEV -o $VPNDEV -d $VPNLAN -m state --state RELATED,ESTABLISHED -j ACCEPT -iptables -t nat -A POSTROUTING -s $VPNLAN -o $EXTDEV -j SNAT --to-source +iptables -t nat -A POSTROUTING -s $VPNLAN -o $EXTDEV -j SNAT --to-source ;; restart) @@ -150,4 +145,4 @@ $0 stop && $0 start ;; esac -}}} \ No newline at end of file +"""]] \ No newline at end of file