Nmap scan the local machine, report any surprising open ports to syslog and shutdown the interface if needed.
The script can be installed by cloning the github repository:
$git clone https://github.com/MatthewBuchananAstley/Gpetto.git
Or via the excellent ubuntu snap software distribution system:
$snap install gpetto --devmode --edge
./gpetto
For your information: the utp port scanning is only available as the root user
Services that need to have an open port can be defined in gpetto_allowlist.conf. The line that appears in the nmap scan output can be used. For instance:
127.0.0.1 25/tcp open smtp
gpetto_allowlist.conf goes in /etc/security/gpetto_allowlist.conf
The systemd service file to have the script check the system at boot time:
gpetto.service goes in /lib/systemd/system/gpetto.service
systemctl enable gpetto
or manually create the symlink in:
cd /etc/systemd/system/default.target.wants ;
ln -s /lib/systemd/system/gpetto.service gpetto.service
gpetto v1.0.0