A simple bash
script designed for i3blocks
that tells you whether UFW (a Linux firewall) is active or not.
You will need to create a file in sudoers.d
so that your user can execute sudo ufw status
without entering their password.
In /etc/sudoers.d/ufwstatus
:
Cmnd_Alias UFWSTATUS = /usr/sbin/ufw status
%group ALL=NOPASSWD: UFWSTATUS
where group
is any group your user belongs to. Depending on the system configuration it can be users
, your username, sudo
, wheel
or something else.
In ~/.config/i3blocks/config
:
[ufw]
command=<path/to/script>/i3blocks-ufw.sh
interval=60 # You can set a lower interval but it will use more CPU
#SHOW_INACTIVE=true
#SHOW_ACTIVE=false
#COLORIZE=false # It seems formatting doesn't work in i3blocks
#BOLDEN=false # but you can still set it to true for e.g. Polybar
#COL_GOOD='\033[0;0;32m'
#COL_BAD='\033[0;31m'
#MSG_ACTIVE="$COL_GOOD$BOLD UFW ON$NA"
#MSG_INACTIVE="$COL_BAD$BOLD UFW OFF!$NA"
For guidelines on how to contribute please refer to CONTRIBUTING.md. Please keep in mind that all pull/merge requests should be submitted to the GitLab repo, since repos on e.g. GitHub are just mirrors.
This project is licensed under the GPL-3.0-or-later.