Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

How do I view an ASM policy's id and configure a Whitelisted IP using ASM's Rest API?

I was asked if there is a method to configure an ASM whitelist across several policies. To my knowledge, this is not possible from a global context so my recommendation was to use ASM's Rest API to make the updates. If you have your own method, please share.

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Using the following command I was able to obtain the ASM policy ID.

curl -sk -u admin:password https://10.1.1.246/mgmt/tm/asm/policies/?\$select=name | sed 's/,/\'$'\n/g'

Image Text

I then used the following command to add a whitelisted IP address to my policy. I also added an additional option to never block this IP address.

curl -sk -u admin:password -X POST https://10.1.1.246/mgmt/tm/asm/policies/WeU3fPiQ8jJJBJslbue6mQ/whitelist-ips -H "Content-Type: application/json" -d '{"ipAddress":"10.17.196.12" , "ipMask":"255.255.255.255" , "blockRequests":"never"}'

Image Text

0