V8.00.000.2025.06.17
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -26,6 +26,7 @@ guard_sourcing
|
||||
hardening_ufw() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
declare -r var_logfile="/root/.ciss/cdi/log/4470_hardening_ufw.log"
|
||||
declare -r var_rules="${TARGET}/etc/ufw/before6.rules"
|
||||
|
||||
chroot_logger "${TARGET}${var_logfile}"
|
||||
|
||||
@@ -76,6 +77,20 @@ hardening_ufw() {
|
||||
sed -i "/# ok icmp code for FORWARD/i \-A ufw-before-output -p icmp --icmp-type parameter-problem -j ACCEPT" "${TARGET}/etc/ufw/before.rules"
|
||||
sed -i "/# ok icmp code for FORWARD/i \-A ufw-before-output -p icmp --icmp-type echo-request -j ACCEPT" "${TARGET}/etc/ufw/before.rules"
|
||||
|
||||
|
||||
### Remove previous custom blocks (idempotent).
|
||||
sed -i "/^# BEGIN custom MLD rules/,/^# END custom MLD rules/d" "${var_rules}"
|
||||
sed -i "/^# BEGIN custom MLD OUTPUT rules/,/^# END custom MLD OUTPUT rules/d" "${var_rules}"
|
||||
|
||||
### Inbound MLD (INPUT chain) – insert before the existing echo-request rule.
|
||||
### Allows MLDv1 (130/131/132) and MLDv2 (143) to link-local multicast (ff02::/16)
|
||||
sed -i "/-A ufw6-before-input .*--icmpv6-type echo-request -j ACCEPT/i # BEGIN custom MLD rules\n-A ufw6-before-input -i ${VAR_FINAL_NIC} -p icmpv6 --icmpv6-type 130 -d ff02::/16 -j ACCEPT\n-A ufw6-before-input -i ${VAR_FINAL_NIC} -p icmpv6 --icmpv6-type 131 -d ff02::/16 -j ACCEPT\n-A ufw6-before-input -i ${VAR_FINAL_NIC} -p icmpv6 --icmpv6-type 132 -d ff02::/16 -j ACCEPT\n-A ufw6-before-input -i ${VAR_FINAL_NIC} -p icmpv6 --icmpv6-type 143 -d ff02::/16 -j ACCEPT\n# END custom MLD rules" "${var_rules}"
|
||||
|
||||
### Outbound MLD (OUTPUT chain) – insert before echo-request.
|
||||
### Useful if local daemons join multicast groups, and you want clean logs.
|
||||
sed -i "/-A ufw6-before-output .*--icmpv6-type echo-request -j ACCEPT/i # BEGIN custom MLD OUTPUT rules\n-A ufw6-before-output -o ${VAR_FINAL_NIC} -p icmpv6 --icmpv6-type 131 -d ff02::/16 -j ACCEPT\n-A ufw6-before-output -o ${VAR_FINAL_NIC} -p icmpv6 --icmpv6-type 143 -d ff02::/16 -j ACCEPT\n# END custom MLD OUTPUT rules" "${var_rules}"
|
||||
|
||||
|
||||
chroot_script "${TARGET}" "echo 'y' | ufw enable 2>&1"
|
||||
|
||||
chroot_script "${TARGET}" "ufw status verbose >> ${var_logfile}"
|
||||
|
||||
Reference in New Issue
Block a user