• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

VPN kill switch

Scheduled Pinned Locked Moved Unsolved Support
5 Posts 3 Posters 500 Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • U Offline
      ubportsuser
      last edited by ubportsuser 12 Sept 2021, 17:23 9 Dec 2021, 17:21

      Hi good people of ubports!

      I have a question regarding vpn kill switch. I run 2 scripts with a set of commands as follows:

      i use the below commands before connecting to my VPN

      sudo ufw reset
      sudo ufw deny incoming
      sudo ufw deny forward
      sudo ufw allow outgoing
      sudo ufw enable
      

      And is in a file called unfirewall.sh

      I use the below commands after connecting to the vpn so that there is no leak.

      sudo ufw default deny incoming
      sudo ufw default deny forward
      sudo ufw default deny outgoing
      sudo ufw allow out on tun0 from any to any
      sudo ufw enable
      

      And this is in a file called ./firewall.sh

      I run ./unfirewall.sh from the terminal, connect to the vpn and run ./firewall.sh from the terminal again. My question is, is there a way to make an executable icon called "on" (for ./firewall.sh) and "off" (for ./unfirewall.sh) and put it in the app drawer so that i dont have to use the terminal to do it every time my vpn disconnects?

      D 1 Reply Last reply 9 Dec 2021, 20:19 Reply Quote 0
      • D Offline
        davedanger @ubportsuser
        last edited by 9 Dec 2021, 20:19

        @ubportsuser how do you keep the script running after you close the terminal?

        U 1 Reply Last reply 10 Dec 2021, 06:00 Reply Quote 0
        • U Offline
          ubportsuser @davedanger
          last edited by ubportsuser 12 Oct 2021, 06:08 10 Dec 2021, 06:00

          @davedanger I open the terminal> execute ./unfirewall.sh > connect to vpn via GUI> use ./firewall.sh> and then close the terminal. ufw doesnt require the terminal to be open after the commamds have been executed. Both .sh files are inside the home directory.

          i saw your post "Auto Execute Startup Scripts" just now. Here the terminal doesnt need to be kept open. Although I do get the following warnings

          WARN: /etc is group writable!
          WARN: / is world writable!
          WARN: / is group writable!
          WARN: /lib is world writable!
          WARN: /lib is group writable!
          WARN: /usr is world writable!
          WARN: /usr is group writable!
          
          

          And my ufw was enabled by default since the fist installation (OTA-19). Although in my ut tweak tools, "make image writable" can be set to read-only.

          L 1 Reply Last reply 10 Dec 2021, 10:29 Reply Quote 0
          • L Offline
            Luksus @ubportsuser
            last edited by Luksus 12 Oct 2021, 10:30 10 Dec 2021, 10:29

            @ubportsuser
            you can create *.desktop files in ~/.local/share/applications with content like this:

            [Desktop Entry]
            Type=Application
            Name=Firewall ON
            Exec=sh /home/phablet/firewall.sh
            Icon=
            

            And make it executale.
            But I don't know, how to workaround the sudo command. This won't work that way...

            @davedanger
            If you need to keep Terminal working in background, you can use the app "UT Tweak Tool" and prevent specific apps from going to sleep.

            Devices: BQ e4.5, Fairphone 2, Fairphone 3, Lenovo X605F, Pinephone, Moto Z2 Force, OnePlus5T

            D 1 Reply Last reply 10 Dec 2021, 18:44 Reply Quote 0
            • D Offline
              davedanger @Luksus
              last edited by 10 Dec 2021, 18:44

              @luksus @ubportsuser I'm a big fan of the UT Tweaks Tool, it's very handy. I've just been trying to find a way to execute scripts and keep them running without having to keep the terminal open.

              1 Reply Last reply Reply Quote 0
              4 out of 5
              • First post
                4/5
                Last post