Compare commits

...

10 Commits

Author SHA1 Message Date
9a432932a0 getting rid of custom stuff 2023-10-01 13:39:31 +02:00
Carlos Álvaro
ddf9573e6c doc: Update README.md 2023-09-14 23:59:19 +02:00
Carlos Álvaro
8f55384986 fix: Set salt home directory permissions
Closes #211
2023-09-14 23:56:42 +02:00
dependabot[bot]
1fd232ffc0 build(deps): Bump docker/setup-qemu-action from 2 to 3
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-14 06:26:35 +02:00
dependabot[bot]
9c269531c6 build(deps): Bump docker/build-push-action from 4.2.1 to 5.0.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4.2.1 to 5.0.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4.2.1...v5.0.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 11:41:12 +02:00
dependabot[bot]
92001f0701 build(deps): Bump docker/setup-buildx-action from 2 to 3
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 10:27:19 +02:00
dependabot[bot]
d4d71d67e0 build(deps): Bump docker/login-action from 2 to 3
Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 09:57:31 +02:00
dependabot[bot]
5c0ba3d82e build(deps): Bump docker/build-push-action from 4.1.1 to 4.2.1
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4.1.1 to 4.2.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4.1.1...v4.2.1)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 09:47:19 +02:00
Carlos Álvaro
5ed81c554e fix: Change salt's logrotate config file 2023-09-08 13:43:15 +02:00
Carlos Álvaro
bc4c65559f feat: Upgrade pygit2 to version 1.12.2 2023-09-08 13:43:15 +02:00
11 changed files with 56 additions and 33 deletions

View File

@@ -26,10 +26,10 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
with: with:
driver-opts: network=host driver-opts: network=host
@@ -60,7 +60,7 @@ jobs:
echo "Cache contents available at: ${CACHE_PATH}" echo "Cache contents available at: ${CACHE_PATH}"
- name: Build docker-salt-master image - name: Build docker-salt-master image
uses: docker/build-push-action@v4.1.1 uses: docker/build-push-action@v5.0.0
with: with:
context: . context: .
file: ./Dockerfile file: ./Dockerfile

View File

@@ -84,10 +84,10 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- name: Cache Docker layers - name: Cache Docker layers
id: cache-docker-layers id: cache-docker-layers
@@ -110,27 +110,27 @@ jobs:
echo "Cache contents available at: ${CACHE_PATH}" echo "Cache contents available at: ${CACHE_PATH}"
- name: Login to Docker Container Registry - name: Login to Docker Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }} password: ${{ secrets.CR_PAT }}
- name: Login to Quay.io Container Registry - name: Login to Quay.io Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: quay.io registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }} username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }} password: ${{ secrets.QUAYIO_PASSWORD }}
- name: Build - name: Build
uses: docker/build-push-action@v4.1.1 uses: docker/build-push-action@v5.0.0
with: with:
context: . context: .
file: ./Dockerfile file: ./Dockerfile

View File

@@ -22,11 +22,11 @@ jobs:
- name: Set up QEMU - name: Set up QEMU
if: github.event_name != 'schedule' if: github.event_name != 'schedule'
uses: docker/setup-qemu-action@v2.1.0 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
if: github.event_name != 'schedule' if: github.event_name != 'schedule'
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v3
- name: Cache Docker layers - name: Cache Docker layers
if: github.event_name != 'schedule' if: github.event_name != 'schedule'
@@ -39,7 +39,7 @@ jobs:
- name: Build docker-salt-master image - name: Build docker-salt-master image
if: github.event_name != 'schedule' if: github.event_name != 'schedule'
uses: docker/build-push-action@v4.1.1 uses: docker/build-push-action@v5.0.0
with: with:
context: . context: .
file: ./Dockerfile file: ./Dockerfile

View File

