audit-labs/audit-tools

A collection of scripts, queries, and other goodies you can use in an audit. audit automation compliance evidence scripts

Commit a6b093b3f5

a6b093b3f57355968dbd1b12da7718ea1ef195b3

parent: 78897ade09

Unsigned

cmc <hello@cleberg.net> · 2025-12-12 16:51 UTC
committer: <noreply@github.com>

enhance ssh_root_login.sh to check for keys if PermitRootLogin is enabled

Added checks and output for PermitRootLogin setting.

Layout: unified · split

os/linux/ssh_root_login.sh +13 −1
@@ -1,3 +1,15 @@
1#!/bin/bash 1#!/bin/bash
2 2
3grep -E "PermitRootLogin" /etc/ssh/sshd_config 3# Find the PermitRootLogin setting in the sshd_config file
4permit_root_login=$(grep -E "^[[:space:]]*PermitRootLogin" /etc/ssh/sshd_config)
5
6# Echo the setting for the user
7echo "Current PermitRootLogin setting:"
8echo "$permit_root_login"
9
10# Check if PermitRootLogin is set to something other than 'no'
11if ! echo "$permit_root_login" | grep -q "no"; then
12 echo ""
13 echo "PermitRootLogin is not set to 'no'. Checking for AuthorizedKeysFile location..."
14 grep -E "^[[:space:]]*AuthorizedKeysFile" /etc/ssh/sshd_config
15fi