Generate certificates before authentication tests

These certificates must be generated before running radiusd.
Ported from: c1e0756a09

Signed-off-by: Antonio Torres <antorres@redhat.com>
This commit is contained in:
Antonio Torres 2024-06-26 12:27:53 +02:00
parent 99c7cfb0a0
commit d8e14017e6
No known key found for this signature in database
GPG Key ID: 359FAF777296F653

View File

@ -16,6 +16,25 @@ PACKAGE="freeradius"
RADIUS_CLIENT_CONF="/etc/raddb/clients.conf" RADIUS_CLIENT_CONF="/etc/raddb/clients.conf"
RADIUD_PALIN_TEXT_AUTH_FILE="/etc/raddb/mods-config/files/authorize" RADIUD_PALIN_TEXT_AUTH_FILE="/etc/raddb/mods-config/files/authorize"
generate_cert(){
pushd /etc/raddb/certs/
#remove certificates if exists;generate new certificates
if [[ -f /etc/raddb/certs/bootstrap ]]; then
rlLog "Destroy and create new default certificates via bootstrap script"
rm -f *.pem *.der *.csr *.crt *.key *.p12 serial* index.txt* dh
rlRun "sh /etc/raddb/certs/bootstrap" 0 "Gnenerating certificates"
else
rlLogWarning "!!! WARNING bootsrap file does not exist !!!"
rlLog "Destroy and create new default certificates via make scripts"
make destroycerts -C /etc/raddb/certs/
#create new certificates
make -C /etc/raddb/certs/
chown root:radiusd dh ca.* client.* server.*
chmod 640 dh ca.* client.* server.*
fi
popd
}
rlJournalStart rlJournalStart
rlPhaseStartSetup rlPhaseStartSetup
rlAssertRpm $PACKAGE rlAssertRpm $PACKAGE
@ -29,6 +48,7 @@ rlJournalStart
rlRun "cp clients.conf $RADIUS_CLIENT_CONF" rlRun "cp clients.conf $RADIUS_CLIENT_CONF"
rlRun "cp authorize $RADIUD_PALIN_TEXT_AUTH_FILE" rlRun "cp authorize $RADIUD_PALIN_TEXT_AUTH_FILE"
rlRun "systemctl daemon-reload" rlRun "systemctl daemon-reload"
generate_cert
rlPhaseEnd rlPhaseEnd
rlPhaseStartTest rlPhaseStartTest