Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F27208128
check-swap-encryption.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
check-swap-encryption.sh
View Options
#!/bin/sh
# -------------------------------------------------------------
# NRPE :: Check if swap is encrypted
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: BSD-2-Clause
# Source file: roles/core/monitoring/files/checks/nrpe/os_family/FreeBSD/check-swap-encryption.sh
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
# -------------------------------------------------------------
# Detect swap partitions from /etc/fstab
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SWAP_PARTITIONS
=
$(
grep swap /etc/fstab
|
awk
'{print $1}'
)
if
[
"
$SWAP_PARTITIONS
"
=
""
]
;
then
echo
"No swap partition declared in /etc/fstab"
exit
1
fi
# -------------------------------------------------------------
# Check encryption
#
# A swap partition is automatically encrypted on FreeBSD
# when the partition name has a suffix .eli or .bde
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
for
partition in
$SWAP_PARTITIONS
;
do
echo
"
$partition
"
|
grep -q -E
'\.eli$|\.bde$'
if
[
$?
-ne
0
]
;
then
echo
"
$partition
swap partition should be encrypted using gbde or geli"
>
&
2
echo
"See https://docs.freebsd.org/en/books/handbook/disks/#swap-encrypting"
>
&
2
exit
2
fi
done
exit
0
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Sun, May 3, 06:50 (19 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3677763
Default Alt Text
check-swap-encryption.sh (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment