10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_opvn.rb', line 10
def build_config(host, opvn)
iface = opvn.delegate
local = iface.ipv6 ? host.id.first_ipv6.first_ipv6 : host.id.first_ipv4.first_ipv4
return unless local
push_routes = ""
if iface.push_routes
push_routes = iface.push_routes.routes.map{|route| "push \"route #{route.dst.to_string}\"" }.join("\n")
end
host.result.add(self, iface.cacert, Construqt::Resources::Rights.root_0644(Construqt::Resources::Component::OPENVPN), "etc", "openvpn", "ssl", "#{iface.name}-cacert.pem")
host.result.add(self, iface.hostcert, Construqt::Resources::Rights.root_0644(Construqt::Resources::Component::OPENVPN), "etc", "openvpn", "ssl", "#{iface.name}-hostcert.pem")
host.result.add(self, iface.hostkey, Construqt::Resources::Rights.root_0600(Construqt::Resources::Component::OPENVPN), "etc", "openvpn", "ssl", "#{iface.name}-hostkey.pem")
host.result.add(self, iface.dh1024, Construqt::Resources::Rights.root_0644(Construqt::Resources::Component::OPENVPN), "etc", "openvpn", "ssl", "#{iface.name}-dh1024")
host.result.add(self, "daemon\nlocal \#{local}\nproto udp\#{local.ipv6? ? '6' : ''}\nport 1194\nmode server\ntls-server\ndev \#{iface.name}\nca /etc/openvpn/ssl/\#{iface.name}-cacert.pem\ncert /etc/openvpn/ssl/\#{iface.name}-hostcert.pem\nkey /etc/openvpn/ssl/\#{iface.name}-hostkey.pem\ndh /etc/openvpn/ssl/\#{iface.name}-dh1024\nserver \#{iface.network.first_ipv4.to_s} \#{iface.network.first_ipv4.netmask}\nserver-ipv6 \#{iface.network.first_ipv6.to_string}\nclient-to-client\nkeepalive 10 30\ncipher AES-128-CBC # AES\ncipher BF-CBC # Blowfish (default)\ncomp-lzo\nmax-clients 100\nuser nobody\ngroup nogroup\npersist-key\npersist-tun\nstatus /etc/openvpn/status\nlog-append /var/log/openvpn-\#{iface.name}.log\nmute 20\n \#{push_routes}\nmssfix \#{iface.mtu||1348}\nplugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so openvpn\nclient-cert-not-required\nscript-security 2\n", Construqt::Resources::Rights.root_0644(Construqt::Resources::Component::OPENVPN), "etc", "openvpn", "#{iface.name}.conf")
end
|