Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
BillyMays
New Contributor

Scripting source address change

I have a few hundred firewalls in place.  I am changing ISPs.  I need to add my new IPs, add them to an IP group, and update a pre-existing policy's source address to the name of my new IP group. I do not always know the name of the old IP group.  I do not know which policy will need to be modified by it's number.  My current plan is to push out a scipt via FortiCloud to make these changes.

 

I do know a specific set of characters that will be in the srcaddress field (IP Group) of the policy.  The policy is for port forwarding to a specific internal IP that will be variable.  I was wondering if it were possible to edit the srcaddress field by doing something like 'show firewall policy | grep -i abc' to pull the field I need to update and then run set srcaddress or rename in such a way that it would replace the policy's source address with my new IP group name.  

 

Alternatively, can I append IPs to an unknown IP group name that I can character match?  If so, how? 

 

I know this won't work but this is the sort of logic I'm going for.

 

configure firewall policy

rename srcaddress='grep -i abc' "New IP group"

 

Open to other suggestions outside of this.  Goal is to mass update firewalls with new WAN IP information and update an existing VIP/port forward policy of unknown name/number.  Existing IP group name is variable but could be character matched via grep.  

1 REPLY 1
BillyMays
New Contributor

Simplified:  If I have an address group on all my devices with a name that contains "VPN" (e.g. VPN2, VPNHome, etc.) can I use the CLI to look through all of the address groups, single out the items with VPN in the name (grep - i vpn) and change it to something new?

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors