-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.1.2.2.2.sh
More file actions
36 lines (30 loc) · 724 Bytes
/
Copy path1.1.2.2.2.sh
File metadata and controls
36 lines (30 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# CIS 1.1.2.2.2 Ensure nodev option set on /dev/shm partition
TARGET="/dev/shm"
STATUS=""
REASON=""
# Step 1: Check if module exists on disk
if [ ! -d "$TARGET" ]; then
STATUS=Failed
REASON="/dev/shm does not exist"
echo "$STATUS | $REASON"
exit 1
fi
# Step 2: Check if module is loaded
if ! findmnt -kn "$TARGET" >/dev/null 2>&1; then
STATUS=Failed
REASON="/dev/shm is not mounted"
echo "$STATUS | $REASON"
exit 1
fi
# Step 3: Check configuration
if findmnt -kn /dev/shm -o OPTIONS | grep -vq nodev; then
STATUS=Failed
REASON="nodev option is not set on /dev/shm"
echo "$STATUS | $REASON"
exit 1
fi
# Final pass
STATUS=Passed
echo "$STATUS |"
exit 0