Skip to content

Instantly share code, notes, and snippets.

@fredyr
Last active June 8, 2022 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredyr/115a7803d51b2944a8bc03b3b6e1ff8a to your computer and use it in GitHub Desktop.
Save fredyr/115a7803d51b2944a8bc03b3b6e1ff8a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
# run script with sudo
# cleanup
apt -y autoremove
# update all security patches
apt-get -y -s dist-upgrade | grep "^Inst" | \
grep -i securi | awk -F " " {'print $2'} | \
xargs apt-get install
# install firewall and antivirus
apt-get -y install ufw clamav
# force update antivirus database
# needs to stop/restart daemon to run freshclam manually
/etc/init.d/clamav-freshclam stop
freshclam
/etc/init.d/clamav-freshclam start
# firewall configuration
ufw enable
ufw logging on
# maybe too strict?
ufw default allow outgoing
ufw default deny incoming
# show versions etc
echo
echo "*** Printing software versions..."
clamscan --version
ufw version && ufw status
#
# https://askubuntu.com/questions/194/how-can-i-install-just-security-updates-from-the-command-line
# https://www.digitalocean.com/community/tutorials/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment