# vim: set filetype=sh ts=4 sw=4 sts=4 et: # shellcheck shell=bash # shellcheck disable=SC2086,SC2016,SC2046 # below: convoluted way that forces shellcheck to source our caller # shellcheck source=tests/functional/launch_tests_on_instance.sh . "$(dirname "${BASH_SOURCE[0]}")"/dummy testsuite_scripts() { # try to backup without having a GPG key setup first success backup_config $r0 "\"echo DESTDIR='/root/backups' >> $opt_remote_etc_bastion/osh-backup-acl-keys.conf\"" success backup_run_nokey $r0 /opt/bastion/bin/cron/osh-backup-acl-keys.sh contain "Creating /root/backups/backup-" contain "File created" contain "will not be encrypted" nocontain "Encrypting" contain "Done" nocontain "ERROR:" nocontain "Unexpected termination" # generate & import keys success setup_keys_generate $r0 /opt/bastion/bin/admin/setup-gpg.sh --generate contain "autogenerated with" script setup_keys_import $r0 "\"echo '$admins_gpg_key_pub' | /opt/bastion/bin/admin/setup-gpg.sh --import\"" retvalshouldbe 0 contain "Paste the admins" contain "50-gpg-admins-key.conf updated:" contain "50-gpg.conf updated:" nocontain "WARN:" nocontain "ERROR:" nocontain "Unexpected termination" # backup again success backup_run_key $r0 /opt/bastion/bin/cron/osh-backup-acl-keys.sh contain "Creating /root/backups/backup-" contain "File created" nocontain "will not be encrypted" contain "Encrypting" contain "Done" nocontain "WARN:" nocontain "ERROR:" nocontain "Unexpected termination" # compress old logs success compress_old_logs $r0 /opt/bastion/bin/cron/osh-compress-old-logs.sh contain "Done" nocontain "WARN:" nocontain "ERROR:" nocontain "Unexpected termination" # lingering sessions reaper success lingering_sessions_reaper $r0 /opt/bastion/bin/cron/osh-lingering-sessions-reaper.sh contain "Done" nocontain "WARN:" nocontain "ERROR:" nocontain "Unexpected termination" # orphaned homedirs success orphaned_homedirs $r0 /opt/bastion/bin/cron/osh-orphaned-homedir.sh contain "master instance" nocontain "WARN:" nocontain "ERROR:" nocontain "Unexpected termination" # piv grace reaper is handled in 400-piv.sh # ttyrec rotate success rotate_ttyrec $r0 /opt/bastion/bin/cron/osh-rotate-ttyrec.sh contain "Done" nocontain "WARN:" nocontain "ERROR:" nocontain "Unexpected termination" # encrypt rsync (nothing to encrypt) success encrypt_rsync_none $r0 /opt/bastion/bin/cron/osh-encrypt-rsync.pl contain 'Config test passed' contain "Done" nocontain "WARN:" nocontain "ERROR:" nocontain "Unexpected termination" # create and account and connect one to have a ttyrec file grant accountCreate success a0_create_a1 $a0 --osh accountCreate --always-active --account $account1 --uid $uid1 --public-key "\"$(cat $account1key1file.pub)\"" json .error_code OK .command accountCreate .value null revoke accountCreate grant accountAddPersonalAccess success a0_allow_a1 $a0 --osh accountAddPersonalAccess --account $account1 --host 127.0.0.1 --user none --port 22 json .error_code OK .command accountAddPersonalAccess revoke accountAddPersonalAccess run a1_connect $a1 none@127.0.0.1 # encrypt rsync (one file to encrypt) success encrypt_rsync_none $r0 /opt/bastion/bin/cron/osh-encrypt-rsync.pl --force-encrypt --encrypt-only contain 'Config test passed' contain "Creating" contain "Encrypting" contain ".gpg" contain "Done" nocontain "WARN:" nocontain "ERROR:" nocontain "Unexpected termination" # cleanup account grant accountDelete success a0_delete_a1 $a0 --osh accountDelete --account $account1 --no-confirm revoke accountDelete } testsuite_scripts unset -f testsuite_scripts