Import csv to blacklist

bdiepeveen

New Member
Oct 26, 2018
3
4
3
35
Hello,

Recently started to test out Proxmox to decide if we want to switch from current software.
We have created and export of our blacklist and wish to import this into Proxmox.

I know where and how to do so manually from the GUI
As far as i can see i have to add them one at a time instead of having the option to import from csv(or excel ect) or multi line option.

My question is how can i import over 1000 adresses in one go ?

Kind regards,
Ben
 
  • Like
Reactions: Patmo.de
You may followup here: #1

I'm unsure, if a solution has been found yet, but you may be able to import into postgresql directly once you found the correct table and format. Maybe @killmasta93 was yet able to find out how or you may get additional help from him, get it sorted out with him or maybe also one of the proxmox team members will help out. You may add a feature request at bugfix.proxmox.com to get this option integrated in future versions or may provide code by yourself to get it integrated directly.
 
You may followup here: #1

I'm unsure, if a solution has been found yet, but you may be able to import into postgresql directly once you found the correct table and format. Maybe @killmasta93 was yet able to find out how or you may get additional help from him, get it sorted out with him or maybe also one of the proxmox team members will help out. You may add a feature request at bugfix.proxmox.com to get this option integrated in future versions or may provide code by yourself to get it integrated directly.

Will do so (seems like a handy feature to have if you are migrating ;))

After some tinkering we have found a way to import our list using cmdlets on the back end instead of the GUI.

Thanks for the reply though.

Side note :
We used the following to get out export in Proxmox.

On the console :
Code:
# while read line;do pmgsh create /config/ruledb/who/3/email --email "$line" ; done < FileName.txt
 
@bdiepeveen

Thanks for the post, as for the command would the email on the txt file go email per line or a space?
and where would the txt file be located?
Thank you
 
Hi,

emails goes per line.
The file can be located everywhere on your filesystem, replace "FileName.txt" with your "/path/to/file.txt"

Greetz
 
  • Like
Reactions: bdiepeveen
@bdiepeveen

Thanks for the post, as for the command would the email on the txt file go email per line or a space?
and where would the txt file be located?
Thank you

This
Hi,

emails goes per line.
The file can be located everywhere on your filesystem, replace "FileName.txt" with your "/path/to/file.txt"

Greetz

How i did it was create the .txt file on the back-end
Code:
# vi FileName.txt
and then copy past my list into the created file , save and use with above mentioned code
 
  • Like
Reactions: killmasta93
So i tried adding from a list and it seems that im getting this error any ideas?

Code:
root@pmg:~# while read line;do pmgsh create /config/ruledb/who/ --email "$line" ; done < /root/blacklist.txt
Unknown option: email
400 unable to parse option
create config/ruledb/who --name <string> [OPTIONS]
Unknown option: email
400 unable to parse option
create config/ruledb/who --name <string> [OPTIONS]
Unknown option: email
400 unable to parse option
create config/ruledb/who --name <string> [OPTIONS]

Thank you
 
Hi,

looks like you want to create a new 'who' group with that command "pmgsh create /config/ruledb/who/".

To be sure to push email to the blacklist and not to the whitelist, please execute the command "pmgsh get /config/ruledb/who" - output should be something like this:
Code:
[
   {
      "id" : 2,
      "info" : "Global blacklist",
      "name" : "Blacklist"
   },
   {
      "id" : 3,
      "info" : "Global whitelist",
      "name" : "Whitelist"
   }
]

The id for blacklist is 2, so the command should be:
Code:
while read line;do pmgsh create /config/ruledb/who/2/email --email "$line" ; done < /root/blacklist.txt

If your blacklist id is not 2 then adjust the command based on your blacklist id.

Greetz
 
Hi,

looks like you want to create a new 'who' group with that command "pmgsh create /config/ruledb/who/".

To be sure to push email to the blacklist and not to the whitelist, please execute the command "pmgsh get /config/ruledb/who" - output should be something like this:
Code:
[
   {
      "id" : 2,
      "info" : "Global blacklist",
      "name" : "Blacklist"
   },
   {
      "id" : 3,
      "info" : "Global whitelist",
      "name" : "Whitelist"
   }
]

The id for blacklist is 2, so the command should be:
Code:
while read line;do pmgsh create /config/ruledb/who/2/email --email "$line" ; done < /root/blacklist.txt

If your blacklist id is not 2 then adjust the command based on your blacklist id.

Greetz

Hello @fluxX04
thank for your sharing about ur solution about that.

i have problem like this :

i have txt file with name "coba.txt" with file in attachment.

after that i upload file "coba.txt" on directory "/source/coba.txt" , i command like this :
while read line;do pmgsh create /config/ruledb/who/2/email --email "$line" ; done < /source/coba.txt

and then i have error :
400 Parameter verification failed.
email: invalid format - value does not look like a valid email address


create config/ruledb/who/2/email --email <string> [OPTIONS]

Thanks

CLOSED with solution : https://forum.proxmox.com/threads/bulk-add-users-whitelist-blacklist-entries-with-file-txt.104559/ thankyou
 

Attachments

  • coba.txt
    48 bytes · Views: 28
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!