For plain text files you can specify regex that will be used to select lines that will be imported. For example, if you want to treat as comments lines that starts with the '#' character, then you need to specify regex like ^[^#].*, so only strings that don't start with '#' will be included into list
Sorry to jump in the middle here, but this raises an question for me: Are the comments available as a property to the rest of the gateway? My use case would be something like a custom black-list of malicious IP addresses with the comment being the date that specific entry was added to the list (or maybe it is the source of the blacklist, e.g. "Snort alert", or "ETPRO Reputation Feed". Being able to include the comment in the Block page and/or the access.log would be pretty cool. I looked around and couldn't find anything for this.
I think that you can do this with new Map Type that is available in 7.3.1 release. But comments should be on the same line as the data - so we could use regex to capture data & comments... You need to do following steps:
- Create ExtLists settings with your data source (web service), specify URL, and also specify regular expression, like this: ^(.*?)(?:\s*#\s*(.*?))?$ - this exprassion shouldl have 2 capture groups so it could be used as a map
- Create rule that should block destination IP. There are 2 possibilities here:
- you can block by checking is DestinationIP-string is in Map, with something like: Map.HasKey(ExtLists.StringMap<your settings>(params...), IP.ToString(URL.DestinationIP))
- or you can check is Destination IP in IP List that is also fetched by ExtLists filter with ExtLists.IPList<your settings>(params...) property - this maybe slightly faster from performance point of view, but will require additional fetch of data from external service.
- If rule matches, then block request with custom block page that contains comment about given IP (see below)
File with data should have following form:
10.149.114.44 # bad site
22.214.171.124 # another bad site
Block page template can contain expression: Map.GetStringValue(ExtLists.StringMap<your settings>(params...), IP.ToString(URL.Destination.IP)) - this will fetch comment for given IP address
I attached file with rules & block page, so you can play with this approach