Skip to content

Commit

Permalink
fix: Run salt-master and salt-api services as root
Browse files Browse the repository at this point in the history
Although the service is run under `root` user, `salt-master` changes the owner to `salt` user once it has started.
  • Loading branch information
cdalvaro committed May 23, 2024
1 parent c2b722f commit bb98ad1
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 99 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ for the list of changes in SaltStack.

- Upgrade `salt-master` to `3007.1` _Chlorine_.
- Change Docker base image to `ubuntu:noble-20240429`.
- Change Supervisor's user to `root` for `salt-master` and `salt-api` services.

**3007.0_2**

Expand Down
12 changes: 6 additions & 6 deletions assets/build/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ useradd --home-dir "${SALT_HOME}" --create-home \
--groups shadow

# Set PATH
exec_as_salt cat >> "${SALT_HOME}/.profile" <<EOF
exec_as_salt cat >>"${SALT_HOME}/.profile" <<EOF
PATH=/usr/local/sbin:/usr/local/bin:\$PATH
EOF

Expand All @@ -49,7 +49,7 @@ sed -i -e "s|^[# ]*StrictHostKeyChecking.*$| StrictHostKeyChecking no|" /etc/
echo " UserKnownHostsFile /dev/null"
echo " LogLevel ERROR"
echo "# IdentityFile salt_ssh_key"
} >> /etc/ssh/ssh_config
} >>/etc/ssh/ssh_config

SUPERVISOR_CONFIG_FILE=/etc/supervisor/supervisord.conf

Expand All @@ -73,13 +73,13 @@ else
fi

# configure supervisord to start salt-master
cat > /etc/supervisor/conf.d/salt-master.conf <<EOF
cat >/etc/supervisor/conf.d/salt-master.conf <<EOF
[program:salt-master]
priority=5
directory=${SALT_HOME}
environment=HOME=${SALT_HOME}
command=/usr/bin/salt-master
user=${SALT_USER}
user=root
autostart=true
autorestart=true
stopsignal=TERM
Expand All @@ -90,7 +90,7 @@ stderr_logfile_maxbytes=0
EOF

# configure supervisord to start crond
cat > /etc/supervisor/conf.d/cron.conf <<EOF
cat >/etc/supervisor/conf.d/cron.conf <<EOF
[program:cron]
priority=20
directory=/tmp
Expand All @@ -103,7 +103,7 @@ stderr_logfile=${SALT_LOGS_DIR}/supervisor/%(program_name)s.log
EOF

# Purge build dependencies and cleanup apt
(( ${#BUILD_DEPENDENCIES[@]} != 0 )) && apt-get purge -y --auto-remove "${BUILD_DEPENDENCIES[@]}"
((${#BUILD_DEPENDENCIES[@]} != 0)) && apt-get purge -y --auto-remove "${BUILD_DEPENDENCIES[@]}"
apt-get clean --yes
rm -rf /var/lib/apt/lists/*

Expand Down
Loading

0 comments on commit bb98ad1

Please sign in to comment.