Skip to content

Commit 65663f1

Browse files
Merge pull request #16 from StrangeRanger/dev
Update to every security script
2 parents 8d321ee + 9ad1e3b commit 65663f1

File tree

11 files changed

+338
-341
lines changed

11 files changed

+338
-341
lines changed

auditing/Lynis Installer/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## v1.0.7 - 2024-08-15
8+
9+
### Changed
10+
11+
- No longer requires root permission to run the script.
12+
- Won't download lynis if is already present on the system.
13+
- Improved syntax of the script.
14+
- Rename script to `lynis-installer.bash`.
15+
716
## v1.0.6 - 2024-04-13
817

918
### Changed

auditing/Lynis Installer/lynis-installer

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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}"

hardening/Root Locker/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## v1.0.7 - 2024-08-15
8+
9+
### Changed
10+
11+
- Improved error handling.
12+
- Modify syntax and documentation.
13+
- Utilizes `usermod -L` to lock the root account.
14+
- Rename script to `root-locker.bash`.
15+
716
## v1.0.6 - 2024-04-13
817

918
### Changed

hardening/Root Locker/root-locker

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
#
3+
# Name: root-locker.bash
4+
#
5+
# Description:
6+
# This script locks the root account, preventing users from direct logins as root.
7+
#
8+
# Note:
9+
# Locking the root account doesn't prevent users from using something like `sudo su`
10+
# to gain root access.
11+
#
12+
# Version: v1.0.7
13+
# License: MIT License
14+
# Copyright (c) 2020-2024 Hunter T. (StrangeRanger)
15+
#
16+
########################################################################################
17+
18+
C_GREEN="$(printf '\033[0;32m')"
19+
C_RED="$(printf '\033[1;31m')"
20+
C_NC="$(printf '\033[0m')"
21+
22+
23+
## Check if this script was executed with root privilege.
24+
if [[ $EUID != 0 ]]; then
25+
echo "${C_RED}Please run this script as or with root privilege${C_NC}" >&2
26+
echo -e "\nExiting..."
27+
exit 1
28+
fi
29+
30+
31+
read -rp "We will now disable the root account. Press [Enter] to continue."
32+
33+
echo "Disabling root account..."
34+
usermod -L root || {
35+
echo -e "${C_RED}ERROR:${C_NC} Failed to lock the root account" >&2
36+
echo -e "\nExiting..."
37+
exit 1
38+
}
39+
40+
echo -e "\n${C_GREEN}The root account has been locked${C_NC}"

hardening/SSHD Hardening/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## v2.0.0 - 2024-08-15
8+
9+
Complete rewrite of the script. Below are just some of the differences in the new version.
10+
11+
### Added
12+
13+
- Can catch common error signals.
14+
- Output is now colored to better differentiate between different types of messages.
15+
16+
### Changes
17+
18+
- Improved the script's structure.
19+
- Improved regex and replacement of sshd configurations.
20+
- Improved error handling.
21+
- The script has been renamed to `harden-sshd.bash`.
22+
723
## v1.1.2 - 2024-04-13
824

925
### Changed

0 commit comments

Comments
 (0)