Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASMCMS-9040 - change permissions on image config files after recipe build. #85

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- CASMCMS-9040 - change permissions on image config files after recipe build.

## [2.13.2] - 2024-07-25
### Dependencies
- Resolve CVES:
Expand Down
18 changes: 17 additions & 1 deletion scripts/package_and_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# MIT License
#
# (C) Copyright 2018-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2018-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -76,6 +76,22 @@ check_image_artifact_exists() {
check_image_artifact_exists "$IMAGE_ROOT_DIR/boot/$KERNEL_FILENAME"
check_image_artifact_exists "$IMAGE_ROOT_DIR/boot/$INITRD_FILENAME"

# Change ownership and permissions on /image dir if it exists.
# This dir contains config files that may have sensative information
# in them and should only be readable by root.
if [[ -d ${IMAGE_ROOT_DIR}/image ]]; then
# change read/write permissions of dir to root only
chown root ${IMAGE_ROOT_DIR}/image
chmod 700 ${IMAGE_ROOT_DIR}/image

# change files in the dir to root ownership and only rw for root
chown root ${IMAGE_ROOT_DIR}/image/*
chmod 600 ${IMAGE_ROOT_DIR}/image/*

# change the .sh file to rwx for root
chmod 700 ${IMAGE_ROOT_DIR}/image/*.sh
fi

# Make the squashfs formatted archive
time mksquashfs "$IMAGE_ROOT_DIR" "$IMAGE_ROOT_PARENT/$IMAGE_ROOT_ARCHIVE_NAME.sqsh"
fail_if_error "Creating squashfs of image root"
Expand Down
Loading