add mass whitelist by ip or domain

Jun 13, 2024
14
0
1
hi,

i used this command to add multiple email adress to the blacklist, but it only work for email adress, i'm trying to modify the command to add domains and ip adress (in two separate command i assume?)

heres the command i used for emails:

while read line;do pmgsh create /config/ruledb/who/2/email --email "$line" ; done < black.txt


thanks
 
Hi @eaglex01,

You can try with this script:
Code:
#!/bin/bash
while read line;do
    TYPE='domain'
    if [[ "$line" == *"@"* ]]; then
        TYPE='email'
    fi
    pmgsh create /config/ruledb/who/2/${TYPE} --${TYPE} "$line"
done < black.txt

PS:
For domain:
Code:
pmgsh create /config/ruledb/who/2/domain --domain example.com
For single ip address:
Code:
pmgsh create /config/ruledb/who/2/ip --ip 1.1.1.1
For network:
Code:
pmgsh create /config/ruledb/who/2/network --cidr 1.1.1.0/24
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!