Commit | Line | Data |
---|---|---|
11cbb815 PD |
1 | # The software in this package is distributed under the GNU General |
2 | # Public License version 2 (with a special exception described below). | |
3 | # | |
4 | # A copy of GNU General Public License (GPL) is included in this distribution, | |
5 | # in the file COPYING.GPL. | |
6 | # | |
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. | |
12 | # | |
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. | |
15 | # | |
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. | |
18 | # | |
19 | # Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com> | |
20 | ||
f49f6323 PD |
21 | """ |
22 | Create vpn connections. | |
b7e04a3e CH |
23 | |
24 | .. note:: DEPRECATED! Please do not extend this or add new uses of this module, | |
25 | use :py:mod:`pyi2ncommon.arnied_api` or :py:mod:`pyi2ncommon.cnfvar` | |
26 | instead! | |
f49f6323 PD |
27 | """ |
28 | ||
29 | from . import build_cnfvar | |
30 | ||
31 | # Defaults are extracted from data/shared_arnied/vpnconn.cnf. | |
bcd9beb1 | 32 | default_vpnconn_name = "sample_vpn" |
f49f6323 PD |
33 | default_vpnconn_instance = 1 |
34 | default_cnfvars = { | |
35 | "VPNCONN_ACTIVATION": "ALWAYS", | |
36 | "VPNCONN_DISABLED": "0", | |
37 | "VPNCONN_DNS_RELAYING_ALLOWED": "1", | |
38 | "VPNCONN_EMAIL_RELAYING_ALLOWED": "1", | |
39 | "VPNCONN_ENCRYPTION_PROFILE_REF": "0", | |
40 | "VPNCONN_FIREWALL_RULESET_REF": "5", | |
41 | "VPNCONN_IKE_VERSION": "1", | |
42 | "VPNCONN_KEY_FOREIGN_REF": "1", | |
43 | "VPNCONN_KEY_OWN_REF": "1", | |
44 | "VPNCONN_KEY_TYPE": "PUBLIC", | |
45 | "VPNCONN_LAN_NAT_IP": "", | |
46 | "VPNCONN_LAN_NAT_MODE": "UNMODIFIED", | |
47 | "VPNCONN_LAN_NAT_NETWORK": "", | |
48 | "VPNCONN_LAN_NIC_REF": "2", | |
49 | "VPNCONN_LAN_NET": "172.17.0.0", | |
50 | "VPNCONN_LAN_NETMASK": "255.255.0.0", | |
51 | "VPNCONN_LAN_TYPE": "NIC", | |
52 | "VPNCONN_LIFETIME_IKE": "480", | |
53 | "VPNCONN_LIFETIME_IPSECSA": "60", | |
54 | "VPNCONN_OFFLINE_DETECTION_SEC": "60", | |
55 | "VPNCONN_PEER_DNS": "", | |
56 | "VPNCONN_PEER_IP": None, | |
57 | "VPNCONN_PEER_TYPE": "IP", | |
58 | "VPNCONN_PROXY_PROFILE_REF": "-2", | |
59 | "VPNCONN_PSK": "", | |
60 | "VPNCONN_PSK_FOREIGN_ID": "", | |
61 | "VPNCONN_PSK_FOREIGN_ID_TYPE": "IP", | |
62 | "VPNCONN_PSK_OWN_ID": "", | |
63 | "VPNCONN_PSK_OWN_ID_TYPE": "IP", | |
64 | "VPNCONN_REMOTE_INET_NAT": "1", | |
65 | "VPNCONN_REMOTE_MODECONFIG_IP": "192.168.99.1", | |
66 | "VPNCONN_REMOTE_NAT_ENABLE": "0", | |
67 | "VPNCONN_REMOTE_NAT_NETWORK": "", | |
68 | "VPNCONN_REMOTE_NET": "172.18.0.0", | |
69 | "VPNCONN_REMOTE_NETMASK": "255.255.0.0", | |
70 | "VPNCONN_REMOTE_TYPE": "CUSTOM", | |
71 | "VPNCONN_RETRIES": "3", | |
72 | "VPNCONN_SECURED": "ESP", | |
73 | "VPNCONN_XAUTH_SERVER_ENABLE": "0" | |
74 | } | |
75 | ||
76 | ||
77 | class BuildVPNConn(build_cnfvar.BuildCnfVar): | |
78 | ||
79 | def __init__(self, | |
80 | data=default_vpnconn_name, | |
81 | instance=default_vpnconn_instance, | |
82 | line_no=1, | |
83 | peer_ip="172.16.1.172"): | |
84 | build_cnfvar.BuildCnfVar.__init__(self, | |
85 | "VPNCONN", | |
86 | instance, | |
87 | data, | |
88 | line_no) | |
89 | self.add_defaults(default_cnfvars) | |
90 | ||
91 | self.update_cnf("VPNCONN_PEER_IP", 0, peer_ip) |