Score:0

Update UFW rules from a text file

cn flag

I have a list of ip's (almost 55K) that i want to deny from a text file. I would like a script to read from the text file and update the ufw status.

Is there anything like that?

At present I am doing this

while read line; do sudo ufw insert 1 deny from $line to any; done < filename.txt

This takes a hell long of a time. Would a script be faster?

pe flag
no ufw wont add rules faster. You would better use **iptables**, **ipset** and a blacklist
Sriram Rayadurg avatar
cn flag
Is there a script that i can use for that? Adding 55k ip's to iptables is a pain.
Wayne Vosberg avatar
bd flag
Are the IPs random or could you group them (i.e. 10.0.0.0/17 for 10.0.0.1 thru 10.0.127.255)?
Doug Smythies avatar
gn flag
As previously mentioned, use iptables and ipset. see [here](https://askubuntu.com/questions/1358471/block-1-4-million-ip-addresses-on-vps/1358607#1358607).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.