1

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.

weeheavy
  • 4,089
  • 1
  • 28
  • 41

2 Answers2

3
$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 = ( "" )
}
1
$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

David Rickman
  • 3,320
  • 18
  • 16
  • This may work with IP addresses but doesn't with IP ranges. If I do it like that, access is allowed from everywhere. – weeheavy May 03 '10 at 12:42