LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-07-2017, 02:26 AM   #1
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361
Blog Entries: 3

Rep: Reputation: 48
Lighttpd: access to IPs and subnets


Hello all.
This seems not to work for me http://redmine.lighttpd.net/boards/2/topics/1279

I tried different variants but all the time the subnet is being blocked (and I'm trying to allow):

like this (single remoteip inside single url). But I get "403 Forbidden" to any src ip:
Code:
$HTTP["url"] =~ "^/adm/" {
$HTTP["remoteip"] != "33.222.0.0/16" {
		url.access-deny = ( "" )
	}
}

$HTTP["url"] =~ "^/adm/" {
$HTTP["remoteip"] !~ "^(75\.209\.116\.4|79\.31\.34\.79)$" {
    url.access-deny = ( "" )
}
}
like this ( several remoteip inside single url). In this case access is also blocked for all:
Code:
$HTTP["url"] =~ "^/adm/" {
	$HTTP["remoteip"] !~ "^(75\.209\.116\.4|79\.31\.34\.79)$" {
		url.access-deny = ("")
	}

	$HTTP["remoteip"] != "33.222.0.0/16" {
		url.access-deny = ( "" )
	}


}
The construction like (with "x"ses as wildcards) this still blocks subnet 33.222.0.0/16 whis is not what I want:
Code:
$HTTP["url"] =~ "^/zabbix/" {
	$HTTP["remoteip"] !~ "^(75\.209\.116\.4|79\.31\.34\.79|33\.222\.x\.x)$" {
		url.access-deny = ("")
	}
}
Does anybody use Lighttpd? How do you restrict access to certain URL - both for fixed IP addresses and subnets simultaneously ?

Thank you.

Last edited by Lexus45; 10-07-2017 at 02:51 AM.
 
Old 10-12-2017, 08:07 AM   #2
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361

Original Poster
Blog Entries: 3

Rep: Reputation: 48
This is the solution
https://redmine.lighttpd.net/boards/...2#message-7672

Code:
$HTTP["url"] =~ "^/adm/" {
    $HTTP["remoteip"] == "33.222.0.0/16" {
    }
    else $HTTP["remoteip"] == "75.209.116.4" {
    }
    else $HTTP["remoteip"] == "79.31.34.79" {
    }
    else $HTTP["remoteip"] != "" {  # (dummy match everything)
        url.access-deny = ( "" )
    }
}
 
1 members found this post helpful.
  


Reply

Tags
lighttpd



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPs- and FDQNs on localhost with subnets on MINT 17.3? Leoncito Linux - Networking 3 08-15-2017 09:04 AM
[SOLVED] Munin plugin for Lighttpd and Apache in one machine with two IPs yoachan Linux - Server 1 05-06-2011 05:40 AM
lighttpd confguration access from internet speedsrfr Linux - Server 9 04-17-2009 03:33 AM
Can I Ban Certain IPs or Subnets davidstvz Linux - Newbie 8 08-16-2008 09:34 AM
Machines on different subnets / static IPs natv Linux - Networking 4 02-04-2007 02:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration