Skip to content

Commit 8af527d

Browse files
committed
fix: patch foreground script to avoid chown in rootless containers
The foreground script uses 'install --owner --group' to create the restartcounter file, which requires CAP_CHOWN. Replace with touch + chmod which works without elevated capabilities.
1 parent 6d88b3a commit 8af527d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

openvoxserver/Containerfile.alpine

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ RUN sed -i '/Puppetserver::Ca::Utils::Config\.symlink_to_old_cadir/ s/^/# /' \
229229
# lacks CAP_CHOWN. The ownership is already handled by the g=u / SGID pattern above.
230230
RUN sed -i 's/FileUtils\.chown/# FileUtils.chown/' \
231231
/usr/lib/ruby/gems/3.4.0/gems/openvoxserver-ca-3.0.0/lib/puppetserver/ca/utils/file_system.rb
232+
# `install --owner/--group` in the foreground script requires CAP_CHOWN which
233+
# is not available in rootless containers. Replace with a simple touch + chmod.
234+
RUN sed -i 's|printf.*install -D --owner.*restartfile.*|touch "$restartfile" \&\& chmod 0644 "$restartfile"|' \
235+
/opt/puppetlabs/server/apps/puppetserver/cli/apps/foreground
232236

233237
USER puppet:0
234238

0 commit comments

Comments
 (0)