{"id":817,"date":"2023-07-25T00:09:01","date_gmt":"2023-07-25T03:09:01","guid":{"rendered":"https:\/\/freeshell.de\/~felipe\/blog\/?p=817"},"modified":"2024-06-09T15:44:16","modified_gmt":"2024-06-09T18:44:16","slug":"configure-openvpn-for-protonvpn-or-any-other-vpn-service-on-arch-linux-using-the-terminal","status":"publish","type":"post","link":"https:\/\/freeshell.de\/~felipe\/blog\/07\/2023\/linux\/configure-openvpn-for-protonvpn-or-any-other-vpn-service-on-arch-linux-using-the-terminal\/","title":{"rendered":"Configure openvpn for protonvpn or any other vpn service on Arch Linux using the Terminal"},"content":{"rendered":"\n<p>Very simple, first need to install openvpn, right<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pacman -S openvpn<\/code><\/pre>\n\n\n\n<p>Now we need to install using yay, two packages that are necessary to configure the whole thing, once we try to connect to a vpn:<\/p>\n\n\n\n<p>One is this, <\/p>\n\n\n\n<p><a href=\"https:\/\/aur.archlinux.org\/packages\/openvpn-update-resolv-conf-git\">https:\/\/aur.archlinux.org\/packages\/openvpn-update-resolv-conf-git<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yay -S openvpn-update-resolv-conf-git<\/code><\/pre>\n\n\n\n<p>Why? because otherwise we will get this: <\/p>\n\n\n\n<p>Options error: &#8211;up script fails with &#8216;\/etc\/openvpn\/update-resolv-conf&#8217;: No such file or directory (errno=2)<br \/>Options error: Please correct this error.<br \/>Use &#8211;help for more information.<\/p>\n\n\n\n<p>so we need to install the openresolv package.<\/p>\n\n\n\n<p>Then we need to modify or add actually, this lines at the bottom of the file to update the custom script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/openvpn\/update-resolv-conf<\/code><\/pre>\n\n\n\n<p>And we add:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>script-security 2<br \/>up \/etc\/openvpn\/update-resolv-conf<br \/>down \/etc\/openvpn\/update-resolv-conf<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><br \/>Now we have to consider this:<br \/>The update-systemd-resolved custom script<br \/>Note: Since systemd 229, systemd-networkd has exposed an API through DBus allowing management of DNS configuration on a per-link basis. Tools such as openresolv may not work reliably when \/etc\/resolv.conf is managed by systemd-resolved, and will not work at all if using resolve instead of dns in \/etc\/nsswitch.conf.<br \/>The update-systemd-resolved script links OpenVPN with systemd-resolved via DBus to update the DNS records.<br \/><br \/>Copy the script into \/etc\/openvpn\/scripts and mark as executable (or <strong>install openvpn-update-systemd-resolvedAUR<\/strong>) and append the following lines into the OpenVPN client configuration file:<br \/><br \/>\/etc\/openvpn\/client\/client.conf<br \/>client<br \/>remote example.com 1194 udp<br \/><br \/>script-security 2<br \/>setenv PATH \/usr\/bin<br \/>up \/etc\/openvpn\/scripts\/update-systemd-resolved<br \/>down \/etc\/openvpn\/scripts\/update-systemd-resolved<br \/>down-pre<br \/>In order to send all DNS traffic through the VPN tunnel and prevent DNS leaks, also add the following line (see [7]):<br \/><br \/>\/etc\/openvpn\/client\/client.conf<br \/>dhcp-option DOMAIN-ROUTE .<br \/><\/p>\n<\/blockquote>\n\n\n\n<p>So, according this documentation that is possible to find on the official website of Arch, we install :<\/p>\n\n\n\n<p>https:\/\/aur.archlinux.org\/packages\/openvpn-update-systemd-resolved<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yay -S penvpn-update-systemd-resolved<\/code><\/pre>\n\n\n\n<p>Now we can connect to prontonvpn using the console:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>[felipe@SDFCSC protonvpn]$ sudo openvpn &#8211;config us-free-20.protonvpn.net.tcp.ovpn<br \/>2023-07-24 22:51:27 DEPRECATED OPTION: &#8211;cipher set to &#8216;AES-256-CBC&#8217; but missing in &#8211;data-ciphers (AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305). OpenVPN ignores &#8211;cipher for cipher negotiations.<br \/>2023-07-24 22:51:27 Note: Kernel support for ovpn-dco missing, disabling data channel offload.<br \/>2023-07-24 22:51:27 OpenVPN 2.6.5 [git:makepkg\/cbc9e0ce412e7b42+] x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH\/PKTINFO] [AEAD] [DCO] built on Jun 13 2023<br \/>2023-07-24 22:51:27 library versions: OpenSSL 3.1.1 30 May 2023, LZO 2.10<br \/>2023-07-24 22:51:27 DCO version: N\/A<br \/>Enter Auth Username: *************************<br \/>Enter Auth Password: *********************<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<p>NOTE: For protonvpn proper usage we need the openvpn-IKEv2 password and username, you can get it in the dashboard of the protonvpn site.<\/p>\n\n\n\n<p>For any other connection, use the common user and password to enter a vpn server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;felipe@SDFCSC protonvpn]$ sudo openvpn --config us-free-20.server.net.tcp.ovpn<\/code><\/pre>\n\n\n\n<p><br \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Very simple, first need to install openvpn, right Now we need to install using yay, two packages that are necessary to configure the whole thing, once we try to connect to a vpn: One is this, https:\/\/aur.archlinux.org\/packages\/openvpn-update-resolv-conf-git Why? because otherwise we will get this: Options error: &#8211;up script fails with &#8216;\/etc\/openvpn\/update-resolv-conf&#8217;: No such file or [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71,70],"tags":[66,67,90,89],"class_list":["post-817","post","type-post","status-publish","format-standard","hentry","category-arch","category-linux","tag-arch","tag-linux","tag-protonvpn","tag-vpn"],"_links":{"self":[{"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/posts\/817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/comments?post=817"}],"version-history":[{"count":1,"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/posts\/817\/revisions"}],"predecessor-version":[{"id":818,"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/posts\/817\/revisions\/818"}],"wp:attachment":[{"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/media?parent=817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/categories?post=817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freeshell.de\/~felipe\/blog\/wp-json\/wp\/v2\/tags?post=817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}