Script for rcptaccess automation

Unanswered Question
Jun 9th, 2008

Hi,

I'm new on this forum and hope you could help me for this.

My problem is to import regularly a list of email address or domains to the RAT. It would be easy with an import but I need to specify the "Bypass LDAP accept" option to "yes".

It would be something like that:

-------------------
listenerconfig
edit
1
rcptaccess
new
"email or domain from a file" <= must be taken from a file with more than 5000 lines!
1
n
n
y <= "bypass ldap accept option"


commit
automated import

---------------------
So my issue is to find a way to make a loop for all the lines in my file containing all the entries. I am really not familiar with unix tools sorry.
"Read the first line, do the script, read the second line, do the scirpt..." until the end of the file.

Hope I explained it well.
Thanks for your help.

Regards,

Alexandre

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
kluu_ironport Tue, 06/10/2008 - 23:14

The Unix "expect" program is very good for setting up automated tasks that you normally do manually.

Here are some useful links the give more detail on Expect and examples.

http://expect.nist.gov/

http://en.wikipedia.org/wiki/Expect

Hi, 

I'm new on this forum and hope you could help me for this.

My problem is to import regularly a list of email address or domains to the RAT. It would be easy with an import but I need to specify the "Bypass LDAP accept" option to "yes".

It would be something like that:

-------------------
listenerconfig
edit
1
rcptaccess
new
"email or domain from a file" <= must be taken from a file with more than 5000 lines!
1
n
n
y <= "bypass ldap accept option"


commit
automated import

---------------------
So my issue is to find a way to make a loop for all the lines in my file containing all the entries. I am really not familiar with unix tools sorry.
"Read the first line, do the script, read the second line, do the scirpt..." until the end of the file.

Hope I explained it well.
Thanks for your help.

Regards,

Alexandre
avandevelde_ironport Wed, 06/11/2008 - 15:08

I know it's working but my problem is the fact that I need to import line by line the file and not in a whole.

kluu_ironport Wed, 06/11/2008 - 16:01

Can you use the Expect script upload the file to the "configuration" directory and issue the "import" command that is found underneath the listenerconfig menu options from the CLI.




[]> rcptaccess

Recipient Access Table

There are currently 3 recipients.
Default Access: REJECT

Choose the operation you want to perform:
- NEW - Create a new entry.
- EDIT - Modify an entry.
- DELETE - Remove an entry.
- PRINT - Display all entries.
- IMPORT - Import a table from a file.
- EXPORT - Export the table to a file.
- CLEAR - Remove all entries.
[]> import

Enter the name of the file on machine "company.com" to import:
[]>


What you can do is export your current "rcptaccess" entries and save it to a local computer from the GUI. Then open the file up with Wordpad and examine how it is structured.

Here is an example taken from a test box:


# File exported by the GUI at 20080611T074855
company.com ACCEPT bypass_ldap_accept=0
other-companies.com ACCEPT bypass_ldap_accept=1
ALL REJECT bypass_ldap_accept=0


So, I would create the file first, using either Unix shell scripts or Perl scripts, then set up Expect to perform the upload of the file into the "configuration" directory and then use Expect again to perform the "import" and "commit" changes actions.




Hi, 

I'm new on this forum and hope you could help me for this.

My problem is to import regularly a list of email address or domains to the RAT. It would be easy with an import but I need to specify the "Bypass LDAP accept" option to "yes".

It would be something like that:

-------------------
listenerconfig
edit
1
rcptaccess
new
"email or domain from a file" <= must be taken from a file with more than 5000 lines!
1
n
n
y <= "bypass ldap accept option"


commit
automated import

---------------------
So my issue is to find a way to make a loop for all the lines in my file containing all the entries. I am really not familiar with unix tools sorry.
"Read the first line, do the script, read the second line, do the scirpt..." until the end of the file.

Hope I explained it well.
Thanks for your help.

Regards,

Alexandre
avandevelde_ironport Wed, 06/11/2008 - 16:07

Ho!
This format is allowed in the file ?
other-companies.com ACCEPT bypass_ldap_accept=1


If it is, it's fine for me :)

I need to test it.

Thanks!

martinc8306 Sat, 06/14/2008 - 18:27

Expect would probably be a cleaner way of doing it but if you keen to try it this way you can do the following with a for each loop;

for i in `cat domainlistfile`; do echo listenerconfig edit IncomingMail( This would be your inbound listener) rcptaccess new $i --action accept --bypass_la Yes;done

From the output you can literally just copy and paste the output to your IronPort appliance via the CLI.

Actions

This Discussion