1 = Setup notes for the OpenVPN SMF service integration
3 == Multiple-instance support
5 To create additional SMF instances for additional OpenVPN configuration
6 files, run the following commands (as the `root` or a user with the RBAC
7 privileges needed to do this setup):
10 :; VPNCFG=mywork-client
11 :; pfexec svccfg -s openvpn add $VPNCFG
12 :; pfexec svcadm refresh openvpn:$VPNCFG
15 NOTE: The service template assumes all system-level connection config files
16 (and additional files they might pull by relative paths) are all located
17 under `/etc/openvpn/` directory as `$VPNCFG.conf`; initial logging is set up
18 to write into `/var/log/openvpn/$VPNCFG/log` by default, and then the location
19 may be specified by the `config_file` contents. In any case, make sure the
20 specified location exists and is writable by the service user account.
22 If you want the tunnel just occasionally (not up by default every time you
23 boot), do not forget to run it as a temporarily-enabled service (also this
24 requires less RBAC privileges needed to the user account that would start
25 or stop the tunnel service):
28 :; pfexec svcadm enable -ts openvpn:$VPNCFG
31 Inspect the results with:
34 :; svcs -p openvpn:$VPNCFG
35 :; tail -f /var/svc/log/*openvpn:$VPNCFG.log &
38 == Firewall considerations
40 In order for tunneled traffic to actually pass, you may have to allow it in
41 your (custom) IPFilter config, usually `/etc/ipf/ipf.conf`, by preemptively
42 adding lines like these (scale by the amount of TUN and/or TAP tunnels you
43 expect active at the same time), e.g.:
47 pass out quick on tun0
49 pass out quick on tun1
51 pass out quick on tun2
53 pass out quick on tun3
55 pass out quick on tap0
57 pass out quick on tap1
59 pass out quick on tap2
61 pass out quick on tap3
64 ...and restarting the service:
67 :; pfexec svcadm restart ipfilter
70 If the remote OpenVPN server for your client is on some non-standard ports,
71 or if your local OpenVPN server instance listens on some non-standard ports,
72 and your firewall config is strict, you might have to allow that traffic in
73 the firewall rulesets too.
75 Alternately you might research and use scripting hooks in openvpn config files.
77 == OpenVPN in local zones
79 You can run an openvpn router in a local zone with exclusive IP stack, using
80 the tun/tap device drivers (kernel modules) installed in the global zone and
81 passed into the local zone.
83 This may require some additional privileges and setup steps for that zone;
84 if it does not work "out of the box" for you, try changing the zone manifest
88 <zone name=... limitpriv="default,priv_net_rawaccess">
90 <device match="/dev/tun"/>
91 <device match="/dev/tap"/>
95 == Special privileges for the OpenVPN daemon
97 You might also want to enable some permissions in the service manifest below,
98 or per-instance, for example if you want one to listen on privileged ports, or
99 to `chroot()` the daemon, or to use configuration files and device nodes owned
100 by another user. Remember that under SMF a `root` is not always almighty!
102 Specific use-cases will require different privilege sets, but all or most of
103 the list below had been useful in different non-triial deployments:
107 <!-- Some setups might need extra permissions for their OpenVPN
108 service, but not all - so by default they are commented away
109 and may be enabled by an end-user's deployment, and maybe just
110 for a particular instance. Possibly, this might also allow to
111 run OpenVPN as a non-root account. -->
113 <method_credential group='root' limit_privileges=':default'
114 privileges='basic,sys_iptun_config,sys_net_config,sys_devices,net_privaddr,net_rawaccess,net_icmpaccess,file_chown,file_owner,file_dac_write,proc_setid,proc_chroot'
115 supp_groups=':default' user='root'/>
121 Have fun running your copy of OpenVPN on OpenIndiana!