Skip to content

Commit 8bf4807

Browse files
authored
Merge pull request #98 from hatlabs/feat/halpid-socket-group
Use dedicated halpid group for socket access control
2 parents 2c30bcf + 5173082 commit 8bf4807

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 5.0.1
2+
current_version = 5.0.2
33
commit = True
44
tag = False
55

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["halpid", "halpi", "halpi-common"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "5.0.1"
6+
version = "5.0.2"
77
authors = ["Matti Airas <matti.airas@hatlabs.fi>"]
88
edition = "2024"
99
rust-version = "1.90"

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.1
1+
5.0.2

halpid/debian/halpid.postinst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ case "$1" in
1212
chmod 755 /run/halpid
1313
fi
1414

15-
# Ensure the adm group exists (for socket access)
16-
if ! getent group adm > /dev/null 2>&1; then
17-
addgroup --system adm
15+
# Create the halpid system group with fixed GID 960 (for socket access)
16+
if ! getent group halpid > /dev/null 2>&1; then
17+
addgroup --system --gid 960 halpid
18+
fi
19+
20+
# Add the default user (UID 1000) to the halpid group for CLI access
21+
DEFAULT_USER=$(getent passwd 1000 | cut -d: -f1)
22+
if [ -n "$DEFAULT_USER" ]; then
23+
adduser "$DEFAULT_USER" halpid || true
1824
fi
1925

2026
# Reload systemd daemon to recognize new service

halpid/src/server/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub async fn run_server(state: AppState) -> anyhow::Result<()> {
5959
let listener = UnixListener::bind(&socket_path)?;
6060

6161
// Set socket permissions and group ownership
62-
setup_socket_permissions(&socket_path, "adm").await?;
62+
setup_socket_permissions(&socket_path, "halpid").await?;
6363

6464
tracing::info!("HTTP server listening on {}", socket_path.display());
6565

0 commit comments

Comments
 (0)