|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Name: lynis-installer.bash |
| 4 | +# |
| 5 | +# Description: |
| 6 | +# This script downloads a security auditing tool called Lynis, designed to scan a |
| 7 | +# system and identify security issues, and provides recommendations on how to better |
| 8 | +# secure it. Lynis, unless an error is encountered, will always be downloaded to the |
| 9 | +# user's root directory (/home/USERNAME/). |
| 10 | +# |
| 11 | +# Version: v1.0.7 |
| 12 | +# License: MIT License |
| 13 | +# Copyright (c) 2020-2024 Hunter T. (StrangeRanger) |
| 14 | +# |
| 15 | +######################################################################################## |
| 16 | + |
| 17 | +C_YELLOW="$(printf '\033[1;33m')" |
| 18 | +C_GREEN="$(printf '\033[0;32m')" |
| 19 | +C_CYAN="$(printf '\033[0;36m')" |
| 20 | +C_RED="$(printf '\033[1;31m')" |
| 21 | +C_NC="$(printf '\033[0m')" |
| 22 | +C_ERROR="${C_RED}ERROR:${C_NC} " |
| 23 | +C_WARNING="${C_YELLOW}WARNING:${C_NC} " |
| 24 | + |
| 25 | + |
| 26 | +read -rp "We will now download lynis. Press [Enter] to continue." |
| 27 | + |
| 28 | +[[ -d "$HOME/lynis" ]] && { |
| 29 | + echo "${C_WARNING}Lynis is already downloaded to your system" >&2 |
| 30 | + echo "Current location: '$HOME/lynis'" |
| 31 | + echo -e "\nExiting..." |
| 32 | + exit 0 |
| 33 | +} |
| 34 | + |
| 35 | +echo "Changing working directory to '$HOME'..." |
| 36 | +cd "$HOME" || { |
| 37 | + echo "${C_ERROR}Failed to change working directory to '$HOME'" >&2 |
| 38 | + echo "${C_CYAN}Lynis will download to '$PWD'${C_NC}" |
| 39 | +} |
| 40 | + |
| 41 | +echo "Downloading lynis..." |
| 42 | +git clone https://github.com/CISOfy/lynis || { |
| 43 | + echo "${C_ERROR}Failed to download lynis" >&2 |
| 44 | + echo -e "\nExiting..." |
| 45 | + exit 1 |
| 46 | +} |
| 47 | + |
| 48 | +echo -e "\n${C_GREEN}Lynis has been downloaded to your system" |
| 49 | +echo -e "${C_CYAN}To perform a system scan with lynis, execute the following command" \ |
| 50 | + "in the lynis root directory: sudo ./lynis audit system${C_NC}" |
0 commit comments