LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 07-19-2014, 09:18 PM   #1
ngiw2012
LQ Newbie
 
Registered: Jun 2014
Posts: 13

Rep: Reputation: Disabled
Authenticate only some users in Apache?


we know that we can protect some pages in our apache server using authentication.

but what if I have already authenticate the users using something else and add this users to a DB, Is there a way to configure Apache to do a query to the DataBase and don't ask for credentials if it find the user in this DB, in short words can Apache authenticate only some users ( which aren't found on DB) and don't ask for authentication credentials for users that found on DB.

what I really want is to deploy single sign on, I have authenticates users using ieee802.1x and put the authenticated users in a DB, BUT I authenticate only the inside ( inside my network ) users, and I don't want apache to reauthenticate them, I want apache only to authenticate the outside users, what I have suggested is to let apache do a query to my DB and find if the users is already authenticated by ieee802.1x : If apache find the user on this DB it don't ask him for a credentials, otherwise it does
 
Old 07-20-2014, 06:52 AM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
authenticate only the inside ( inside my network ) users, and I don't want apache to reauthenticate them
I'd suggest the external users authenticate against the default Apache server using your public domain and public IP while the local users accessing over the lan using non-public IP connect to a second, virtual Apache server which does not require login to access the same resources.
 
Old 07-20-2014, 07:20 AM   #3
ngiw2012
LQ Newbie
 
Registered: Jun 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thanks for your reply, but I don't want different web pages, I want one web page

to enlight you more on my question:

I know that I can let specific IP addresses WITHOUT requiring user/password. and any other IP address SHOULD require login to gain access using this:

<Directory /var/www/files/>
Order deny,allow
Deny from all
Allow from 192.168.1.0
Satisfy Any
AuthUserFile /etc/apache2/basic.pwd
AuthName "Please enter username and password"
AuthType Basic
Require valid-user
</Directory>

but the problem is:

Imagine I have this DB (Different from the DB used for Authentication):

User IP

Mark 192.168.1.2

Mike 192.168.1.3

Karl 192.168.1.4

1- can I allow all the IP addresses stored in the DB using a configration in Apache?

2- another problem is the Authorization of the Allowed IP is lost, can Apache use this DB for Authorization, if the user is allowed to get the pages without authentication?
 
Old 07-20-2014, 07:31 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Is this an internal website, by any chance?

If so, then what you are describing here is essentially what LDAP (nee Microsoft ActiveDirectory), and Kerberos, already does: single sign-on authentication.

Furthermore, if the website is of such a nature that internal users ought to be able to have access to it using their internal company credentials alone, then I recommend that you should not expose that same website to the outside world. Instead, you should use a VPN perimeter around the whole thing ... using individually-issued digital certificates (not passwords!) to protect that outer ring.

The dual problem with "the wild and wooly web" is that neither authentication ("I trust that I know who you actually are"), nor authorization ("I trust that I know that you're entitled to do this"), can truly ever be relied-upon. When you, in an internal company network, (wisely ...) use LDAP to establish these things, you are trusting the IT infrastructure within which everything lives. Either you can do that, or you can't.

Yes, you can establish two URLs, which point to the same place, and which have two separate authentication schemes. (You can't base it on source-IP.) However, I would sternly warn you, you don't want to do that, for the reasons aforementioned.
 
Old 07-20-2014, 07:39 AM   #5
ngiw2012
LQ Newbie
 
Registered: Jun 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
so there isn't any way to Apache to authorize according to my DB? AND No Configuration to allow all the IP addresses stored in the DB?


Quote:
Originally Posted by sundialsvcs View Post

Yes, you can establish two URLs, which point to the same place, and which have two separate authentication schemes. (You can't base it on source-IP.) However, I would sternly warn you, you don't want to do that, for the reasons aforementioned.
How can I DO such a thing, Is there any useful tutorial on Apache website?
 
Old 07-20-2014, 09:08 AM   #6
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
ngiw, I think I see where you are confused...
Quote:
, but I don't want different web pages, I want one web page
The pages are resources, the servers are the mechanism by which the pages are served. Fifty servers can all serve the same page to 5,000 different users, simultaneously.
Quote:
what you are describing here is essentially what LDAP (nee Microsoft ActiveDirectory), and Kerberos, already does: single sign-on authentication.
To take sundials explanation one step further, if a user is authenticated into the domain, then a domain facing Apache server can handle those requests without additional sign-on by confirming the identity of the requester via Kerberos or LDAP An externally facing server can serve the same page without any verification of identity.
As far as I know, Apache by itself can only simulate single sign on through the use of cookies however this is inherently (extremely) insecure.
Quote:
How can I DO such a thing, Is there any useful tutorial on Apache website?
I seriously doubt it since it's such a bad idea.

Quote:
can I allow all the IP addresses stored in the DB using a configration in Apache?
No, though if the requesting IP form a discrete sub-network you can control their access to the Apache server via the firewall....

Last edited by dijetlo; 07-20-2014 at 09:16 AM.
 
  


Reply

Tags
apache authentication, apacheconf, sql



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
[SOLVED] How to authenticate users in Apache using a cookie? Felipe Linux - Server 2 04-12-2012 04:05 AM
[SOLVED] Authenticate users to Apache by host/ISP and password wej Linux - Server 3 08-13-2010 03:30 PM
Using Active Directory to authenticate Apache users kenneho Linux - Server 4 09-10-2008 06:24 AM
Apache 2 is not working right when i try to authenticate users stormrider_may Linux - Networking 2 03-01-2006 05:06 AM
how to authenticate external users but bypass prompt on local LAN users? taiwf Linux - Security 5 07-13-2005 09:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:00 AM.

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