Forum

Best way to use AccessList with multiple subnets

stilleperson
4 April 2011, 19:46
Hi Hugo,

thanks for this great webserver!

I want to use the option AccessList in order to keep away people from unwanted ip ranges.

Unfortunately I have to allow more than one to five ip ranges. So the common syntax below seems to be not very maintainable with many entries:
AccessList = (allow|deny|pwd) <ip-address>[/netmask][, (allow|deny|pwd) <ip-address>[/netmask], ...]


Using the set option could help. But I have questions:

Is it possible to use this? (I guess not)
set allowed_ip_ranges = 194.25/16, 80.128/11, 212.227/16, ...
AccessList = allow allowed_ip_ranges, deny 0.0.0.0/32


Is it possible to use a comment at the end of a valid line?
set local_net = 192.168.0.0/32 #my local network


Is it possible to use the shorten CIDR notation as shown in the first code fragment? Maybe it should be mention in the manual.

Exists any limition for the AccessList line?

Can I use multiple AccessList lines?

Thanks in advance.

-----
Hiawatha version: 7.4
Operating System: FreeBSD 8.2-RELEASE-p0
stilleperson
4 April 2011, 20:09
Don't use the notation style like this 192.168/32. Please use the full CIDR notation 192.168.0.0/32.
stilleperson
4 April 2011, 20:12
Surprise, surprise, comments at the end of line is allowed.
Hugo Leisink
4 April 2011, 21:31
Variables via 'set' should be used like this:
set ip_range_1 = x.x.x.x/mask
set ip_range_2 = x.x.x.x/mask
set ip_range_3 = x.x.x.x/mask
AccessList = allow ip_range_1, allow ip_range_2, allow ip_range_3 deny all


Short CIDR notations are not supported.

Limitations for the AccessList line... well... it's limited to the described format

Yes, you can use multiple AccessList lines.
stilleperson
4 April 2011, 22:06
Hi Hugo,

your solution fits for me. In the meantime I chose this way (because was documented).
Again, thank you a lot.
This topic has been closed.