Automate Firewall

General discussions about Automagic and automation in general

Moderator: Martin

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Automate Firewall

Post by simon_magus101 » 18 Sep 2017 12:50

Is there any Firewall app that can be controlled by Automagic? The idea is to control Internet access for certain apps depending on time.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Automate Firewall

Post by Desmanto » 18 Sep 2017 16:14

Maybe you can use adguard, don't with current version. But the older version can be controlled using intent
viewtopic.php?f=5&t=4166

You can choose to block everything, so the same as blocking the app from accessing the network.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Automate Firewall

Post by Martin » 18 Sep 2017 19:57

Adding a very simple firewall feature is something that's on my todo-list. The feature will only allow to block data access of an entire app so you will not be able to block access to certain servers for a browser to block ads etc.

Regards,
Martin

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: Automate Firewall

Post by simon_magus101 » 19 Sep 2017 13:14

Desmanto wrote:Maybe you can use adguard, don't with current version. But the older version can be controlled using intent
viewtopic.php?f=5&t=4166

You can choose to block everything, so the same as blocking the app from accessing the network.
I don't want to block everything. Only specific apps, and only at certain time. For example, I may do internet browsing late at night but I don't want to be interrupted my messaging App.

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: Automate Firewall

Post by simon_magus101 » 19 Sep 2017 13:40

That is exactly what I need Martin. It would be nice to have that feature in the next update.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Automate Firewall

Post by Desmanto » 19 Sep 2017 13:58

simon_magus101 wrote: I don't want to block everything. Only specific apps, and only at certain time. For example, I may do internet browsing late at night but I don't want to be interrupted my messaging App.
The block is for single app only, but I haven't tested it out. The concept is usually done via local VPN server. All apps need to go thru this local vpn and the vpn will determine which app can pass thru it. But hosting vpn server will drain more battery, even though it is local. As it filter all traffic. If it is going to be implemented, I wish there are granular control to the server, such as we can extract the domain/url that the app request, can choose to let it pass, block or redirect it to another url or even combine with HTTP request server to show message such as "This is blocked domain".
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: Automate Firewall

Post by simon_magus101 » 20 Sep 2017 08:21

Is there a way run shell script from Automagic, like ".sh" file ? If yes then there might be a way to manipulate the IPtables.

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: Automate Firewall

Post by simon_magus101 » 20 Sep 2017 10:41

Execute Root command works. I can now automate my Firewall settings, with help from Droidwall.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Automate Firewall

Post by Desmanto » 20 Sep 2017 17:02

simon_magus101 wrote:Is there a way run shell script from Automagic, like ".sh" file ? If yes then there might be a way to manipulate the IPtables.
Yes. Just use the same action execute command or execute root command if it needs root. Put all your proper bash/shell script in sh file. Save it somewhere. I think some script need to be put on /data/local or /system/bin and changed permission to be executeable before can be executed from terminal. But simple one can maybe just put at /sdcard/.

Let say your .sh file is located at /sdcard/Automagic/shell/iptable.sh. At Action execute command, put the command

Code: Select all

sh /sdcard/Automagic/shell/iptable.sh
sh is the command to execute .sh file as shell script.
simon_magus101 wrote:Execute Root command works. I can now automate my Firewall settings, with help from Droidwall.
What command do you use there? Droidwall is so old already, older than my first android :D I am curious if it still works.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: Automate Firewall

Post by simon_magus101 » 20 Sep 2017 22:48

Droidwall is a good Firewall. I have tried changing to others but always come back to Droidwall. What it lacks is multiple profile settings.

Droidwall produce a file droidwall.sh after you click apply settings. Copy this file. AM can run this script as one of your Firewall profiles. Don't forget to kill Droidwall first before running the script. Then you can change Droidwall settings again for a different profile, save the file with a different file name as another Firewall profile. And so on. You can make as many Firewall profiles as you like.

Post Reply