feat(linuxpackage): Support configurable username and group #2580
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Change
Updated Linux package scripts and install script to support user defined username and group.
bdotbdotThese options are intended to be used during first install. We do not support modifying these options after initial install.
The updater did not require changes as it already dynamically sets the Systemd group based on the group configured in the install unit file. It does not set the user, nor does it need to. We use a systemd override when running as non root, the updater does not touch this override file.
Testing
Defaults
Local install and Test Kitchen are passing fine. All files that should be owned by
bdot:bdotwere verified successfully.Custom user / group
I configured
/etc/default/observiq-otel-collector.After installing with the install script, permissions are set correctly:
$ sudo ls -la /opt/observiq-otel-collector/ total 324120 drwxr-xr-x 5 otelu otelg 4096 Aug 20 15:01 . drwxr-xr-x 4 root root 4096 Aug 20 15:01 .. -rw-r--r-- 1 otelu otelg 11339 Mar 3 13:43 LICENSE -rw-r--r-- 1 otelu otelg 44 Aug 20 14:59 VERSION.txt -rw-r----- 1 otelu otelg 1293 Aug 20 14:59 config.yaml drwxr-x--- 2 otelu otelg 4096 Aug 20 15:01 log -rw-r----- 1 otelu otelg 232 Aug 20 14:59 logging.yaml -rwxr-xr-x 1 otelu otelg 323416248 Aug 20 14:59 observiq-otel-collector drwxr-x--- 2 otelu otelg 4096 Aug 20 15:01 plugins drwxr-x--- 2 otelu otelg 4096 Aug 20 15:00 storage -rwxr-xr-x 1 otelu otelg 8429752 Aug 20 14:59 updaterThe process is running as
oteluuser.The systemd unit file and override** look correct:
**The systemd override logic was implemented previously, here #2443. This PR updates the
postinallscript to use the configured user instead ofbdot.. defaulting to bdot.Checklist