Import csv to blacklist

Discussion in 'Mail Gateway: Installation and configuration' started by bdiepeveen, Oct 26, 2018.

  1. bdiepeveen

    bdiepeveen New Member

    Joined:
    Oct 26, 2018
    Messages:
    3
    Likes Received:
    3
    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
     
    Patmo.de likes this.
  2. heutger

    heutger Active Member

    Joined:
    Apr 25, 2018
    Messages:
    281
    Likes Received:
    69
    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.
     
  3. bdiepeveen

    bdiepeveen New Member

    Joined:
    Oct 26, 2018
    Messages:
    3
    Likes Received:
    3
    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
    
     
    heutger likes this.
  4. killmasta93

    killmasta93 Member

    Joined:
    Aug 13, 2017
    Messages:
    223
    Likes Received:
    7
    @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
     
  5. fluxX04

    fluxX04 New Member

    Joined:
    Mar 14, 2018
    Messages:
    12
    Likes Received:
    5
    Hi,

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

    Greetz
     
    bdiepeveen likes this.
  6. bdiepeveen

    bdiepeveen New Member

    Joined:
    Oct 26, 2018
    Messages:
    3
    Likes Received:
    3
    This
    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
     
    killmasta93 likes this.
  7. killmasta93

    killmasta93 Member

    Joined:
    Aug 13, 2017
    Messages:
    223
    Likes Received:
    7
    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
     
  8. fluxX04

    fluxX04 New Member

    Joined:
    Mar 14, 2018
    Messages:
    12
    Likes Received:
    5
    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
     
    killmasta93 and bdiepeveen like this.
  9. killmasta93

    killmasta93 Member

    Joined:
    Aug 13, 2017
    Messages:
    223
    Likes Received:
    7
    Thank you that did the trick it was the ID i was missing
     
    fluxX04 likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice