Skip to content

tcoch/fortigate-geographic-addresses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

FortiGate - Geographic Addresses

Creating geographic addresses on FortiGate can be long if you need to declare a lot of countries. This repository aims to provide you the full list of countries supported by your FortiGate.

The full list

Full list is available at cli.txt. You can copy / paste this directly to your equipment using SSH / console access.

How to create this list

I get it, you can be suspicious. Are there any errors in this list ? Is it up to date ? Can I trust it ??

If you prefer, you can re-create it, following these steps :

Retrieve the list of supported country codes

  1. Connect to your FortiGate using console / SSH. Type in config firewall address. Then, create a new dummy object using edit "dummy object".
  2. Type in command set type geography. Then, type set country ? to see the full list of country code supported by your equipment.
  3. Copy/paste this list

Parse the list and create the CLI commands

Paste in the previous list in Notepad++ (or some other tool, but then you might have to adapt the following commands).

Use replace utility, enabling regular expressions, and replace the following expressions :

1. Create the "set country" command

Find :

(.*)\s{4}(.*)

Meaning : Something, then 4 spaces, then something else

And replace it with :

`$2\n    set country "$1"`

Meaning : Insert the content of the second (.*), go to the next line, insert 4 spaces, insert 'set country ', and insert the content of the first (.*)

2. Create the "edit" command

Find :

^(?!\s{4})(.*)$

Meaning : Something, that doesn't start with 4 spaces

And replace it with :

$edit "$1"

Meaning : Insert 'edit "', then the string you found, then close the quotation mark

3. Create the "set type geography" command

Find :

edit "(.*)"

Meaning : Something, that doesn't start with 4 spaces

And replace it with :

$edit "edit "$1"\n    set type geography"

Meaning : Keep the 'edit' string, add a new line, add four spaces, and set insert 'set type geography'

4. Add the "next" command

Find :

set country "(.*)"

Meaning : Something, that doesn't start with 4 spaces

And replace it with :

$edit "set country "$1"\nnext

Meaning : Keep the 'edit' string, add a new line, add four spaces, and set insert 'set type geography'

About

FortiGate Geographic Addresses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors