LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-13-2017, 01:00 PM   #1
vinodh machi
LQ Newbie
 
Registered: May 2017
Posts: 6

Rep: Reputation: 0
Are you able to Restrict Access through your Configuration Files in apache web server??


Thanks in Advance for best reply
 
Old 05-13-2017, 01:05 PM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,295
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
The short answer is "yes". The longer answer is that it helps to have a little more information such as which distro, including version, and which version of Apache2 you are running. As well, it is easier to read with the question in the body of the post. But those aside, have you looked at the Apache2 documentation for basic authentication and authorization? Be sure to have HTTPS (HTTP over TLS) set up first.

How complex do you want things to get? You can tie authorization to LDAP, for example.
 
Old 05-13-2017, 03:03 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
https://www.linuxquestions.org/quest...6/#post5710187
 
Old 05-13-2017, 04:42 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
https://opensource.com/life/16/10/ho...ical-questions
 
Old 05-13-2017, 05:13 PM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
file some-file
Order allow,deny
Deny from all
Allow from good.guy.ip.1
in the site.conf
More than one allow from is allowed and accepts /CIDR notations

Access to the site, yes, it can and should be enforced in the site.conf apache2 system file.
.htaccess is kludgy and a resource killer.

directives in the site.conf are global and are only read once, not every hit, like .htaccess.

No one should have access to the apache2 configuration files themselves. and if installed correctly,
there is nothing to "do" in /etc/apache2/ except
Code:
cd /etc/apache2/
find ! -user root
find ! -group root
see if it's installed correctly from the owner:permissions point of view.

.htaccess tricks and tips...Part I
.htaccess tricks and tips... Part II
Discusses some good stuff and every where it says "htaccess", you have to or should want to utilize it in the site.conf

Here's a practical example for securing Wordpress's wp-login.php area of any site using that software,
Code:
# END WordPress
<Files wp-login.php>
order deny,allow
deny from all
allow from good.guy.ip.1
Allow from good.guy.ip.2
</Files>
Think home, office or office, garage, the "real world" would get locked out here.
good.guy.ip.1 and good.guy.ip.2 would not.

So test it
Code:
write "echo LQRocks" > /var/www/html/secret.file
and in the site.conf implement
Code:
# END WordPress
<Files secret.file>
order deny,allow
deny from all
allow from your.ip
</Files>
then issue
Code:
apache2ctl graceful
If the site is on the internet, go and test it.
You should get a 403 "error". and that is correct.

If it's some else, let us know.

All this is the same info as on .htaccess tricks and tips...Part I which I have nothing to do with except read there. (Glad it's still up, too!)

Peace.

Last edited by Habitual; 05-13-2017 at 05:15 PM.
 
Old 05-13-2017, 05:21 PM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
We will go over these in more depth in the sections below, but for now, here's a simple checklist of items to look into:
 
1 members found this post helpful.
  


Reply



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
Need suggestion for best Apache web server configuration Ram Babu Bhatt Linux - Server 5 07-21-2011 03:07 PM
Fedora Server> Apache Web> World Press ---- Configuration Troubles kreside Linux - Software 1 11-02-2008 11:32 AM
Apache Restrict ALL access to file from web blizunt7 Linux - Security 2 08-15-2007 02:08 PM
PHP configuration with apache web server vikrambhimbar Linux - Software 4 12-17-2005 04:04 AM
Apache Web Server - access from the www vesta41 Linux - Software 8 01-07-2004 06:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:38 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