Hi I need to create a script to update a cisco ASA firewall in a backup site. During the day admins modify the configuration on the main site and I need to update de backup site. So I should be able to take the configuration file from the main site, parse it, change the IP's and apply the differences to the backup site. The backup site is a copy of the main site but has different IP address namespace. The thing is that ASA has 3 kinds of settings:
in one line like
where I have to change the IP address that I need to map it so 172.20.20.125 became 172.10.10.125
access-list outside_access_in extended permit tcp any host 172.20.20.1
+25 eq www
access-list outside_access_in extended permit tcp any host 172.20.20.1
+25 eq smtp
several lines with a head
where there is a space in front of every statement and I have to change again de IP
interface GigabitEthernet0/1
nameif inside
security-level 100
ip address 172.20.0.1 255.255.0.0
ospf network point-to-point non-broadcast
several lines with multiple level of indentation
where IP address has to change according to the backup site
username prod_9847776 attributes
service-type remote-access
webvpn
url-list value _10.1.5.20_allow
Which would be the best way to treat this entries to compare the configuration from one site to the other and get the differences that has to be modified before being applied on the second site?
I can't just compare two files line by line, I need to compare in a way by block or something I can't get up with now and I kindly ask your enlightenment.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.