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:27] billdozor [Restrict Access] |
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 ===== | ||
- | Edit the vhosts.conf file and add the Directory part in the redsite virtualhost | + | **Help**: Available if you installed ' |
+ | |||
+ | \\ | ||
+ | Create password for the user | ||
+ | <code bash> | ||
+ | htpasswd -c / | ||
+ | </ | ||
+ | * Prompted for a password | ||
+ | |||
+ | \\ | ||
+ | Edit the vhosts.conf file and add this additional | ||
<code bash>vim / | <code bash>vim / | ||
+ | |||
< | < | ||
ServerName redsite.example.com | ServerName redsite.example.com | ||
DocumentRoot / | DocumentRoot / | ||
- | | + | |
- | CustomLog logs/ | + | |
< | < | ||
AuthType Basic | AuthType Basic | ||
AuthName " | AuthName " | ||
- | AuthUserFile "/ | + | AuthUserFile "/ |
Require valid-user | Require valid-user | ||
</ | </ | ||
</ | </ | ||
- | </ | ||
- | |||
- | \\ | ||
- | Create password for the user | ||
- | <code bash> | ||
- | htpasswd -c / | ||
- | </ | ||
- | * Prompted for a password | ||
- | |||
- | \\ | ||
- | Change permissions on the userdb file | ||
- | <code bash> | ||
- | chown :apache / | ||
- | chmod 640 / | ||
</ | </ | ||
Line 132: | 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) |