Blob Blame History Raw
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#   runtest.sh of /CoreOS/openssh/Sanity/got-audit
#   Description: Ensure pointers in the sshd process GOT match expected values
#   Author: Gordon Messmer <gordon.messmer@gmail.com>
#

# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1

rlJournalStart
    rlPhaseStartSetup
        rlServiceStart sshd
    rlPhaseEnd

    rlPhaseStartTest "Run GEF got-audit"
        rlRun "SSH_PID=\$( systemctl show --property=MainPID sshd.service | cut -f2 -d= )"
        rlRun "echo SSH_PID is '$SSH_PID'"
        [ -n "$SSH_PID" ] || rlFail "No sshd was found"
        rlRun "auditfile=$(mktemp)"
        rlRun "gdb --pid '$pid' --command=got-audit.gdb --batch | grep ' : ' | sed -e 's/\\.so\\.[-_.0-9a-z]*$/.so/' | sort > '$auditfile'"
        rlAssertNotDiffer got-audit.fedora "$auditfile"
        diff -u got-audit.fedora "$auditfile" 1>&2
        rlRun "rm '$auditfile'"
    rlPhaseEnd

    rlPhaseStartCleanup
        rlServiceRestore sshd
    rlPhaseEnd
rlJournalPrintText
rlJournalEnd