UFW (uncomplicated firewall) Start On Boot - Mobian (working)
#1
Hey Ya'll,

Not entirely sure if others are wanting this, but thought I'd share my fix on this workaround if you been trying to get this firewall to start on system startup on mobian (fix will be similar to almost any Distro actually).

This is for anyone that wanted to use the UFW - uncomplicated firewall service vs iptables. 

Useful background knowledge:
https://www.freedesktop.org/wiki/Softwar...orkTarget/

Assuming you have already installed ufw:

edit the /lib/systemd/system/ufw.service
Code:
sudo nano /lib/systemd/system/ufw.service

Comment or delete out any existing BEFORE and/or AFTER lines under [unit] and add the new conditions - should look similar to this:
Code:
[Unit]
Description=Uncomplicated firewall
Documentation=man:ufw(8)
DefaultDependencies=no
#Before=network.target
Before=network-pre.target
Wants=network-pre.target

............

Make sure you write out, save, and exit. What this does is makes sure the firewall starts BEFORE any network configuration. Which is the point of a firewall Smile

Add ufw.service to system startup

Code:
sudo systemctl enable ufw.service

Now also make sure ufw.conf has start on boot enabled (enabling just this without the above had no affect on startup). Edit the ufw.conf

Code:
sudo nano /etc/ufw/ufw.conf

Code:
ENABLED=yes

Write out and save and exit.

Reboot your phone. Once it is rebooted, head to terminal and check the firewall status:

Code:
sudo ufw status


Should be active on startup without having to manually enable it. This fix worked for me, hopefully it works for others - for anyone that also wants to use the ufw
  Reply
#2
(02-28-2021, 01:15 AM)theD0cto Wrote: Should be active on startup without having to manually enable it. This fix worked for me, hopefully it works for others - for anyone that also wants to use the ufw

Could you clarify what "fix" you actually have? (besides adapting the systemd unit to start the firewall potentially a little earlier). I installed ufw with "sudo apt install ufw" enabled it with "sudo ufw enable" and it simply gets run on start. So what was the issue before?
  Reply
#3
(02-28-2021, 05:42 PM)spaetz Wrote:
(02-28-2021, 01:15 AM)theD0cto Wrote: Should be active on startup without having to manually enable it. This fix worked for me, hopefully it works for others - for anyone that also wants to use the ufw

Could you clarify what "fix" you actually have? (besides adapting the systemd unit to start the firewall potentially a little earlier). I installed ufw with "sudo apt install ufw" enabled it with "sudo ufw enable" and it simply gets run on start. So what was the issue before?

"sudo ufw enable" just enables the firewall to be active when you call it. It does not apply to automatically enabling the firewall on system reboot/startup. The ufw.conf was suppose to address this by editing the file to enable it on startup. systemctl enable adds the service to startup, but does not activate the firewall. 

This is meant for:

- Adding ufw services to startup and automatically activating the firewall on system reboot so you do not have to "sudo ufw enable" through terminal anytime you had to reboot your phone.

If you google - ufw does not automatically start up on system reboot, you will see numerous instances of it not automatically starting even after editing the ufw.conf and adding it to startup services via systemctl.

So if you restart your phone, and it displays active after you enter "sudo ufw status"(without entering enable), cool, if not, and you want it to startup automatically and be active whenever you reboot your phone then this applies to you.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  New camera app gnome-snapshot working on trixie? vusra 0 34 02-25-2025, 04:50 PM
Last Post: vusra
  bookworm vs trixie discussion for mobian in pinephone regular. zetabeta 45 11,867 02-22-2025, 06:51 AM
Last Post: anonymous
  mobian phosh on screen keyboard not popping up for Chromium/Electron apps grump_fiddle_reinstall 1 284 01-15-2025, 08:08 PM
Last Post: Kevin Kofler
  How to use QR codes on Mobian Sid(unstable) Pinephone Pro biketool 1 304 01-02-2025, 12:47 PM
Last Post: zetabeta
  Upgrade to Mobian (Trixie) Staging biketool 13 1,531 12-29-2024, 10:35 AM
Last Post: biketool
  Mobian Bulleyes aberrio 0 333 12-16-2024, 08:27 AM
Last Post: aberrio
  Mobian, Suspend, and Audio Playback biketool 0 361 12-11-2024, 12:56 AM
Last Post: biketool
  how to update mobian over tor vusra 14 10,400 12-04-2024, 07:01 PM
Last Post: vusra
  atinout binaries for mobian/debian? NeutralGrey 4 1,932 10-31-2024, 04:16 AM
Last Post: astylethargic
  boot gets stuck shortly after disk decryption vortex 9 6,614 09-11-2024, 05:40 AM
Last Post: normangraves

Forum Jump:


Users browsing this thread: 1 Guest(s)