Skip to content

Commit 95119aa

Browse files
committed
Fix #169: Explicitly state different UIDs/GIDs across distros
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.
1 parent bd8c14c commit 95119aa

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Feel free to pick your favourite distro.
5252
- [Extending the image](#extending-the-image)
5353
- [Using custom init scripts](#using-custom-init-scripts)
5454
- [Security](#security)
55+
- [UIDs/GIDs numbers](#uidsgids-numbers)
5556
- [Quick how-tos](#quick-how-tos)
5657
- [Relaying messages through your Gmail account](#relaying-messages-through-your-gmail-account)
5758
- [Relaying messages through Google Apps account](#relaying-messages-through-google-apps-account)
@@ -684,7 +685,22 @@ postconf -e "address_verify_negative_cache=yes"
684685
## Security
685686
686687
Postfix will run the master proces as `root`, because that's how it's designed. Subprocesses will run under the `postfix`
687-
account which will use `UID:GID` of `100:101`. `opendkim` will run under account `102:103`.
688+
and `opendkim` accounts.
689+
690+
### UIDs/GIDs numbers
691+
692+
While I cannot guarantee IDs (they are auto-generated by package manages), they tend to be fairly consistent across
693+
**specific distribution**. Please be aware of this if you are switching images from Alpine to Debian to Ubuntu or
694+
back.
695+
696+
At the last check, images had the following UIDs/GIDs:
697+
698+
| Service | Debian (`UID/GID`) | Ubuntu (`UID/GID`) | Alpine (`UID/GID`) |
699+
|------------|--------------------|--------------------|--------------------|
700+
| `postfix` | `100:102` | `101:102` | `100:101` |
701+
| `opendkim` | `101:104` | `102:104` | `102:103` |
702+
703+
Please check the notification information on startup.
688704
689705
## Quick how-tos
690706

scripts/common-run.sh

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22

33
announce_startup() (
4+
local postfix_account opendkim_account
5+
46
DISTRO="unknown"
57
[ -f /etc/lsb-release ] && . /etc/lsb-release
68
[ -f /etc/os-release ] && . /etc/os-release
@@ -10,6 +12,11 @@ announce_startup() (
1012
DISTRO="${ID}"
1113
fi
1214
echo -e "${gray}${emphasis}★★★★★ ${reset}${lightblue}POSTFIX STARTING UP${reset} ${gray}(${reset}${emphasis}${DISTRO}${reset}${gray})${emphasis} ★★★★★${reset}"
15+
16+
postfix_account="$(cat /etc/passwd | grep -E "^postfix" | cut -f3-4 -d:)"
17+
opendkim_account="$(cat /etc/passwd | grep -E "^opendkim" | cut -f3-4 -d:)"
18+
19+
notice "System accounts: ${emphasis}postfix${reset}=${orange_emphasis}${postfix_account}${reset}, ${emphasis}opendkim${reset}=${orange_emphasis}${opendkim_account}${reset}. Careful when switching distros."
1320
)
1421

1522
setup_timezone() {

0 commit comments

Comments
 (0)