Hi,
Say I'd like to restrict access to a virtual host to multiple IP ranges. How to do that? The Perl regex syntax style doesn't work, and i don't want loose restrictions like 10.*
The code below works for a single range:
$HTTP["host"] == "adm.example.org" {
$HTTP["remoteip"] != "10.0.0.0/28" {
url.access-deny = ( "" )
}
}
Thanks in advance.
From serverfault
weeheavy
-
$HTTP["host"] == "adm.example.org" { $HTTP["remoteip"] != "1.2.3.4|5.6.7.8|9.10.11.12" { url.access-deny = ( "" ) } }And so forth
weeheavy : This may work with IP addresses but doesn't with IP ranges. If I do it like that, access is allowed from everywhere.From freedom_is_chaos -
$HTTP["remoteip"] !~ "192.168.2.*|192.168.0.*|10.8.9.*" { url.access-deny = ( "" ) } or to include for the 192.168.0.0 network only this range: 192.168.0.180 - 192.168.0.188 $HTTP["remoteip"] !~ "192.168.2.*|192.168.0.18[0-8]|10.8.9.*" { url.access-deny = ( "" ) }weeheavy : This is it! I used your first configuration, this does what I need. Thanks very much.From evermind -
Any way to split the line up if you get a ton of IP addresses? Seems that this doesn't work:
$HTTP["remoteip"] != "1.2.3.4|\ 4.5.6.7|\ 8.8.8.8"weeheavy : Sorry I don't know how one should write this. As all IPs are in one string I would have thought too that it works the way you wrote.
0 comments:
Post a Comment