Blame tests/p_httpd/httpd_basic_auth.sh
|
root |
2bfd68 |
#!/bin/sh
|
|
root |
2bfd68 |
# Author: Athmane Madjoudj <athmanem@gmail.com>
|
|
root |
2bfd68 |
|
|
root |
2bfd68 |
t_Log "Running $0 - httpd basic authentication test."
|
|
root |
2bfd68 |
|
|
root |
2bfd68 |
cat > /etc/httpd/conf.d/dir-test-basic-auth.conf <
|
|
root |
2bfd68 |
Alias /basic_auth_test /var/www/html/basic_auth_test
|
|
root |
2bfd68 |
<Directory "/var/www/html/basic_auth_test">
|
|
root |
2bfd68 |
AuthType Basic
|
|
root |
2bfd68 |
AuthName "Test"
|
|
root |
2bfd68 |
AuthUserFile /etc/httpd/htpasswd
|
|
root |
2bfd68 |
require user test
|
|
root |
2bfd68 |
</Directory>
|
|
root |
2bfd68 |
EOF
|
|
root |
2bfd68 |
|
|
root |
2bfd68 |
htpasswd -c -b /etc/httpd/htpasswd test test
|
|
root |
2bfd68 |
mkdir -p /var/www/html/basic_auth_test
|
|
root |
2bfd68 |
echo "Basic authentication Test Page" > /var/www/html/basic_auth_test/index.html
|
|
root |
2bfd68 |
t_ServiceControl httpd reload
|
|
root |
2bfd68 |
curl -s -u test:test http://localhost/basic_auth_test/ | grep 'Basic authentication Test Page' > /dev/null 2>&1
|
|
root |
2bfd68 |
|
|
root |
2bfd68 |
t_CheckExitStatus $?
|