openvpn-2.5.6-r1.ebuild pkg_postinst()

 dent00x ~ # equery which openvpn

/var/db/repos/gentoo/net-vpn/openvpn/openvpn-2.5.6-r1.ebuild

dent00x ~ # file /var/db/repos/gentoo/net-vpn/openvpn/openvpn-2.5.6-r1.ebuild

/var/db/repos/gentoo/net-vpn/openvpn/openvpn-2.5.6-r1.ebuild: Gentoo ebuild, EAPI 7, ASCII text

pkg_postinst() {

        tmpfiles_process openvpn.conf


        if use x64-macos ; then

                elog "You might want to install tuntaposx for TAP interface support:"

                elog "http://tuntaposx.sourceforge.net"

        fi


        if systemd_is_booted || has_version sys-apps/systemd ; then

                elog "In order to use OpenVPN with systemd please use the correct systemd service file."

                elog  ""

                elog "server:"

                elog ""

                elog "- Place your server configuration file in /etc/openvpn/server"

                elog "- Use the openvpn-server@.service like so"

                elog "systemctl start openvpn-server@{Server-config}"

                elog ""

                elog "client:"

                elog ""

                elog "- Place your client configuration file in /etc/openvpn/client"

                elog "- Use the openvpn-client@.service like so:"

                elog "systemctl start openvpn-client@{Client-config}"

        else

                elog "The openvpn init script expects to find the configuration file"

                elog "openvpn.conf in /etc/openvpn along with any extra files it may need."

                elog ""

                elog "To create more VPNs, simply create a new .conf file for it and"

                elog "then create a symlink to the openvpn init script from a link called"

                elog "openvpn.newconfname - like so"

                elog "   cd /etc/openvpn"

                elog "   ${EDITOR##*/} foo.conf"

                elog "   cd /etc/init.d"

                elog "   ln -s openvpn openvpn.foo"

                elog ""

                elog "You can then treat openvpn.foo as any other service, so you can"

                elog "stop one vpn and start another if you need to."

        fi


        if grep -Eq "^[ \t]*(up|down)[ \t].*" "${ROOT}/etc/openvpn"/*.conf 2>/dev/null ; then

                ewarn ""

                ewarn "WARNING: If you use the remote keyword then you are deemed to be"

                ewarn "a client by our init script and as such we force up,down scripts."

                ewarn "These scripts call /etc/openvpn/\$SVCNAME-{up,down}.sh where you"

                ewarn "can move your scripts to."

        fi


        if use plugins ; then

                einfo ""

                einfo "plugins have been installed into /usr/$(get_libdir)/${PN}/plugins"

        fi

}

/var/db/repos/gentoo/net-vpn/openvpn/openvpn-2.5.6-r1.ebuild lines 87-197/197 (END)



https://community.openvpn.net/openvpn/wiki/OpenVPN-systemd-use

Verify OpenVPN systemd support

$ openvpn --version

Required FLAG enable_systemd=yes - This FLAG must be listed to continue.





DNS with systemd




Free Research Preview. ChatGPT may produce inaccurate information about people, places, or facts. ChatGPT May 24 Version

To add DNS and search domain settings for the `tun0` interface using `systemd-resolved`, you can follow these steps:
1. Create a configuration file for `tun0` interface:
   ```
   sudo nano /etc/systemd/network/99-tun0.network
   ```
2. Add the following content to the file:
   ```
   [Match]
   Name=tun0
   [Network]
   DNS=<VPN_DNS_IP>
   Domains=<VPN_SEARCH_DOMAIN>
   ```
   Replace `<VPN_DNS_IP>` with the IP address of the DNS server provided by your VPN, and `<VPN_SEARCH_DOMAIN>` with the search domain for your VPN.
3. Save the file and exit the text editor.
4. Restart the `systemd-resolved` service:
   ```
   sudo systemctl restart systemd-resolved
   ```
   This will apply the new configuration.
Now, the DNS settings and search domain specified in the configuration file will be automatically applied to the `tun0` interface when it is connected.
Please note that this method assumes you are using `systemd-resolved` as the DNS resolver on your system. If you're using a different DNS resolver or network configuration method, the steps may vary.





Comments

Popular posts from this blog

Uploading Firmware to "bricked" Netgear WNDR3800 from Linux with atftp after botched DD-WRT Firmware Upgrade.

VMware Remote Console detected; unable to proceed with VMware Workstation installation.

zabbix agent on gentoo