Skip to content

Commit 831265c

Browse files
authored
Merge pull request #45 from buildplan/improve
minor Improvements
2 parents e300347 + f7d6432 commit 831265c

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
[![Shell](https://img.shields.io/badge/Shell-Bash%204.4%2B-green)](https://www.gnu.org/software/bash/)
77
[![Type](https://img.shields.io/badge/Type-Setup%20%26%20Hardening-blue)](https://github.com/buildplan/du_setup)
88

9-
**Version:** v0.60
9+
**Version:** v0.61
1010

11-
**Last Updated:** 2025-07-15
11+
**Last Updated:** 2025-08-03
1212

1313
**Compatible With:**
1414

@@ -82,12 +82,12 @@ sha256sum du_setup.sh
8282

8383
Compare the output hash to the one below. They must match exactly.
8484

85-
`ba58fefc2ed4341a26fb80c2cade3fdcd6c56f708c80c728436e148e3fe99b3f`
85+
`5b64025825cccd64555d681d209656cfbcbfa75044ce8be351f5e2c662d800fc`
8686

8787
Or echo the hash to check, it should output: `du_setup.sh: OK`
8888

8989
```
90-
echo ba58fefc2ed4341a26fb80c2cade3fdcd6c56f708c80c728436e148e3fe99b3f du_setup.sh | sha256sum --check -
90+
echo 5b64025825cccd64555d681d209656cfbcbfa75044ce8be351f5e2c662d800fc du_setup.sh | sha256sum --check -
9191
```
9292

9393
### 3\. Run the Script

du_setup.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/bash
22

33
# Debian 12 and Ubuntu Server Hardening Interactive Script
4-
# Version: 0.60 | 2025-07-15
4+
# Version: 0.61 | 2025-08-03
55
# Changelog:
6+
# - v0.61: Display Lynis suggestions in summary, hide tailscale auth key, cleanup temp files
67
# - v0.60: CI for shellcheck
78
# - v0.59: Add a new optional function that applies a set of recommended sysctl security settings to harden the kernel.
89
# Script can now check for update and can run self-update.
@@ -60,7 +61,7 @@
6061
set -euo pipefail # Exit on error, undefined vars, pipe failures
6162

6263
# --- Update Configuration ---
63-
CURRENT_VERSION="0.60"
64+
CURRENT_VERSION="0.61"
6465
SCRIPT_URL="https://raw.githubusercontent.com/buildplan/du_setup/refs/heads/main/du_setup.sh"
6566
CHECKSUM_URL="${SCRIPT_URL}.sha256"
6667

@@ -121,7 +122,7 @@ print_header() {
121122
echo -e "${CYAN}╔═════════════════════════════════════════════════════════════════╗${NC}"
122123
echo -e "${CYAN}║ ║${NC}"
123124
echo -e "${CYAN}║ DEBIAN/UBUNTU SERVER SETUP AND HARDENING SCRIPT ║${NC}"
124-
echo -e "${CYAN}║ v0.60 | 2025-07-15${NC}"
125+
echo -e "${CYAN}║ v0.61 | 2025-08-03${NC}"
125126
echo -e "${CYAN}║ ║${NC}"
126127
echo -e "${CYAN}╚═════════════════════════════════════════════════════════════════╝${NC}"
127128
echo
@@ -1434,7 +1435,8 @@ install_tailscale() {
14341435
done
14351436
fi
14361437
while true; do
1437-
read -rp "$(echo -e "${CYAN}Enter Tailscale pre-auth key: ${NC}")" AUTH_KEY
1438+
read -sp "$(echo -e "${CYAN}Enter Tailscale pre-auth key: ${NC}")" AUTH_KEY
1439+
echo
14381440
if [[ "$TS_CONNECTION" == "1" && "$AUTH_KEY" =~ ^tskey-auth- ]]; then break
14391441
elif [[ "$TS_CONNECTION" == "2" && -n "$AUTH_KEY" ]]; then
14401442
print_warning "Ensure the pre-auth key is valid for your custom Tailscale server ($LOGIN_SERVER)."
@@ -2175,6 +2177,8 @@ configure_security_audit() {
21752177
log "Lynis audit completed successfully."
21762178
# Extract hardening index
21772179
HARDENING_INDEX=$(grep -oP "Hardening index : \K\d+" "$AUDIT_LOG" || echo "Unknown")
2180+
#Extract top suggestions
2181+
grep "Suggestion:" /var/log/lynis-report.dat | head -n 5 > /tmp/lynis_suggestions.txt 2>/dev/null || true
21782182
# Append Lynis system log for persistence
21792183
cat /var/log/lynis.log >> "$AUDIT_LOG" 2>/dev/null
21802184
else
@@ -2362,6 +2366,10 @@ generate_summary() {
23622366
printf " %-17s%s\n" "- Audit Log:" "${AUDIT_LOG:-N/A}"
23632367
printf " %-17s%s\n" "- Hardening Index:" "${HARDENING_INDEX:-Unknown}"
23642368
printf " %-17s%s\n" "- Vulnerabilities:" "${DEBSECAN_VULNS:-N/A}"
2369+
if [[ -s /tmp/lynis_suggestions.txt ]]; then
2370+
echo -e " ${YELLOW}- Top Lynis Suggestions:${NC}"
2371+
sed 's/^/ /' /tmp/lynis_suggestions.txt
2372+
fi
23652373
else
23662374
echo -e " Security Audit: ${RED}Not run${NC}"
23672375
fi
@@ -2434,6 +2442,7 @@ handle_error() {
24342442

24352443
main() {
24362444
trap 'handle_error $LINENO' ERR
2445+
trap 'rm -f /tmp/lynis_suggestions.txt /tmp/tailscale_*.txt /tmp/sshd_config_test.log /tmp/ssh*.log /tmp/sshd_restart*.log' EXIT
24372446

24382447
# --- Root Check ---
24392448
if [[ $(id -u) -ne 0 ]]; then

du_setup.sh.sha256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ba58fefc2ed4341a26fb80c2cade3fdcd6c56f708c80c728436e148e3fe99b3f du_setup.sh
1+
5b64025825cccd64555d681d209656cfbcbfa75044ce8be351f5e2c662d800fc du_setup.sh

0 commit comments

Comments
 (0)