Open GentlemansKiller opened 4 years ago
Hi @GentlemansKiller Thank you for your interest in our project. We will discuss such a possibility with our dev team.
Anyway, it is not easy to be able to support all amount of Linux distros that are available. Please, note that you can compile IVPN binaries yourself and use any init system you want (or do not use any at all). Here you can find some steps/requirements of how to install IVPN binaries: https://github.com/ivpn/desktop-app-cli/issues/3#issuecomment-634574309
@stenya Hey Stenya, thanks so much for the reply. Just a suggestion, maybe you could put these steps on some of the official documentation/readme for others. Either way, I will try this out :)
Yes, will do it now :)
@stenya super cool :D And if you decide to integrate OpenRC or some other init system automatically, let me know, and i can help test
Coming back to this after several months, I finally implemented it lol. Below is my personal script that I use to update my binaries. I structured it so that it will do so without ever exposing the internet connection to the outside without a VPN connection. It is also intended to work for initial installation and for update.
Whoever comes across this, please note some things:
start_post
which will run right after the service starts. I've added this to my own script to take advantage of the firewall to turn it on during system init :) More info here as well: https://www.funtoo.org/OpenrcEDIT July 5 2021:
EDIT Oct 14 2021:
EDIT Nov 9 2021
EDIT Jan 26 2022
splittun.sh
, now gets installedEDIT March 24 2022
make
to the list of packages, recently i had an issue where i needed it on a fresh install, for some reason :/ EDIT May 5 2022
EDIT Sept 19 2022
EDIT Nov 24 2022
EDIT Sept 25 2023
IVPN_BUILD_SKIP_GLIBC_VER_CHECK=true
and IVPN_BUILD_CAN_SKIP_DOWNLOAD_SERVERS=true
env variables properly now, since they weren't getting recognized being at the top of the script.#!/bin/bash
# PRE-REQUISITES:
# - Internet Connectivity
# - Edit the environment variables to be sure they are all correct. For example make sure you're using the proper service for network (maybe you have NetworkManager or connmand)
#Notes:
# - If a binary is not behaving correctly you can run it with --logging.
# - When testing the service binary, you need to run with sudo
# - AUR script reference: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ivpn
# - When installing manually, or when debugging this script and seeing why failure, could be due to an update recently. this happened with the WG and obsf4proxy updates and also the split tunnel update. Check the AUR script to see if any updates
WORKING_DIR=~/.cache/ivpn-build
PROGRAM_FILES_LOCATION=/opt/ivpn/etc # additional files needed by the service daemon
PROGRAM_FILES_LOCATION_MISC=/opt/ivpn # wireguard, obfs4proxy, kem, V2Ray
SVC_BIN_LOCATION=/opt/ivpn/ivpn-service # location of the service/daemon binary
CLI_BIN_LOCATION=/usr/local/bin/ivpn # location of the CLI program
NET_SVC=connmand
VERSION=3.12.0.1
# cache the password with a random sudo command
sudo ls
# echo each command
set -x
# install dependencies
sudo pacman -Sy --needed wget git go gcc glibc lsof openvpn wireguard-tools wireless_tools curl make cmake ninja
# check to see if there is internet connection first. fail script if no connection. You can use any website
wget -q --tries=10 --timeout=20 --spider http://startpage.com
if [[ $? -eq 0 ]]; then
echo "Internet Connection Online. Proceeding..."
else
echo "Offline. Will not continue script"
exit 1
fi
# remove working dir
rm -rf ${WORKING_DIR}
# make temp dirs
mkdir -p ${WORKING_DIR}
# reclone git repos
git clone --depth 1 --branch v${VERSION} https://github.com/ivpn/desktop-app.git ${WORKING_DIR}/desktop-app
# compile cli and daemon
# env vars starting with v3.10.14 - https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ivpn&id=cb3c4c102a97d2146e0372e98afc46a0e58f66da
IVPN_BUILD_SKIP_GLIBC_VER_CHECK=true IVPN_BUILD_CAN_SKIP_DOWNLOAD_SERVERS=true sh ${WORKING_DIR}/desktop-app/cli/References/Linux/compile-cli.sh
IVPN_BUILD_SKIP_GLIBC_VER_CHECK=true IVPN_BUILD_CAN_SKIP_DOWNLOAD_SERVERS=true sh ${WORKING_DIR}/desktop-app/daemon/References/Linux/scripts/build-all.sh
# bring down network.
while ! sudo rc-service ${NET_SVC} stop
do
echo "Trying to stop ${NET_SVC} again in 2 seconds..."
sleep 2s
done
# stop ivpn service if existing (update) or skip if not existing (fresh install)
if sudo rc-update add ivpn-service | grep 'already installed'; then
echo 'service exists, stopping the service and proceeding with upgrade...'
while ! sudo rc-service ivpn-service stop
do
echo "Trying to stop the ivpn-service again in 2 seconds..."
sleep 2s
done
else
echo 'service does not exist, proceeding with fresh install...'
fi
# install service (daemon)
sudo install -Dm755 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/scripts/_out_bin/ivpn-service "${SVC_BIN_LOCATION}"
# install necessary files for daemon
sudo install -Dm700 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/etc/client.down "${PROGRAM_FILES_LOCATION}/client.down"
sudo install -Dm700 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/etc/client.up "${PROGRAM_FILES_LOCATION}/client.up"
sudo install -Dm700 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/etc/firewall.sh "${PROGRAM_FILES_LOCATION}/firewall.sh"
sudo install -Dm700 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/etc/splittun.sh "${PROGRAM_FILES_LOCATION}/splittun.sh"
sudo install -Dm600 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/etc/servers.json "${PROGRAM_FILES_LOCATION}/servers.json"
sudo install -Dm400 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/etc/ca.crt "${PROGRAM_FILES_LOCATION}/ca.crt"
sudo install -Dm400 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/etc/ta.key "${PROGRAM_FILES_LOCATION}/ta.key"
#install wireguard and obfs4proxy files
sudo install -Dm755 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/_deps/wireguard-tools_inst/wg-quick "${PROGRAM_FILES_LOCATION_MISC}/wireguard-tools/wg-quick"
sudo install -Dm755 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/_deps/wireguard-tools_inst/wg "${PROGRAM_FILES_LOCATION_MISC}/wireguard-tools/wg"
sudo install -Dm755 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/_deps/obfs4proxy_inst/obfs4proxy "${PROGRAM_FILES_LOCATION_MISC}/obfsproxy/obfs4proxy"
# install DNS Crypt related files
sudo install -Dm755 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/_deps/dnscryptproxy_inst/dnscrypt-proxy "${PROGRAM_FILES_LOCATION_MISC}/dnscrypt-proxy/dnscrypt-proxy"
sudo install -Dm400 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/etc/dnscrypt-proxy-template.toml "${PROGRAM_FILES_LOCATION}/dnscrypt-proxy-template.toml"
# KEM and V2Ray
sudo install -Dm755 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/_deps/kem-helper/kem-helper-bin/kem-helper "${PROGRAM_FILES_LOCATION_MISC}/kem/kem-helper"
sudo install -Dm755 -g root -o root ${WORKING_DIR}/desktop-app/daemon/References/Linux/_deps/v2ray_inst/v2ray "${PROGRAM_FILES_LOCATION_MISC}/v2ray/v2ray"
# install the CLI
sudo install -Dm755 -g root -o root ${WORKING_DIR}/desktop-app/cli/References/Linux/_out_bin/ivpn "${CLI_BIN_LOCATION}"
# create init script for OpenRC
cat > ${WORKING_DIR}/ivpn-service.init << EOF
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
command=${SVC_BIN_LOCATION}
command_args=
command_background=true
description="Daemon for IVPN"
pidfile=/var/run/ivpn.pid
start_post() {
echo "Turning on firewall post service start..."
while ! ivpn firewall -on
do
echo "trying firewall again in 2 seconds..."
sleep 2s
done
}
EOF
# install script
sudo install -Dm755 ${WORKING_DIR}/ivpn-service.init /etc/init.d/ivpn-service
# add service script to inits (so ivpn service will startup when the computer starts)
sudo rc-update add ivpn-service default
# start service
sudo rc-service ivpn-service start
# turn on firewall with CLI (technically should already be turned on with the init script "start_post()" function )
ivpn firewall -on
# turn on network again. Whatever service manages your network
sudo rc-service ${NET_SVC} start
# stop echo-ing each command
set -x
echo "login to your account now and/or connect to your favorite server"
info: the script above requires paths modifications (since we moved projects to monorepo)
info: the script above requires paths modifications (since we moved projects to monorepo)
I've recently been working on my Artix all day yesterday and today, new installation of the OS mostly. I will post a fresh-install script and a newer update script later today, with updated notes as well
updated
Many thanks, @GentlemansKiller !
Hello, I quickly wrote an script for OpenRC (Gentoo, Artix)
/etc/init.d/ivpn
#!/usr/bin/openrc-run
supervisor="supervise-daemon"
description="The IVPN daemon"
command="/usr/bin/ivpn-service"
command_args=""
depend() {
need localmount
use dns
provide vpn
}
then just use
/etc/init.d/ivpn start
Saw the update today that requires manual installation wg and obfs4 files. Updated the script according and tested
Congrats on Multi-hop for wireguard! IVPN continues to show me why they are The Best.
Hey, an Artix user here.
I'm using the s6 init system, and would be happy to help as well. My current solution is to just let Sway start ivpn-service
. Alternatively start it in your ~/.profile
or ~/.zprofile
.
Thank you @theanonymousexyz
updated for split tunneling
SysVinit: https://forum.mxlinux.org/viewtopic.php?t=70011
"OK, they do within their install scripts a suboptimal check whether the OS was booted with systemd by using this shell code:
$ [ -d "/lib/systemd/system/" -o -d "/usr/lib/systemd/system" ] && silent which systemctl
This fails in MX Linux to detect systemd is not running.
The ultimate test would be to check whether the directory /run/systemd/system/
exists. Which is done by systemd-internal
function sd_booted
. See https://www.freedesktop.org/software/systemd/man/sd_booted.html
To fix the ivpn installer properly, they should replace the line above with, within their respective package installer scripts by this:
$ [ -d /run/systemd/system ]
Now, to manually and temporarily fix the installation for ivpn when booted with SysVinit could be achieved by this, for example:
Create temporary helper which-script before installing , with the intention that the check which systemctl
fails by doing this:
Note: This is only temporary!
Rename /usr/bin/which
to /usr/bin/which.real
Create temporary which-helper script
$ cat <<'EOF' | sudo tee /usr/bin/which && sudo chmod +x /usr/bin/which
#!/bin/sh
[ x"$1" != x"systemctl" ] && exec /usr/bin/which.real "$@"
EOF
ivpn
package and afterwards run this to make service start at boot:$ sudo update-rc.d ivpn-service remove
sudo update-rc.d ivpn-service defaults
$ sudo service ivpn-service start
sudo service ivpn-service status
$ sudo mv /usr/bin/which.real /usr/bin/which
hey @jordan-ivpn or @stenya maybe one of you can help me with this when you get some time :)
So right now I'm running 3.8.7
and I've decided to finally stop being lazy and upgrade, to 3.9.32
The script I ran to update is the same as at the top of this issue, except with 3.9.32
as the version variable instead of the old one.
After that, I'm actually able to connect to the internet like normal through DNS/browser and pinging an IP, even though when i issue an ivpn connect
command, it gives this output:
Connecting...
Disconnecting...
Error: failed to connect: connection error: failed to set manual DNS: DNS error: exit status 1
But yet im still able to connect to the internet normally as usual.
Additionally, if I run the ivpn
command to get the status, I get this output:
VPN : DISCONNECTED
Split Tunnel : Disabled
Firewall : Enabled
Allow LAN : true
Allow IVPN servers : true
It's very strange. Even though it technically works fine, I'd like to fix this if possible. For now I'll keep running 3.8.7
Btw, one additional unrelated thing: I saw in the AUR script, that the permission for the ivpn-service binary was changed from Dm755
to Dm644
. When I changed that in my own script, i was getting permissions erorrs for the service binary, so i had to change back to Dm755
🤷🏻
@GentlemansKiller According to your report, I see that the VPN connection failed because IVPN was not successful to configure DNS for the connection. Can you, please, try to enable old-style DNS management functionality in app settings or using CLI? Please, refer for details: https://github.com/ivpn/desktop-app/issues/191#issuecomment-1202098540 https://github.com/ivpn/desktop-app/issues/191#issuecomment-1215119056
okay i posted a comment a few minutes ago but I actually figured it out now. However simple the fix was, basically all i did was turn the firewall off, connect, then turn it back on. Works fine now. Not sure why that was a problem since I'm allowing IVPN servers through the firewall, but yeah, lol
@GentlemansKiller Hey bro I'm kind of a newb, I just switched to Artix Linux with OpenRC and I ran your script and had an issue. I'd really appreciate any help you can give. I'll attach a screenshot of what it was -- rc-service connmand does not exist
@tonyevans75 at the top of the script i put this note:
# - Edit the environment variables to be sure they are all correct. For example make sure you're using the proper service for network (maybe you have NetworkManager or connmand)
So you likely you have NetworkManager instead
@GentlemansKiller thanks man that worked. I was able to login and connect to a vpn server. There's 1 last thing I'm trying to do, is it possible to install the gui version too? I tried doing: yay -S ivpn-ui but it's not working before running the script I was able to install ivpn-ui just fine, but the problem then was that the daemon wasn't working. now the daemon and everything is working but i can't get the gui version.
@tonyevans75 I don't actually run it with the GUI.. just the command line I recommend to just install it from the AUR, it will do it all for you https://aur.archlinux.org/packages/ivpn-ui
@GentlemansKiller that's what I did originally but I got an error saying the daemon wasn't working and that i needed to turn on the ivpn service, but there was no such service to enable. i pulled up a list of all available services and nothing relating to ivpn was on there. Your script made ivpn work, but now I don't know how to use the gui with it.
@tonyevans75 probably because the GUI is looking for a systemd service rather than a running binary, that's my only guess. by the way, in OpenRC, these are the commands to list the services
#list all running services
rc-status
#list all services
rc-status --servicelist
#check if IVPN daemon is running
rc-status | grep ivpn
@GentlemansKiller Yea I used all 3 of those to try to find anything relating to ivpn that I could enable, but I found nothing. So is the IVPN GUI just impossible then on my system? I don't want to move away from Artix or OpenRC for this.
@stenya You may or may not be able to answer, don't know if you work on the UI, but when the UI checks for the daemon, does it try to look for a binary that's running? or does it query the systemd services?
@tonyevans75 I know it's a pain, it was for me too, but i recommend to just go with it. It's not difficult to use once you get used to it. you can also create aliases in your bashrc (google how to do it). That way you can just type something like vpn
or whatever your alias is and hit enter, and it will correspond to some single-hop or multi-hop command you've predefined.
Generally running linux means you need to use cmd line from time to time anyway, so it will be good practice. Otherwise i dont really have much else sorry bro :/
@GentlemansKiller it's all good man, your script got ivpn to work when nothing else did. i was looking for a solution for hours. so thanks a lot for making it bro.
@tonyevans75 not a problem man <3 im really happy it helped you just now updated the script to 3.9.45 as well, so you can test that also if you like. It works for me
@GentlemansKiller do i have to run the entire script again or is there a shortcut ivpn -update type of command i can run?
@tonyevans75 the script is for first-time install and also updating. i just changed the version variable and ran it again. I also keep that post up to date in case it needs changes
@GentlemansKiller ok cool, i just updated :) btw do you know what i need to do when i try to connect like this: ivpn connect seattle and it tells me it couldn't connect because there was more than one server found? i tried: ivpn connect seattle1, seattle-1, etc. but none worked.
@tonyevans75 run ivpn connect -h
to show all the things you can do with the connect
subcomannd. you'll find your answer :)
@GentlemansKiller ok cool, i just updated :) btw do you know what i need to do when i try to connect like this: ivpn connect seattle and it tells me it couldn't connect because there was more than one server found? i tried: ivpn connect seattle1, seattle-1, etc. but none worked.
Try to add -any
option. E.g. ivpn connect -any ....
@stenya You may or may not be able to answer, don't know if you work on the UI, but when the UI checks for the daemon, does it try to look for a binary that's running? or does it query the systemd services?
@tonyevans75 @GentlemansKiller hi, gentlemen.
The IVPN GUI app does not check the daemon/service availability at all. It just tries to connect to it using data from /opt/ivpn/mutable/
folder.
The ivpn-ui
package from AUR has a dependency on ivpn
package.
I only can suppose: when you install ivpn-ui
the official ivpn
package from AUR was tried to install automatically and failed for some reason. So, the GUI failed to install too.
If the described suggestion is true, I see two possible workarounds here:
1) Download and modify AUR build scripts of 'ivpn-ui' package (just remove line depends=('ivpn>=3.9.32')
from PKGBUILD file)
https://aur.archlinux.org/packages/ivpn-ui
And then install it from modified scripts manually.
https://averagelinuxuser.com/install-aur-manually-helpers/
2) Install 'ivpn-ui' package from AUR (ivpn
will be installed too). And then perform your special configuration for service.
I'm trying to uninstall IVPN (the one I got from the script), so I can install the ui version first, but I'm not sure how to uninstall IVPN pacman -R ivpn, pacman -R ivpn-ui, yay -R ivpn, etc. are not working to remove it
@tonyevans75 there's no need to try and revert anything that my script does. @stenya thanks :) I installed the UI package manually to see if it would work and it did
Tony, Do these steps
mkdir -p ~/ivpn
# make a directory for the workcd ~/ivpn
# go into itgit clone https://aur.archlinux.org/ivpn-ui.git
# clone the install filescd ivpn-ui
# go into the folderdepends=('ivpn>=3.9.32')
just like Stenya said, and save the filemakepkg -i
# build the app. the -i
says to also install after buildingI did all this myself and it works flawlessly.
Hi ! I was wondering if openRC support was planned to be added officially (without the need to run an external script) in the medium/near future ? I am aware that the instructions posted in this issue make ivpn work with openRC but it's always more convenient to have an official support (especially when updates might break compatibility)
Thanks in advance !
@FrenchGithubUser hey Thomas.
Basically this would involve getting an AUR package submitted (for pacman/arch-based users at least)
The package would look like this: https://aur.archlinux.org/packages/mullvad-openrc https://github.com/voj343/mullvad-openrc
Seems pretty simple enough.
@stenya Stenya, I've not actually ever submitted an AUR package before, but if I went about submitting and going through the motions, would you review it and give the o-kay on it? I could maintain it (instead of this script :P )
@GentlemansKiller thanks for your answer.
Yea that would be great ! And better than maintaining a script in a github issue I think. Please let us know when you submit it !
Hi @GentlemansKiller
This is a good idea. Yes, I will try to review and test it.
P.S. Please, let me know the package name you choose, before submitting it to AUR.
Hi ! I was wondering how much time (approximately) it would take to get the AUR package ready.
@FrenchGithubUser Hey Thomas, sorry for the late reply. I do want to maintain this potential AUR package, but some bs came up for me personally.. Once I'm at a place with some personal life stuff that I can be sure that I can maintain it properly, I will get it together. I just want to be sure it's done right and consistently.
For now I'd just say use the script, it works really well, I've used it dozens of times on fresh installs and on updates.
I have the email thread for this issue pinned in my email inbox too :) So it's important to me too since I'd also be using it personally.
Unless stenya decides he wants to maintain before I can get myself together. Like I said, I just wanna be sure that I can be consistent <3
Hey! I just read through all of this, thank you very much for your hard work! Isn't a runit-version of the script out there? Sadly it seems to be for like all init systems except the one I use lol If someone could make it or help me in making it I'd be super grateful!
@niels0n not sure.. but im sure it wouldn't be too hard to just modify my own. Just replace the OpenRC stuff with Runit commands
I'm trying to adapt it (I'm on void) but I have problems anyway with the service (ERROR: Unable to connect to service: please, ensure IVPN daemon is running (connection-info not exists)
), unfortunately I'm not good enough.
If someone could know how to do it or have a way to install and use ivpn on runit/void please let me know. Thank you!
@stenya hey stenya, I was about to upgrade to 3.10.14. In the PKGBUILD I notice a couple env variables:
IVPN_BUILD_SKIP_GLIBC_VER_CHECK=true
IVPN_BUILD_CAN_SKIP_DOWNLOAD_SERVERS=true
I added the first glibc one to my script at the top with my other variables, and still it is asking me if I want to use the new glibc. Any thoughts? See at the bottom.
Also, what is this second one for, about downloading servers?
======================================================
============== Compiling IVPN CLI ====================
======================================================
Version:
Date : 2023-03-30
Commit : 535aad5e096471348b0ee59a6e9ff1953a3d66b4
[!] GLIBC version '2.37' is greater than reqired '2.31'
[!] Compiling with the new GLIBC version will not allow the program to start on systems with the old GLIBC.
[ ] (you can define env var 'IVPN_BUILD_SKIP_GLIBC_VER_CHECK' to skip this check
[?] Do you want to continue? [y\n] (N - default):
@GentlemansKiller
Also, what is this second one for, about downloading servers?
If there was an issue accessing the servers file, the build would fail. The IVPN_BUILD_CAN_SKIP_DOWNLOAD_SERVERS
variable prevents the failure:
(Linux) Build fails from AUR if servers.json cannot be retrived https://github.com/ivpn/desktop-app/issues/242
@GentlemansKiller The variable must be visible to the IVPN build script. It needs to be defined in your environment or in a manner similar to its usage in PKGBUILD:
$ IVPN_BUILD_SKIP_GLIBC_VER_CHECK=true <your-script>
Feature request
Description
As I hope the engineers at IVPN are aware of, the systemd init system that has been widely adopted by most Linux distros has caused huge concerns among the privacy community. There are already many distros that are centered specifically around not using systemd, which is considered a bloated, inefficient system, that loads pre-compiled blobs that are not open-source. There are many many resources online that expose the flaws of this init system that pushed onto everyone without any choice in the matter. https://thehackernews.com/2019/01/linux-systemd-exploit.html https://suckless.org/sucks/systemd/ http://judecnelson.blogspot.com/2014/09/systemd-biggest-fallacies.html https://chiefio.wordpress.com/2016/05/18/systemd-it-keeps-getting-worse/ http://without-systemd.org/wiki/index.php/Arguments_against_systemd https://www.theregister.co.uk/2019/01/31/systemd_exploit/
Some of the biggest distros that are designed to not use it are the Debian-based Devuan (my friend uses with OpenRC), and the Arch-based Artix (i use, with OpenRC init) https://artixlinux.org/index.php https://devuan.org/
So my request is that for the sake of privacy, which I'm happy that IVPN has shown so far that they are truly concerned for, that other init systems be considered for the IVPN linux app
Some notable ones are OpenRC and s6. I could also help you guys test both of these init systems, especially OpenRC, since I use it every day.
Currently I'm running IVPN on my OpenRC Artix distro with a python implementation of systemd, to get around this restriction, but honestly this defeats my goal of complete privacy, since I'm using a system that has shady code to run my vpn service.
Please let me know what your thoughts are. As I said, I would love to help test this, since it benefits me directly.
Describe the solution you'd like
Solution is described above
Describe alternatives you've considered
workaround currently described above