LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 01-26-2006, 03:08 AM   #1
Gibsonist
Member
 
Registered: Mar 2004
Location: Meersburg (GER)
Distribution: Cygwin,RH 7.2 7.3, SuSe 6.4 8.2 9.1,TinyLinux, Debian Sarge, Knoppix 3.*, Knoppicilin, Knoppix STD
Posts: 191

Rep: Reputation: 30
Selective Apache2.0 access control


Hi,

I need to configure a dir on apache s.t. if I access it from a certain host a.b.c.d it asks a pass word, yet if I access it from the rest of the network a.b.c.0/24 it simply goes through.

Does anybody know if there is such a way and if yes, how. I would use different path but they have to be the same.

thanks
 
Old 01-26-2006, 04:45 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 9,608

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
You must edit your httpd.conf and change the AlloOveride for that dir to All:
<Directory "/path/to/special/dir">
...
AllowOveride All
...
</Directory>
Then in that special dir create a .htaccess file with the following:
Code:
AuthName        "Restricted"
AuthType        Basic
AuthUserFile    /path/to/htpasswd-users
Order           allow,deny
Allow           from all
Deny            from xx.xx.xx.xx
require         user    username
Satisfy         any
Where xx.xx.xx.xx is the IP you want to ask for password authentication and username is the username for the person of that IP.
Of course you must use htpasswd to create or edit the pasword file in /path/to/htpasswd-users for the said user.
 
Old 01-26-2006, 04:58 AM   #3
Gibsonist
Member
 
Registered: Mar 2004
Location: Meersburg (GER)
Distribution: Cygwin,RH 7.2 7.3, SuSe 6.4 8.2 9.1,TinyLinux, Debian Sarge, Knoppix 3.*, Knoppicilin, Knoppix STD
Posts: 191

Original Poster
Rep: Reputation: 30
Efraisto

OK so far
my problem goes a step deeper the path I need to secure is not a directory but a ScriptAlias to a cgi - running the wikis.

In that case I need to use it in a <Location ...> if I'm not mistaken
ie
Code:
<Location>
AuthName        "Restricted"
AuthType        Basic
AuthUserFile    /path/to/htpasswd-users
Order           allow,deny
Allow           from all
Deny            from xx.xx.xx.xx
require         user    username
Satisfy         any
</Location>

Last edited by Gibsonist; 01-26-2006 at 05:01 AM.
 
Old 01-26-2006, 05:34 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 9,608

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
Well I don't know what exactly does the <Location> directive because I've never used it, but since AllowOveride does not work inside <Location></Location>, if you want to control the access to some cgi script, I guess that you can use:
Code:
AuthName        "Restricted"
AuthType        Basic
AuthUserFile    /path/to/htpasswd-users
<Limit POST PUT>
Order           allow,deny
Allow           from all
Deny            from xx.xx.xx.xx
require         user    username
Satisfy         any
</Limit>
 
Old 01-26-2006, 06:11 AM   #5
Gibsonist
Member
 
Registered: Mar 2004
Location: Meersburg (GER)
Distribution: Cygwin,RH 7.2 7.3, SuSe 6.4 8.2 9.1,TinyLinux, Debian Sarge, Knoppix 3.*, Knoppicilin, Knoppix STD
Posts: 191

Original Poster
Rep: Reputation: 30
OK - I'm a bit lost now.

I got a Wikifarm, running on our intranet (a.b.c.0\24) accessible via apache and a cgi on
wikiserver.od/wikifarm/"wikiname"

the lines in apache for this are
Code:
Alias /wiki/ /srv/wiki/htdocs/

ScriptAlias /wikifarm/wiki1/ /srv/wiki/cgi-bin/wiki.cgi/
ScriptAlias /wikifarm/wiki2/ /srv/wiki/cgi-bin/wiki.cgi/
Now the wikis - or at least one - should be accessible from the web. on machine
a.b.c.d we have apache running, proxying some requests to our intranetserver where a auth is required - using PAM.

The idea is also to protect the wikis via PAM.
I know how it works for Locations and Directories, but fail to implement it for the ScriptAliases.

Maybe I also should note that we use Rewrite rather heavily both on the gatewaymachine and on the intranet server.
 
Old 01-26-2006, 06:51 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 9,608

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
I'm lost too now.
Made a search and it came out this which refers to a wiki setup!!! The guy there uses ScriptAlias/Location and .htaccess normally, so I don't see what is you worry about.
 
Old 01-26-2006, 08:18 AM   #7
Gibsonist
Member
 
Registered: Mar 2004
Location: Meersburg (GER)
Distribution: Cygwin,RH 7.2 7.3, SuSe 6.4 8.2 9.1,TinyLinux, Debian Sarge, Knoppix 3.*, Knoppicilin, Knoppix STD
Posts: 191

Original Poster
Rep: Reputation: 30
Thanks it works now - the rewriting also messed it up a bit.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot access `/usr/local/apache2/modules/libphp5.so' gravesb Linux - Software 13 12-02-2011 02:56 AM
Can't access my apache2 webserver using external address from LAN eldoran Linux - Networking 6 10-26-2008 03:51 PM
Apache2: LAN machines cannot access website Akhran Linux - Newbie 1 10-13-2005 05:39 AM
Enabling POP3 Access for Selective Users only topcat Linux - Software 1 11-23-2004 10:31 PM
Firewall (with selective access) KETrel Linux - Security 7 10-06-2004 12:05 PM


All times are GMT -5. The time now is 05:54 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration