Checks fixed and added

This commit is contained in:
m8in
2026-03-30 21:12:17 +02:00
parent 320cc2009b
commit e43b3fec9b
3 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#!/bin/bash
_CURRENT_FILE='/etc/ssh/sshd_config.d/AccessRestriction.conf'
#No file is NOT ok
[ ! -e "${_CURRENT_FILE}" ] \
&& exit 1
#File has to be readable, then
#search for '/definitions/' in the path of current file, after readlink expanded a potential symlink.
[ -r "${_CURRENT_FILE}" ] \
&& readlink -f "${_CURRENT_FILE}" | grep -q "/definitions/" \
&& exit 0
#File has to be readable, then
#search for '/core/default/' in the path of current file, after readlink expanded a potential symlink.
[ -r "${_CURRENT_FILE}" ] \
&& readlink -f "${_CURRENT_FILE}" | grep -q "/core/default/" \
&& exit 0
exit 1

View File

@@ -12,4 +12,10 @@ _CURRENT_FILE='/etc/sudoers.d/allow-jenkins-updateRepositories'
&& readlink -f "${_CURRENT_FILE}" | grep -q "/definitions/" \
&& exit 0
#File has to be readable, then
#search for '/core/default/' in the path of current file, after readlink expanded a potential symlink.
[ -r "${_CURRENT_FILE}" ] \
&& readlink -f "${_CURRENT_FILE}" | grep -q "/core/default/" \
&& exit 0
exit 1

View File

@@ -0,0 +1,11 @@
#!/bin/bash
_FILE_NAME='/etc/adduser.conf'
# The first expression should filter the line conaining the key.
# - here a regular expression (-E) is used to enforce the line starts with the key.
# Second expression looks for the uninterpreted fix string (-F), but without output.
grep -E '^NAME_REGEX=.*$' "${_FILE_NAME}" | grep -q -F '^[a-z][-a-z0-9_.]*\$?$' 2> /dev/null \
&& exit 0
exit 1