Security and Cryptography
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationSecurity and Cryptography

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 2nd, 2000, 03:45 AM
visions visions is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 10 visions User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi am trying to authenticate with a username database but I also want to allow users from certain domains access with authentication.
I can do one or the other but I can not figure out both. Here is what I have so far.

AuthUserFile /www/cgi-bin/.htpasswd
AuthGroupFile /dev/null
AuthName "Member's Area"
AuthType Basic
require valid-user

<Limit GET PUT>
order allow,deny
deny from all
allow from website.com
satisfy any
</Limit>

Thanks,
Mark

Reply With Quote
  #2  
Old October 2nd, 2000, 05:55 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>I can do one or the other but I can not figure out both

Because it's impossible with mod_access. Though, it might be possible with the addition of mod_rewrite. For example:

1) Setting 1st RewriteCond to check for HTTP_REFERER, if it's within your protected dir AND another_dir JUST for "allow host" authentication, then [L] it.
2) 2nd RewriteCond:
RewriteCond %{REMOTE_HOST} ^website.com$
3) Set the RewriteRule to redirect to the /another_dir just for the allow host authentication.

If you apply to the above logic, a visitor who comes from website.com and access to your private directory will be redirected to http://www.yourdomain.com/another_dir for authentication.
Next, set an index.cgi or index.php to redirect this visitor to http://www.yourdomain.com/private, this way, the HTTP_REFERER for such visitor matches the 1st RewriteCond, so he won't get authentication again. This only occurs the first time when he is being redirected from /another_dir to /private, once he is in /private, his HTTP_REFERER also matches the 1st RewriteCond and allow in.
Note, http://www.yourdomain.com/another_dir is also a protected directory, so visitors not coming from website.com won't be able to login.

I haven't tested this so it may or may not work but it's the logic I can come up with at this moment.

Anyway, visitors coming from website.com SHOULD ALLOW IN WITHOUT AUTHENTICATION according to "satisfy" directive. If you insist to authenticate them, WHY NOT create a user/pass for them and dropping the "allow from" line and "satisfy" line if you really know what they are for. Or at least require them to sign up for an username from website.com to get in to your /private.

[This message has been edited by freebsd (edited October 02, 2000).]

Reply With Quote
  #3  
Old October 2nd, 2000, 02:38 PM
visions visions is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 10 visions User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am pretty new to the Unix world so this makes some sense but not very much. I am still learning is there anyway to explain this in easier terms?

Thanks,
Mark

Reply With Quote
  #4  
Old October 2nd, 2000, 04:40 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>explain this in easier terms

Your lines:

allow from website.com
satisfy any

By all means is to Allow in (from website.com) without authentication. Read here -> http://www.apache.org/docs/mod/core.html#satisfy
Visitors coming from website.com should bypass the login prompt. If they also require to authenticate, give them a user/pass.

Reply With Quote
  #5  
Old October 2nd, 2000, 07:13 PM
visions visions is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 10 visions User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi so is this what I should have? I tried it and it lets everyone in.

AuthUserFile /www//cgi-bin/globill/passwd
AuthGroupFile /dev/null
AuthName "Member's Area"
AuthType Basic
require valid-user

<Limit GET PUT>
allow from website.com
satisfy any
</Limit>

Reply With Quote
  #6  
Old October 2nd, 2000, 09:01 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>AuthUserFile /www//cgi-bin/globill/passwd

You should place passwd above your docroot. If you don't have permission to do so, you then need to add the following to your .htaccess:

<FilesMatch "^passwd$">
Order deny,allow
Deny from all
</FilesMatch>

You also don't need the <Limit> block.

Reply With Quote
  #7  
Old October 2nd, 2000, 09:10 PM
visions visions is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 10 visions User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Someone said what I want is not possible unless I make 2 seperate directories. I really need this to work. I really have no idea what I am doing. Is this right? I tried it and it lets everybody in.

# Access file
#(makes file invisible)

<FilesMatch "^passwd$">
Order deny,allow
allow from website.com
</FilesMatch>

AuthUserFile /www/cgi-bin/globill/passwd
AuthGroupFile /dev/null
AuthName "Member's Area"
AuthType Basic

Reply With Quote
  #8  
Old October 2nd, 2000, 09:33 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>Someone said what I want is not possible unless I make 2 seperate directories

Exactly as I mentioned the /another_dir is to authenticate users from website.com and redirect back to /private along with the HTTP_REFERER that matches the 1st RewriteCond to bypass the login prompt in /private.

>><FilesMatch "^passwd$">
>>Order deny,allow
>>allow from website.com
>></FilesMatch>

Don't put "allow from website.com". Why you want visitors from website.com to be able to READ your "passwd" file anyway?

Putting Deny from all prevents people from viewing your passwd file from browsers, it doesn't mean your passwd file will not get read by Apache.


Reply With Quote
  #9  
Old October 2nd, 2000, 11:16 PM
visions visions is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 10 visions User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi I don't want people to read the password file I just want certain sites to have access to the members area without authentication. website.com was just an example. What should I do?

Reply With Quote
  #10  
Old October 2nd, 2000, 11:39 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Regarding to the passwd file, as I said, do this:

<FilesMatch "^passwd$">
Order deny,allow
Deny from all
</FilesMatch>

Don't try to invent something on your own. Put this .htaccess in http://yourdomain.com/.htaccess

#http://yourdomain.com/protect/.htaccess
AuthUserFile /www/path_other_than_cgi-bin/passwd
AuthGroupFile /dev/null
AuthName "Member's Area"
AuthType Basic
Allow from website.com
Satisfy any

Reply With Quote
  #11  
Old October 3rd, 2000, 12:42 AM
visions visions is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 10 visions User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ok I created 2 files this one

<FilesMatch "^passwd$">
Order deny,allow
Deny from all
</FilesMatch>

and this one

#http://yourdomain.com/protect/.htaccess
AuthUserFile /www/path_other_than_cgi-bin/passwd
AuthGroupFile /dev/null
AuthName "Member's Area"
AuthType Basic
Allow from website.com
Satisfy any

I uploaded the 1st one to the members area and the second one to http://yourdomain.com/members/ and made sure the path was not to a cgi-bin. It seems to let everyone in, did I do this right? Thanks so much for helping.

Reply With Quote
  #12  
Old October 3rd, 2000, 01:06 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Are you sure your server has .htaccess enabled? To verify this, simply remove the bottom two lines:
Allow from website.com
Satisfy any

If it doesn't show a login prompt, too bad, htaccesss not enabled at all.

Also the line -> Allow from website.com
it's better to put the IP address of website.com or at least put a dot in before website.com as .website.com

Reply With Quote
  #13  
Old October 3rd, 2000, 01:43 AM
visions visions is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 10 visions User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi I know htaccess is active because I can make the login box appear. I did try to erase those 2 lines but it did not pop-up any login box. But I am sure htaccess is working. I also put a dot in front of the website like this .website.com What else should I try?

Thanks,
Mark

Reply With Quote
  #14  
Old October 3rd, 2000, 03:18 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>I did try to erase those 2 lines but it did not pop-up any login box

Make sure there were NO CONSECUTIVE TRIES. Once you logged in, on 2nd try, you need to close and relaunch your browser.

Reply With Quote
  #15  
Old October 3rd, 2000, 03:29 AM
visions visions is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 10 visions User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi I did close all my browser windows and tried it several times and never got a login box. I tried it in Netscape and Explorer.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationSecurity and Cryptography > Basic Autheniction & Allow Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT