File tree Expand file tree Collapse file tree 5 files changed +172
-0
lines changed
root/usr/local/share/docker-openvpn/examples Expand file tree Collapse file tree 5 files changed +172
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Features:
8
8
9
9
``` bash
10
10
# PKI init
11
+ # Edit vars file
11
12
ovpn pki init [nopass]
12
13
13
14
# Load example
Original file line number Diff line number Diff line change
1
+ # basic_s2s
2
+
3
+ Features:
4
+
5
+ - Site-to-site VPN
6
+
7
+ ## Configuration
8
+
9
+ ``` bash
10
+ # PKI init
11
+ # Edit vars file
12
+ ovpn pki init [nopass]
13
+
14
+ # Load example
15
+ ovpn example basic_s2s_ipv6
16
+
17
+ # Certifcates
18
+ # NOTE: To also use server certificates for p2p connection between servers
19
+ # add clientAuth to extendedKeyUsage before generating certificate
20
+ ovpn subject add first server [nopass]
21
+ # Change filenames in config file
22
+
23
+ ovpn subject add second server [nopass]
24
+ ovpn subject gen-pkg second # creates .tar.gz in client-confs
25
+ # Copy .tar.gz to second machine
26
+ ovpn load NAME.pkg.tar.gz # Second machine
27
+ ```
28
+
29
+ ## External docs
30
+
31
+ - [ Tutorial 1] ( https://zeldor.biz/2010/12/openvpn-site-to-site-setup/ )
Original file line number Diff line number Diff line change
1
+ #
2
+ # Basic OpenVPN site-to-site IPv6 configuration
3
+ # @author Martin Dagarin
4
+ # @version 1
5
+ # @since 22/03/2020
6
+ #
7
+
8
+ mode p2p
9
+ dev tun0
10
+ config include.conf
11
+ config unprivileged.conf
12
+
13
+ # Basic info
14
+ remote $REMOTE_A
15
+ proto $PROTO
16
+ port $PORT
17
+
18
+ # Network info
19
+ ifconfig $IP_B $IP_A
20
+ ifconfig-ipv6 $IP6_B $IP6_A
21
+
22
+ # Set routes in routing table
23
+ # route 192.168.2.0 255.255.255.0
24
+ # route-ipv6 ipv6addr/bits [gateway] [metric]
25
+
26
+ # CA files
27
+ tls-client
28
+ remote-cert-tls server
29
+
30
+ # Connection settings
31
+ persist-local-ip
32
+ persist-remote-ip
33
+ persist-tun
34
+
35
+ # Encryption settings
36
+ cipher AES-256-GCM
37
+
38
+ # Additional settings
39
+ keepalive 15 120
40
+ explicit-exit-notify 10
Original file line number Diff line number Diff line change
1
+ #
2
+ # Basic OpenVPN site-to-site IPv6 configuration
3
+ # @author Martin Dagarin
4
+ # @version 1
5
+ # @since 22/03/2020
6
+ #
7
+
8
+ mode p2p
9
+ dev tun0
10
+ config include.conf
11
+ config unprivileged.conf
12
+
13
+ # Basic info
14
+ remote $REMOTE_B
15
+ proto $PROTO
16
+ port $PORT
17
+
18
+ # Network info
19
+ ifconfig $IP_A $IP_B
20
+ ifconfig-ipv6 $IP6_A $IP6_B
21
+
22
+ # Set routes in routing table
23
+ # route 192.168.2.0 255.255.255.0
24
+ # route-ipv6 ipv6addr/bits [gateway] [metric]
25
+
26
+ # CA files
27
+ ca ca.crt
28
+ cert server.crt
29
+ key server.key
30
+ dh dh.pem
31
+ tls-crypt ta.key
32
+ tls-server # Note: Only for TLS negotiation, requires dh.pem
33
+ remote-cert-tls client # NOTE: Change this to server if you use server certificates on both sides
34
+
35
+ # Connection settings
36
+ persist-local-ip
37
+ persist-remote-ip
38
+ persist-tun
39
+
40
+ # Encryption settings
41
+ cipher AES-256-GCM
42
+
43
+ # Additional settings
44
+ keepalive 15 120
45
+ explicit-exit-notify 10
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/with-contenv bash
2
+ #
3
+ # Config wizard for basic_s2s example
4
+ # @author Martin Dagarin
5
+ # @version 1
6
+ # @since 20/03/2020
7
+ #
8
+
9
+ if [ -z "$1" ]; then
10
+ echo 'Directory path missing'
11
+ exit 1
12
+ fi
13
+
14
+ read -p 'Protocol udp, tcp, udp6, tcp6 [udp]: ' protocol
15
+ protocol=${protocol:=udp}
16
+
17
+ read -p 'Port [1194]: ' port
18
+ port=${port:=1194}
19
+
20
+ read -p 'Site A public IP: ' remote_a
21
+ if [ -z "$remote_a" ]; then echo 'Invalid IP'; exit 2; fi
22
+
23
+ read -p 'Site A tunnel IP: ' ip_a
24
+ if [ -z "$ip_a" ]; then echo 'Invalid IP'; exit 2; fi
25
+
26
+ read -p 'Site A tunnel IPv6: ' ip6_a
27
+ if [ -z "$ip6_a" ]; then echo 'Invalid IPv6'; exit 2; fi
28
+
29
+ read -p 'Site B public IP: ' remote_b
30
+ if [ -z "$remote_b" ]; then echo 'Invalid IP'; exit 2; fi
31
+
32
+ read -p 'Site B tunnel IP: ' ip_b
33
+ if [ -z "$ip_b" ]; then echo 'Invalid IP'; exit 2; fi
34
+
35
+ read -p 'Site B tunnel IPv6: ' ip6_b
36
+ if [ -z "$ip6_b" ]; then echo 'Invalid IPv6'; exit 2; fi
37
+
38
+ confs=(
39
+ "$1/config/openvpn/openvpn.conf"
40
+ "$1/config/openvpn/openvpn-template.conf"
41
+ )
42
+
43
+ for file in "${confs[@]}"
44
+ do
45
+ mv $file $file.old
46
+ PROTO="$protocol" \
47
+ PORT="$port" \
48
+ REMOTE_A="$remote_a" \
49
+ IP_A="$ip_a" \
50
+ IP6_A="$ip6_a" \
51
+ REMOTE_B="$remote_b" \
52
+ IP_B="$ip_b" \
53
+ IP6_B="$ip6_b" \
54
+ envsubst < $file.old > $file
55
+ done
You can’t perform that action at this time.
0 commit comments