2019-05-03 04:47:46 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-11-19 01:14:10 +01:00
|
|
|
|
2018-11-21 16:42:37 +01:00
|
|
|
mv /tmp/issue /etc/issue
|
|
|
|
mv /tmp/crontab /etc/cron.d/misp
|
2018-11-19 01:14:10 +01:00
|
|
|
|
|
|
|
# package
|
|
|
|
echo "--- autoremove for apt ---"
|
2019-05-03 04:47:46 +02:00
|
|
|
apt autoremove -qqy
|
2018-11-19 01:14:10 +01:00
|
|
|
|
|
|
|
echo "--- Cleaning packages"
|
2019-05-03 04:47:46 +02:00
|
|
|
apt clean -qqy
|
2019-05-01 16:59:09 +02:00
|
|
|
|
2019-05-06 04:44:27 +02:00
|
|
|
# Pass postfix configuration
|
|
|
|
echo "postfix postfix/mailname string localhost.localdomain" | debconf-set-selections
|
|
|
|
echo "postfix postfix/main_mailer_type string 'No configuration'" | debconf-set-selections
|
2019-05-03 04:47:46 +02:00
|
|
|
apt install mailutils -qqy
|
2018-11-19 01:14:10 +01:00
|
|
|
|
2018-12-10 17:35:26 +01:00
|
|
|
echo "--- Testing Instance ---"
|
|
|
|
cd /var/www/MISP/PyMISP
|
2019-05-01 16:49:52 +02:00
|
|
|
/var/www/MISP/venv/bin/python tests/testlive_comprehensive.py 2> /tmp/tests-output.txt
|
2018-12-10 17:35:26 +01:00
|
|
|
|
|
|
|
if [ "$?" != "0" ]; then
|
2019-05-01 16:59:09 +02:00
|
|
|
echo "Damage, terrible terrible damage!!!!" >> /tmp/tests-output.txt
|
2019-05-15 10:23:43 +02:00
|
|
|
# TODO: Move the smtp server and e-mail address to a config file
|
2019-05-01 16:59:09 +02:00
|
|
|
set smtp=smtp://149.13.33.5 ; cat /tmp/tests-output.txt |mail -s "tests/testlive_comprehensive.py failed on autogen-VM" steve.clement@circl.lu
|
2018-12-10 17:35:26 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf tests/viper-test-files
|
|
|
|
|
2019-05-15 10:23:43 +02:00
|
|
|
rm /etc/apt/apt.conf.d/99progressbar
|
|
|
|
|
2018-11-19 01:14:10 +01:00
|
|
|
# End Cleaning
|
2018-11-21 16:42:37 +01:00
|
|
|
echo "VM cleaned and rebooting for automagic reas0ns."
|
|
|
|
reboot
|