Skip to content

Commit 92ed1b0

Browse files
committed
DLPX-86539 CIS: postgres user account settings
PR URL: https://www.github.com/delphix/appliance-build/pull/776
1 parent bda104f commit 92ed1b0

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,18 @@ cat <<-EOF >"$DIRECTORY/etc/fstab"
304304
rpool/crashdump /var/crash zfs defaults,x-systemd.before=zfs-import-cache.service,x-systemd.before=kdump-tools.service 0 0
305305
EOF
306306

307+
#
308+
# Check if DIR_MODE is present (either commented or uncommented) in file where new user
309+
# configurations are stored If DIR_MODE is found, update its value to 0750 (uncomment if needed)
310+
# If DIR_MODE is not found, add it to the file with value 0750
311+
#
312+
NEW_USER_FILE="$DIRECTORY/etc/adduser.conf"
313+
if grep -q "^#\?DIR_MODE" "$NEW_USER_FILE"; then
314+
sed -i 's/^#\?DIR_MODE.*/DIR_MODE=0750/' "$NEW_USER_FILE"
315+
else
316+
echo "DIR_MODE=0750" >>"$NEW_USER_FILE"
317+
fi
318+
307319
#
308320
# Now we need to install the bootloader. In order to do that, we'll chroot
309321
# into the newly populated root filesystem, so that we use the grub-install

upgrade/upgrade-scripts/execute

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,18 @@ if ! systemd-detect-virt -qc && [[ "$opt_p" == "aws" ]]; then
595595
generate_interface_to_mac_address_map
596596
fi
597597

598+
#
599+
# Check if DIR_MODE is present (either commented or uncommented) in file where new user
600+
# configurations are stored If DIR_MODE is found, update its value to 0750 (uncomment if needed)
601+
# If DIR_MODE is not found, add it to the file with value 0750
602+
#
603+
NEW_USER_FILE="/etc/adduser.conf"
604+
if grep -q "^#\?DIR_MODE" "$NEW_USER_FILE"; then
605+
sed -i 's/^#\?DIR_MODE.*/DIR_MODE=0750/' "$NEW_USER_FILE"
606+
else
607+
echo "DIR_MODE=0750" >>"$NEW_USER_FILE"
608+
fi
609+
598610
#
599611
# We use a seperate ZFS dataset for GRUB, and this dataset is generally
600612
# not mounted when we update pacakges on the system. Thus, when a new

0 commit comments

Comments
 (0)