Open a terminal. First of all, you must obtain superuser rights:
Using Ubuntu Linux as an example:
user@ubuntu:~$ sudo bash
[sudo] password for user:
root@ubuntu:/home/user# id
uid=0(root) gid=0(root) groups=0(root)
root@ubuntu:/home/user#
For example, Fedora Linux:
[user@localhost ~]$ su
Password:
[root@localhost user]# id
uid=0(root) gid=0(root) groups=0(root)
[root@localhost user]#
Download scripts using your browser: /files/vpnfirewall /files/deactivate_vpn_firewall and save them in the "Downloads" (wget, curl, etc. will not work, due to Anti-DDoS tools on the service website):
root@ubuntu:/home/user# cd Downloads/
root@ubuntu:/home/user/Downloads# ls -la
total 20
drwxr-xr-x 2 user user 4096 May 26 02:09 .
drwxr-xr-x 17 user user 4096 May 26 02:08 ..
-rw-rw-r-- 1 user user 210 May 26 02:09 deactivate_vpn_firewall
-rw-rw-r-- 1 user user 6370 May 26 02:08 vpnfirewall
root@ubuntu:/home/user/Downloads#
Change the owner of the scripts to "root", enable their execution and transfer to /usr/bin:
Now, you can activate the traffic leak blocking script with the "vpnfirewall" command. Run the command with superuser privileges:
root@ubuntu:/home/user/Downloads# vpnfirewall
OK: Loading VPN firewall...
OK: The firewall should not show any messages,
OK: besides output beginning with prefix OK:...
OK: VPN firewall loaded.
root@ubuntu:/home/user/Downloads#
After applying the new iptables rules set by the script, connections will be allowed only to VPN servers of the MultiVPN service. All other connections will be blocked:
root@ubuntu:/home/user/Downloads# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
From 10.0.2.15 icmp_seq=1 Packet filtered
ping: sendmsg: Operation not permitted
^C
--- 1.1.1.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
root@ubuntu:/home/user/Downloads# wget https://1.1.1.1
--2020-05-26 02:19:20-- https://1.1.1.1/
Connecting to 1.1.1.1:443... failed: No route to host.
root@ubuntu:/home/user/Downloads#
Now, you can connect to the VPN server. In the event of a disconnection, switching between servers, etc. the script will block traffic leaks.
If you need to allow Internet connections again without using a VPN, run the "deactivate_vpn_firewall" command with superuser privileges: