add more traps

This commit is contained in:
Louis Abel 2023-11-29 14:09:12 -07:00
parent e4955719c0
commit 81cf38ec13
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36
5 changed files with 25 additions and 13 deletions

View File

@ -1,7 +1,14 @@
#!/bin/bash
r_log "freeradius" "Test basic freeradius functionality"
function cleanup() {
cp /etc/raddb/users.backup /etc/raddb/users
rm -rf /etc/raddb/users.backup
systemctl stop radiusd.service
}
r_log "freeradius" "Test basic freeradius functionality"
r_log "freeradius" "Configure freeradius"
trap cleanup EXIT
cp /etc/raddb/users /etc/raddb/users.backup
cat >> /etc/raddb/users << EOF
rocky Cleartext-Password := "rocky"
@ -13,7 +20,3 @@ systemctl start radiusd.service
sleep 1
echo "User-Name=rocky,User-Password=rocky " | radclient -x localhost:1812 auth testing123 | grep -q 'Access-Accept'
r_checkExitStatus $?
cp /etc/raddb/users.backup /etc/raddb/users
rm -rf /etc/raddb/users.backup
systemctl stop radiusd.service

View File

@ -1,5 +1,6 @@
#!/bin/bash
r_log "git" "Test basic git clones"
trap 'rm -rf $TMPREPO' EXIT
WORKDIR=$(pwd)
TMPREPO=/var/tmp/repo

View File

@ -1,5 +1,6 @@
#!/bin/bash
r_log "httpd" "Test basic authentication functionality"
trap "rm /etc/httpd/conf.d/test-basic-auth.conf ; m_serviceCycler httpd reload" EXIT
cat > /etc/httpd/conf.d/test-basic-auth.conf <<EOF
## Core basic auth test
@ -18,6 +19,3 @@ echo "Basic Auth Test" > /var/www/html/basic_auth/index.html
m_serviceCycler httpd cycle
curl -s -u tester:tester http://localhost/basic_auth/ | grep -q 'Basic Auth Test' > /dev/null 2>&1
r_checkExitStatus $?
rm /etc/httpd/conf.d/test-basic-auth.conf
m_serviceCycler httpd reload

View File

@ -1,5 +1,12 @@
#!/bin/bash
function cleanup() {
rm /etc/httpd/conf.d/vhost.conf
sed -i '/127.0.0.1 coretest/d' /etc/hosts
m_serviceCycler httpd reload
}
r_log "httpd" "Test basic vhost functionality"
trap cleanup EXIT
echo "127.0.0.1 coretest" >> /etc/hosts
cat > /etc/httpd/conf.d/vhost.conf << EOF
@ -19,7 +26,3 @@ m_serviceCycler httpd cycle
curl -s http://coretest/ | grep -q 'core vhost test page' > /dev/null 2>&1
r_checkExitStatus $?
rm /etc/httpd/conf.d/vhost.conf
sed -i '/127.0.0.1 coretest/d' /etc/hosts
m_serviceCycler httpd reload

View File

@ -1,4 +1,11 @@
#!/bin/bash
function cleanup() {
pwconv
rm -rf /var/tmp/pwunconv /var/tmp/pwconv
}
trap cleanup EXIT
r_log "shadow" "Check that pwck can use correct files"
pwck -rq ./common/files/correct-passwd ./common/files/correct-shadow
r_checkExitStatus $?
@ -10,7 +17,7 @@ if [ "$ret_val" -eq 0 ]; then
r_log "shadow" "They're correct."
exit 1
fi
r_checkExitStatus 0
r_checkExitStatus $ret_val
r_log "shadow" "Check that pwconv is functional"
mkdir -p /var/tmp/pwconv