2025-02-05 13:57:07 +01:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
2025-02-14 08:45:37 +01:00
|
|
|
# exit if not running as root. Because other user don't have privileges to start/stop firewalld.
|
|
|
|
[[ "${UID}" -eq "0" ]] || exit 0
|
|
|
|
|
2025-02-05 13:57:07 +01:00
|
|
|
if [[ "${PAM_USER}" =~ -exam$ ]]; then
|
|
|
|
systemctl start firewalld.service
|
|
|
|
elif ! (users | grep -q -- "-exam"); then
|
|
|
|
systemctl stop firewalld.service
|
|
|
|
fi
|