linutil/core/tabs/security/firewall-baselines.sh
Adam Perkowski 216f1a4836
Restructure the crates (#549)
* BIG CHANGES

* core metadata

* Added readme.md to the package

* Moved the crate back to tui

Co-authored-by: Liam <lj3954@users.noreply.github.com>

---------

Co-authored-by: Liam <lj3954@users.noreply.github.com>
2024-09-19 19:09:53 -05:00

50 lines
1.3 KiB
Bash

#!/bin/sh -e
. ../common-script.sh
installPkg() {
printf "%b\n" "${YELLOW}Installing UFW...${RC}"
if ! command_exists ufw; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm ufw
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y ufw
;;
esac
else
printf "%b\n" "${GREEN}UFW is already installed${RC}"
fi
}
configureUFW() {
printf "%b\n" "${YELLOW}Using Chris Titus Recommended Firewall Rules${RC}"
printf "%b\n" "${YELLOW}Disabling UFW${RC}"
"$ESCALATION_TOOL" ufw disable
printf "%b\n" "${YELLOW}Limiting port 22/tcp (UFW)${RC}"
"$ESCALATION_TOOL" ufw limit 22/tcp
printf "%b\n" "${YELLOW}Allowing port 80/tcp (UFW)${RC}"
"$ESCALATION_TOOL" ufw allow 80/tcp
printf "%b\n" "${YELLO}Allowing port 443/tcp (UFW)${RC}"
"$ESCALATION_TOOL" ufw allow 443/tcp
printf "%b\n" "${YELLOW}Denying Incoming Packets by Default(UFW)${RC}"
"$ESCALATION_TOOL" ufw default deny incoming
printf "%b\n" "${YELLOW}Allowing Outcoming Packets by Default(UFW)${RC}"
"$ESCALATION_TOOL" ufw default allow outgoing
"$ESCALATION_TOOL" ufw enable
printf "%b\n" "${GREEN}Enabled Firewall with Baselines!${RC}"
}
checkEnv
checkEscalationTool
installPkg
configureUFW