You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
QA/tests/p_httpd/httpd_basic_auth.sh

28 lines
756 B

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