1 # The software in this package is distributed under the GNU General
2 # Public License version 2 (with a special exception described below).
4 # A copy of GNU General Public License (GPL) is included in this distribution,
5 # in the file COPYING.GPL.
7 # As a special exception, if other files instantiate templates or use macros
8 # or inline functions from this file, or you compile this file and link it
9 # with other works to produce a work based on this file, this file
10 # does not by itself cause the resulting work to be covered
11 # by the GNU General Public License.
13 # However the source code for this file must still be made available
14 # in accordance with section (3) of the GNU General Public License.
16 # This exception does not invalidate any other reasons why a work based
17 # on this file might be covered by the GNU General Public License.
19 # Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
22 Create vpn connections.
25 from . import build_cnfvar
27 # Defaults are extracted from data/shared_arnied/vpnconn.cnf.
28 default_vpnconn_name = "sample_vpn"
29 default_vpnconn_instance = 1
31 "VPNCONN_ACTIVATION": "ALWAYS",
32 "VPNCONN_DISABLED": "0",
33 "VPNCONN_DNS_RELAYING_ALLOWED": "1",
34 "VPNCONN_EMAIL_RELAYING_ALLOWED": "1",
35 "VPNCONN_ENCRYPTION_PROFILE_REF": "0",
36 "VPNCONN_FIREWALL_RULESET_REF": "5",
37 "VPNCONN_IKE_VERSION": "1",
38 "VPNCONN_KEY_FOREIGN_REF": "1",
39 "VPNCONN_KEY_OWN_REF": "1",
40 "VPNCONN_KEY_TYPE": "PUBLIC",
41 "VPNCONN_LAN_NAT_IP": "",
42 "VPNCONN_LAN_NAT_MODE": "UNMODIFIED",
43 "VPNCONN_LAN_NAT_NETWORK": "",
44 "VPNCONN_LAN_NIC_REF": "2",
45 "VPNCONN_LAN_NET": "172.17.0.0",
46 "VPNCONN_LAN_NETMASK": "255.255.0.0",
47 "VPNCONN_LAN_TYPE": "NIC",
48 "VPNCONN_LIFETIME_IKE": "480",
49 "VPNCONN_LIFETIME_IPSECSA": "60",
50 "VPNCONN_OFFLINE_DETECTION_SEC": "60",
51 "VPNCONN_PEER_DNS": "",
52 "VPNCONN_PEER_IP": None,
53 "VPNCONN_PEER_TYPE": "IP",
54 "VPNCONN_PROXY_PROFILE_REF": "-2",
56 "VPNCONN_PSK_FOREIGN_ID": "",
57 "VPNCONN_PSK_FOREIGN_ID_TYPE": "IP",
58 "VPNCONN_PSK_OWN_ID": "",
59 "VPNCONN_PSK_OWN_ID_TYPE": "IP",
60 "VPNCONN_REMOTE_INET_NAT": "1",
61 "VPNCONN_REMOTE_MODECONFIG_IP": "192.168.99.1",
62 "VPNCONN_REMOTE_NAT_ENABLE": "0",
63 "VPNCONN_REMOTE_NAT_NETWORK": "",
64 "VPNCONN_REMOTE_NET": "172.18.0.0",
65 "VPNCONN_REMOTE_NETMASK": "255.255.0.0",
66 "VPNCONN_REMOTE_TYPE": "CUSTOM",
67 "VPNCONN_RETRIES": "3",
68 "VPNCONN_SECURED": "ESP",
69 "VPNCONN_XAUTH_SERVER_ENABLE": "0"
73 class BuildVPNConn(build_cnfvar.BuildCnfVar):
76 data=default_vpnconn_name,
77 instance=default_vpnconn_instance,
79 peer_ip="172.16.1.172"):
80 build_cnfvar.BuildCnfVar.__init__(self,
85 self.add_defaults(default_cnfvars)
87 self.update_cnf("VPNCONN_PEER_IP", 0, peer_ip)