Bulk import firewall-cmd into zone

Post Reply
sbonnett
Posts: 229
Joined: Thu Oct 01, 2009 4:49 pm

Bulk import firewall-cmd into zone

Post by sbonnett » Tue Mar 26, 2019 9:20 pm

** import file **
1.2.3.4/32
103.100.0.0/16



** script file **

##!/bin/bash
file=/path to file/filename.txt
while IFS= read -r line
do
echo $line
firewall-cmd --permanent --zone=ZONE YOU WANT (eg: drop) --add-source=${line::-1}
done < "$file"

Post Reply