cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1107
Views
0
Helpful
7
Replies

Script for rcptaccess automation

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

7 Replies 7

kluu_ironport
Level 2
Level 2

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

Hi kluu,

I will check this. Thanks!
Nobody has already do this? :(

Regards,

Alexandre

We are using expect to daily import an alias tables and it's working fine

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
Level 2
Level 2

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

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
Level 1
Level 1

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: