Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:configure_access_restrictions_on_directories [2018/04/07 23:18] billdozor [Setup Directory and SELinux] |
linux_wiki:configure_access_restrictions_on_directories [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 12: | Line 12: | ||
* server1.example.com (192.168.1.150) -> Perform all connectivity tests from here | * server1.example.com (192.168.1.150) -> Perform all connectivity tests from here | ||
* server2.example.com (192.168.1.151) -> Install Apache Web Server here | * server2.example.com (192.168.1.151) -> Install Apache Web Server here | ||
+ | |||
+ | **Previous Sections Completed** | ||
+ | * [[linux_wiki: | ||
+ | * Except leave listening on port 80/tcp | ||
+ | * [[linux_wiki: | ||
---- | ---- | ||
Line 27: | Line 32: | ||
ErrorLog logs/ | ErrorLog logs/ | ||
CustomLog logs/ | CustomLog logs/ | ||
+ | | ||
+ | < | ||
+ | Options None | ||
+ | AllowOverride None | ||
+ | Require all granted | ||
+ | </ | ||
</ | </ | ||
</ | </ | ||
Line 68: | Line 79: | ||
\\ | \\ | ||
- | Create a private file | + | Create a private |
<code bash> | <code bash> | ||
- | echo "This is for certain people only." > / | + | echo "This is for certain people |
</ | </ | ||
Line 88: | Line 99: | ||
restorecon -Rv / | restorecon -Rv / | ||
</ | </ | ||
+ | * Reminder: man semanage-fcontext | ||
===== Restrict Access ===== | ===== Restrict Access ===== | ||
- | Change document root | + | **Help**: Available if you installed ' |
- | <code bash> | + | |
- | vim /etc/httpd/conf/httpd.conf | + | |
- | + | ||
- | DocumentRoot "/var" | + | |
- | </ | + | |
\\ | \\ | ||
- | Allow an " | + | Create password |
<code bash> | <code bash> | ||
- | < | + | htpasswd -c /etc/httpd/conf/userdb user1 |
- | AllowOverride AuthConfig | + | |
- | </Directory> | + | |
</ | </ | ||
+ | * Prompted for a password | ||
\\ | \\ | ||
- | Create htaccess | + | Edit the vhosts.conf |
- | <code bash> | + | <code bash>vim /etc/httpd/ |
- | vim /var/user1dir/.htaccess | + | |
- | AuthType Basic | + | < |
- | AuthName " | + | |
- | AuthUserFile "/ | + | |
- | Require user valid-user | + | # |
- | </code> | + | |
- | \\ | + | |
- | Create password for the user | + | |
- | <code bash> | + | |
- | htpasswd -c /etc/httpd/conf/ | + | |
- | </code> | + | |
- | * Prompted for a password | + | </Directory> |
- | + | </VirtualHost> | |
- | \\ | + | |
- | Change permissions on the userdb file | + | |
- | <code bash> | + | |
- | chown : | + | |
- | chmod 640 /etc/httpd/ | + | |
</ | </ | ||
Line 140: | Line 139: | ||
Visit restricted directory | Visit restricted directory | ||
<code bash> | <code bash> | ||
- | elinks http://testsite.example.com/ | + | elinks http://redsite.example.com/ |
</ | </ | ||
* elinks may need to be installed first (yum install elinks) | * elinks may need to be installed first (yum install elinks) |