Skip to content

Commit

Permalink
Fix #169: Explicitly state different UIDs/GIDs across distros
Browse files Browse the repository at this point in the history
This is a simple documentation update to notify users that UIDs/GIDs may
(and in fact are) different across distros.

The documentation now reflects the last known state od UIDs/GIDs.
Startup now announces specific UIDs/GIDs used to make sure people are
aware of any future changes.
  • Loading branch information
bokysan committed Apr 23, 2024
1 parent bd8c14c commit 95119aa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Feel free to pick your favourite distro.
- [Extending the image](#extending-the-image)
- [Using custom init scripts](#using-custom-init-scripts)
- [Security](#security)
- [UIDs/GIDs numbers](#uidsgids-numbers)
- [Quick how-tos](#quick-how-tos)
- [Relaying messages through your Gmail account](#relaying-messages-through-your-gmail-account)
- [Relaying messages through Google Apps account](#relaying-messages-through-google-apps-account)
Expand Down Expand Up @@ -684,7 +685,22 @@ postconf -e "address_verify_negative_cache=yes"
## Security
Postfix will run the master proces as `root`, because that's how it's designed. Subprocesses will run under the `postfix`
account which will use `UID:GID` of `100:101`. `opendkim` will run under account `102:103`.
and `opendkim` accounts.
### UIDs/GIDs numbers
While I cannot guarantee IDs (they are auto-generated by package manages), they tend to be fairly consistent across
**specific distribution**. Please be aware of this if you are switching images from Alpine to Debian to Ubuntu or
back.
At the last check, images had the following UIDs/GIDs:
| Service | Debian (`UID/GID`) | Ubuntu (`UID/GID`) | Alpine (`UID/GID`) |
|------------|--------------------|--------------------|--------------------|
| `postfix` | `100:102` | `101:102` | `100:101` |
| `opendkim` | `101:104` | `102:104` | `102:103` |
Please check the notification information on startup.
## Quick how-tos
Expand Down
7 changes: 7 additions & 0 deletions scripts/common-run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

announce_startup() (
local postfix_account opendkim_account

DISTRO="unknown"
[ -f /etc/lsb-release ] && . /etc/lsb-release
[ -f /etc/os-release ] && . /etc/os-release
Expand All @@ -10,6 +12,11 @@ announce_startup() (
DISTRO="${ID}"
fi
echo -e "${gray}${emphasis}★★★★★ ${reset}${lightblue}POSTFIX STARTING UP${reset} ${gray}(${reset}${emphasis}${DISTRO}${reset}${gray})${emphasis} ★★★★★${reset}"

postfix_account="$(cat /etc/passwd | grep -E "^postfix" | cut -f3-4 -d:)"
opendkim_account="$(cat /etc/passwd | grep -E "^opendkim" | cut -f3-4 -d:)"

notice "System accounts: ${emphasis}postfix${reset}=${orange_emphasis}${postfix_account}${reset}, ${emphasis}opendkim${reset}=${orange_emphasis}${opendkim_account}${reset}. Careful when switching distros."
)

setup_timezone() {
Expand Down

0 comments on commit 95119aa

Please sign in to comment.