@@ -4,10 +4,15 @@ This file only reflects the changes that are made in this image.
Please refer to the [Salt 3006.3 Release Notes](https://docs.saltstack.com/en/latest/topics/releases/3006.3.html) Please refer to the [Salt 3006.3 Release Notes](https://docs.saltstack.com/en/latest/topics/releases/3006.3.html)
for the list of changes in SaltStack. for the list of changes in SaltStack.
**3006.3_1**
- Fix salt home directory permissions. Issue #211
**3006.3** **3006.3**
- Upgrade `salt-master` to `3006.3` *Sulfur*. - Upgrade `salt-master` to `3006.3` *Sulfur*.
- Change Docker base image to `ubuntu:jammy-20230816`. - Change Docker base image to `ubuntu:jammy-20230816`.
- Upgrade `pygit2` to version `1.12.2`.
**3006.2** **3006.2**

View File

@@ -1,11 +1,11 @@
FROM ubuntu:jammy-20230816 FROM debian:bullseye-slim
ARG BUILD_DATE ARG BUILD_DATE
ARG VCS_REF ARG VCS_REF
# https://github.com/saltstack/salt/releases # https://github.com/saltstack/salt/releases
ENV SALT_VERSION="3006.3" ENV SALT_VERSION="3002.6+dfsg1-4+deb11u1"
ENV IMAGE_VERSION="${SALT_VERSION}" ENV IMAGE_VERSION="${SALT_VERSION}_1"
ENV SALT_DOCKER_DIR="/etc/docker-salt" \ ENV SALT_DOCKER_DIR="/etc/docker-salt" \
SALT_ROOT_DIR="/etc/salt" \ SALT_ROOT_DIR="/etc/salt" \

View File

@@ -23,7 +23,7 @@ Automated builds of the image are available on
the recommended method of installation. the recommended method of installation.
```sh ```sh
docker pull ghcr.io/cdalvaro/docker-salt-master:3006.3 docker pull ghcr.io/cdalvaro/docker-salt-master:3006.3_1
``` ```
You can also pull the latest tag which is built from the repository `HEAD` You can also pull the latest tag which is built from the repository `HEAD`

View File

@@ -139,10 +139,10 @@ function add_salt_repository()
local arch=amd64 local arch=amd64
is_arm64 && arch=arm64 is_arm64 && arch=arm64
source /etc/os-release source /etc/os-release
mkdir -p /etc/apt/keyrings
local keyring_file="/etc/apt/keyrings/salt-archive-keyring.gpg" local keyring_file="/etc/apt/keyrings/salt-archive-keyring.gpg"
local root_url="https://repo.saltproject.io/salt/py3/ubuntu/${VERSION_ID:?}/${arch}" #https://repo.saltproject.io/salt/py3/debian/11/arm64/SALT-PROJECT-GPG-PUBKEY-2023.gpg
local root_url="https://repo.saltproject.io/salt/py3/debian/${VERSION_ID:?}/${arch}"
download "${root_url}/SALT-PROJECT-GPG-PUBKEY-2023.gpg" "${keyring_file}" download "${root_url}/SALT-PROJECT-GPG-PUBKEY-2023.gpg" "${keyring_file}"
echo "deb [signed-by=${keyring_file} arch=${arch}] ${root_url}/minor/${SALT_VERSION} ${VERSION_CODENAME:?} main" > /etc/apt/sources.list.d/salt.list echo "deb [signed-by=${keyring_file} arch=${arch}] ${root_url}/minor/${SALT_VERSION} ${VERSION_CODENAME:?} main" > /etc/apt/sources.list.d/salt.list
} }

View File

@@ -11,13 +11,13 @@ source "${FUNCTIONS_FILE}"
log_info "Installing required packages and build dependencies ..." log_info "Installing required packages and build dependencies ..."
REQUIRED_PACKAGES=( REQUIRED_PACKAGES=(
binutils patchelf binutils patchelf python3-pip
) )
BUILD_DEPENDENCIES=() BUILD_DEPENDENCIES=()
log_info "Adding salt repository..." #log_info "Adding salt repository..."
add_salt_repository #add_salt_repository
apt-get update apt-get update
install_pkgs "${REQUIRED_PACKAGES[@]}" "${BUILD_DEPENDENCIES[@]}" install_pkgs "${REQUIRED_PACKAGES[@]}" "${BUILD_DEPENDENCIES[@]}"
@@ -28,6 +28,7 @@ log_info "Creating ${SALT_USER} user ..."
useradd --home-dir "${SALT_HOME}" --create-home \ useradd --home-dir "${SALT_HOME}" --create-home \
--shell /bin/bash --user-group "${SALT_USER}" \ --shell /bin/bash --user-group "${SALT_USER}" \
--groups shadow --groups shadow
id ${SALT_USER}
# Set PATH # Set PATH
exec_as_salt cat >> "${SALT_HOME}/.profile" <<EOF exec_as_salt cat >> "${SALT_HOME}/.profile" <<EOF
@@ -39,7 +40,8 @@ log_info "Installing salt packages ..."
install_pkgs salt-master="${SALT_VERSION}" salt-api="${SALT_VERSION}" install_pkgs salt-master="${SALT_VERSION}" salt-api="${SALT_VERSION}"
# Install python packages # Install python packages
exec_as_salt salt-pip install pygit2==1.12.0 log_info "Installing python packages ..."
pip3 install pygit2==1.12.2
# Configure ssh # Configure ssh
log_info "Configuring ssh ..." log_info "Configuring ssh ..."
@@ -107,3 +109,7 @@ apt-get clean --yes
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
export -n DEBIAN_FRONTEND export -n DEBIAN_FRONTEND
# Set home directory permissions
log_info "Setting ${SALT_USER} home directory permissions ..."
chown -R "${SALT_USER}:${SALT_USER}" "${SALT_HOME}"

