Forum Discussion
JeffRW
Apr 05, 2018Altocumulus
Possible to export/import ASM policies via a script?
Is it possible to possible to export ASM policies from one F5 and then import the ASM policies into another F5 via a script?
I'd like to export the ASM policies from our prod F5 and then import ...
Filip_Mikulík
Apr 09, 2018Altostratus
Hi, yes that is possible:
- export ASM policy: save asm policy [policy name] xml-file [file name]
- copy XML files to DR
- import ASM policy: load asm policy [policy name] file [file name]
- (optional) active imported policy: modify asm policy [policy name] active
if you want to save all policies from box you can use something like:
for i in $(tmsh list asm policy \/\*\/\* one-line | cut -d " " -f 3); do echo ${i}; tmsh save asm policy ${i} xml-file ${i}.xml; done
than copy it and import it by:
for i in $(find . -name '*xml); do echo ${i}; tmsh load asm $(echo ${i} | sed 's/\.xml//') xml-file ${i}; tmsh modify asm policy $(echo ${i} | sed 's/\.xml//') enable; done
This should be functional if you don't use partitions. If you do, you will have to create the directories with partition names first, or try to substitute '/' character in policy names...
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects