lynis/include/tests_custom.template

81 lines
3.0 KiB
Plaintext
Raw Normal View History

2014-08-26 17:33:55 +02:00
#!/bin/sh
#################################################################################
#
# Lynis
# ------------------
#
2015-01-30 18:04:30 +01:00
# Copyright 2007-2015, Michael Boelen, CISOfy (michael.boelen@cisofy.com)
# Web site: https://cisofy.com
2014-08-26 17:33:55 +02:00
#
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
# welcome to redistribute it under the terms of the GNU General Public License.
# See LICENSE file for usage of this software.
#
#################################################################################
#
2015-01-30 18:04:30 +01:00
# Here you could insert your own custom checks
2014-08-26 17:33:55 +02:00
#
# Tips:
# - Make sure to use each test ID only once in Register function
# - Use big steps in numbering, so you can easily put tests in between
# - Want to improve Lynis? Share your checks!
#
#################################################################################
#
# This has already been inserted, but you might reuse it to split your tests
# InsertSection "Custom Checks"
#
#################################################################################
#
# Test : CUST-0010
# Author : Your name <e-mail address>
2014-08-26 17:33:55 +02:00
# Description : Check for something interesting - template
# Notes : This test first checks if OpenSSL binary was found
# * Prerequisites check
#
# We check first if a variable is defined (OPENSSLBINARY).
# Other good options to check for:
# -f /etc/file
# -d /var/run/mydirectory
# ${MYVARIABLE} -eq 1
2014-08-26 17:33:55 +02:00
if [ ! -z "${OPENSSLBINARY}" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
# * Test registration
#
# Register the test, with custom ID CUST-0010, and only execute it when the prerequisites were met
Register --test-no CUST-0010 --preqs-met ${PREQS_MET} --weight L --network NO --description "My description of what this test does"
2014-08-26 17:33:55 +02:00
# Or you could use this one without any dependencies
# Register --test-no CUST-0010 --weight L --network NO --description "My description"
# If everything is fine, perform test
2014-08-26 17:33:55 +02:00
if [ ${SKIPTEST} -eq 0 ]; then
FOUND=0
logtext "Test: checking something"
if [ ${FOUND} -eq 0 ]; then
Display --indent 4 --text "- Performing custom test" --result OK --color GREEN
logtext "Result: the test result looks great!"
# Optional: create a suggestion after a specific finding
#ReportSuggestion "${TEST_NO}" "This is my suggestion to improve the system even further."
2014-08-26 17:33:55 +02:00
else
Display --indent 4 --text "- Performing custom test" --result WARNING --color RED
logtext "Result: this test had a bad result :("
# Throw a warning to the screen and report
ReportWarning ${TEST_NO} "M" "This is a warning message"
2014-08-26 17:33:55 +02:00
fi
fi
2014-08-26 17:33:55 +02:00
#
#################################################################################
#
wait_for_keypress
#
#================================================================================
2015-01-30 18:04:30 +01:00
# Lynis - Copyright 2007-2015, Michael Boelen, CISOfy - https://cisofy.com