cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1921
Views
5
Helpful
7
Replies

Automate mailconfig

Ronan O Connor
Level 1
Level 1

Hi there,
Is there anyway of automating the mailconfig command in order to backup your ironport configuration automatically on a regular schedule?

7 Replies 7

si_ironport
Level 1
Level 1

You can script the backup over ssh.

ssh $host saveconfig

unfortunately this wont save all the password information, but at least its better than nothing

si

jaigill
Cisco Employee
Cisco Employee

To automate 'saveconfig', create a .dat file containing the three lines:

saveconfig
y
exit

The tricky bit is that the line endings need to be single characters.

Next, create a batch file containing:

plink -t -pw ironportpw admin@yourironport.name <%1%


Finally, run the .bat file with the .dat file as argument.

Hope this helps!!

The mailconfig batchcommand actually supports reading in the yes/no answer to the password question. So you could do:


ssh ironport.mydomain.com "mailconfig me@mydomain.com 1"


The 1 at the end says to send passwords. You can actually put the 1 anywhere on the line or with multiple email addresses.

Being paranoid without knowing the math behind it I probably wouldn't do this though. I would backup the user/password information just once (it probably doesn't change all that often?) and then do normal mailconfigs. In the event that I need to restore from a disaster I can just paste in the user/password to the most recent XML file and loadconfig. This way I don't have password hashes running around the internet each day.

Since other folks are talking about saveconfig, the "1" trick also works there:


saveconfig 1

shannon.hagan
Level 1
Level 1

If you are doing ssh to do this, you should do ssh -t .



ssh ironport.mydomain.com "mailconfig me@mydomain.com 1"


Ronan O Connor
Level 1
Level 1

Thanks for your help. I'll give this a try.

Prab
Level 1
Level 1

I created a python script that will email the config of the ESA in encrypted form to a specified email address. Tested it with AsyncOS 13.0 and with Python 2.7

I have attached the python script as a ESAMailconfig.zip file. The checksum of the .zip file is provided below.

Checksum SHA256: ad95025bf83b7c8851c345379f3867cd5ddb4ded12e1f761b93d6e1bd2b2eefd

 

Steps:

 

1. Create a private and public SSH key pairs (Ref: https://www.cisco.com/c/en/us/support/docs/security/email-security-appliance/118305-technote-esa-00.html) & configure an admin user on ESA and assign the keys to it.

 

2. Copy the attached python script (ESAMailConfig.py), putty executable, SSH private key (created in step 1) in one folder or directory, as shown below:

folder.png

3. Execute the python script and provide the arguments, an example is provided below:

help.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Example below:

Command.png

 

 

 

 

You could create a batch file that executes this python script. The arguments could be specified in the batch file & the python script will get them automagically. The content of a sample batch file is shown below:

batch.jpg

 

Hope it helps!

Prab