Automate mailconfig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2007 12:52 PM
Hi there,
Is there anyway of automating the mailconfig command in order to backup your ironport configuration automatically on a regular schedule?
- Labels:
-
Email Security
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2007 10:11 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2007 09:57 PM
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!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2007 10:42 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2007 10:43 AM
Since other folks are talking about saveconfig, the "1" trick also works there:
saveconfig 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2007 06:10 PM
If you are doing ssh to do this, you should do ssh -t .
ssh ironport.mydomain.com "mailconfig me@mydomain.com 1"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2007 12:29 PM
Thanks for your help. I'll give this a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 07:28 AM - edited 01-28-2020 02:16 AM
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:
3. Execute the python script and provide the arguments, an example is provided below:
Example below:
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:
Hope it helps!
Prab