View File

@@ -556,8 +556,11 @@ function initialize_datadir()
function configure_logrotate() function configure_logrotate()
{ {
log_info "Configuring logrotate ..." log_info "Configuring logrotate ..."
local LOGROTATE_CONFIG_DIR='/etc/logrotate.d/salt'
local LOGROTATE_CONFIG_FILE="${LOGROTATE_CONFIG_DIR}/salt-common.logrotate"
rm -f /etc/logrotate.d/salt-common rm -rf "${LOGROTATE_CONFIG_DIR}"
mkdir -p "${LOGROTATE_CONFIG_DIR}"
# configure supervisord log rotation # configure supervisord log rotation
cat > /etc/logrotate.d/supervisord <<EOF cat > /etc/logrotate.d/supervisord <<EOF
@@ -573,13 +576,14 @@ ${SALT_LOGS_DIR}/supervisor/*.log {
EOF EOF
# configure salt master, minion and key log rotation # configure salt master, minion and key log rotation
cat > /etc/logrotate.d/salt <<EOF cat > "${LOGROTATE_CONFIG_FILE}" <<EOF
${SALT_LOGS_DIR}/salt/master.log { ${SALT_LOGS_DIR}/salt/master.log {
${SALT_LOG_ROTATE_FREQUENCY} ${SALT_LOG_ROTATE_FREQUENCY}
missingok missingok
rotate ${SALT_LOG_ROTATE_RETENTION} rotate ${SALT_LOG_ROTATE_RETENTION}
compress compress
notifempty notifempty
create 0640 ${SALT_USER} ${SALT_USER}
} }
${SALT_LOGS_DIR}/salt/key.log { ${SALT_LOGS_DIR}/salt/key.log {
@@ -588,20 +592,23 @@ ${SALT_LOGS_DIR}/salt/key.log {
rotate ${SALT_LOG_ROTATE_RETENTION} rotate ${SALT_LOG_ROTATE_RETENTION}
compress compress
notifempty notifempty
create 0640 ${SALT_USER} ${SALT_USER}
} }
EOF EOF
if [[ "${SALT_API_SERVICE_ENABLED,,}" == true ]]; then if [[ "${SALT_API_SERVICE_ENABLED,,}" == true ]]; then
# configure salt-api log rotation # configure salt-api log rotation
cat >> /etc/logrotate.d/salt <<EOF cat >> "${LOGROTATE_CONFIG_FILE}" <<EOF
${SALT_LOGS_DIR}/salt/api.log { ${SALT_LOGS_DIR}/salt/api.log {
${SALT_LOG_ROTATE_FREQUENCY} ${SALT_LOG_ROTATE_FREQUENCY}
missingok missingok
rotate ${SALT_LOG_ROTATE_RETENTION} rotate ${SALT_LOG_ROTATE_RETENTION}
compress compress
notifempty notifempty
create 0640 ${SALT_USER} ${SALT_USER}
} }
EOF EOF
fi fi
@@ -638,10 +645,10 @@ function initialize_system()
initialize_datadir initialize_datadir
configure_logrotate configure_logrotate
configure_timezone configure_timezone
configure_salt_master #configure_salt_master
configure_salt_api #configure_salt_api
configure_salt_formulas #configure_salt_formulas
configure_config_reloader configure_config_reloader
setup_salt_keys #setup_salt_keys
rm -rf /var/run/supervisor.sock rm -rf /var/run/supervisor.sock
} }

View File

@@ -23,7 +23,7 @@ case "${1}" in
;; ;;
app:gen-signed-keys) app:gen-signed-keys)
shift 1 shift 1
gen_signed_keys "${1}" #gen_signed_keys "${1}"
;; ;;
esac esac
;; ;;
@@ -41,7 +41,7 @@ case "${1}" in
esac esac
;; ;;
app:reload-3rd-formulas) app:reload-3rd-formulas)
configure_salt_formulas #configure_salt_formulas
exec "$0" app:restart salt-master exec "$0" app:restart salt-master
;; ;;
app:help) app:help)

View File

@@ -46,3 +46,8 @@ ok "salt-minion started"
salt "${TEST_MINION_ID}" test.ping || error "${TEST_MINION_ID} ping" salt "${TEST_MINION_ID}" test.ping || error "${TEST_MINION_ID} ping"
ok "${TEST_MINION_ID} ping" ok "${TEST_MINION_ID} ping"
# Test salt home permissions
# shellcheck disable=SC2016
docker-exec bash -c 'test $(stat -c "%U:%G" "${SALT_HOME}") = "${SALT_USER}:${SALT_USER}"' || error "salt home permissions"
ok "salt home permissions"