fix: remove sudo from apt commands and RestrictSUIDSGID from service
All checks were successful
CI/CD Pipeline / Code Format (push) Successful in 2s
CI/CD Pipeline / Clippy Lints (push) Successful in 1m17s
CI/CD Pipeline / Unit Tests (push) Successful in 56s
CI/CD Pipeline / Security Audit (push) Successful in 15s
CI/CD Pipeline / Build Debian Package (Ubuntu 22.04) (push) Successful in 1m57s
CI/CD Pipeline / Build Arch Package (push) Successful in 1m53s
CI/CD Pipeline / Build Alpine Package (push) Successful in 3m17s
CI/CD Pipeline / Build RPM Package (push) Successful in 3m36s
CI/CD Pipeline / Build Debian Package (push) Successful in 2m11s
All checks were successful
CI/CD Pipeline / Code Format (push) Successful in 2s
CI/CD Pipeline / Clippy Lints (push) Successful in 1m17s
CI/CD Pipeline / Unit Tests (push) Successful in 56s
CI/CD Pipeline / Security Audit (push) Successful in 15s
CI/CD Pipeline / Build Debian Package (Ubuntu 22.04) (push) Successful in 1m57s
CI/CD Pipeline / Build Arch Package (push) Successful in 1m53s
CI/CD Pipeline / Build Alpine Package (push) Successful in 3m17s
CI/CD Pipeline / Build RPM Package (push) Successful in 3m36s
CI/CD Pipeline / Build Debian Package (push) Successful in 2m11s
- Remove sudo from apt command execution (service runs as root) - Remove RestrictSUIDSGID from systemd service (blocks setuid for apt/dpkg) - Remove NoNewPrivileges from systemd service (blocks sudo PERM_SUDOERS) - Bump version to 0.3.2
This commit is contained in:
BIN
.a0proj/audit.db
BIN
.a0proj/audit.db
Binary file not shown.
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1859,7 +1859,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-patch-api"
|
name = "linux-patch-api"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix",
|
"actix",
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "linux-patch-api"
|
name = "linux-patch-api"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Echo <echo@moon-dragon.us>"]
|
authors = ["Echo <echo@moon-dragon.us>"]
|
||||||
description = "Secure remote package management API for Linux systems"
|
description = "Secure remote package management API for Linux systems"
|
||||||
|
|||||||
@ -17,7 +17,6 @@ RuntimeDirectory=linux-patch-api
|
|||||||
RuntimeDirectoryMode=0755
|
RuntimeDirectoryMode=0755
|
||||||
|
|
||||||
# Security hardening
|
# Security hardening
|
||||||
NoNewPrivileges=true
|
|
||||||
# Allow reboot capability for scheduled reboots
|
# Allow reboot capability for scheduled reboots
|
||||||
CapabilityBoundingSet=CAP_SYS_BOOT
|
CapabilityBoundingSet=CAP_SYS_BOOT
|
||||||
AmbientCapabilities=CAP_SYS_BOOT
|
AmbientCapabilities=CAP_SYS_BOOT
|
||||||
@ -37,7 +36,7 @@ RestrictNamespaces=true
|
|||||||
LockPersonality=true
|
LockPersonality=true
|
||||||
MemoryDenyWriteExecute=false
|
MemoryDenyWriteExecute=false
|
||||||
RestrictRealtime=true
|
RestrictRealtime=true
|
||||||
RestrictSUIDSGID=true
|
# RestrictSUIDSGID removed - package management requires setuid/setgid for apt/dpkg
|
||||||
RemoveIPC=true
|
RemoveIPC=true
|
||||||
|
|
||||||
# System call filtering (whitelist approach)
|
# System call filtering (whitelist approach)
|
||||||
|
|||||||
10
debian/changelog
vendored
10
debian/changelog
vendored
@ -1,3 +1,13 @@
|
|||||||
|
linux-patch-api (0.3.2-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Fix package install: Remove sudo from apt commands (service runs as root)
|
||||||
|
* Fix reboot endpoint: Implement actual system reboot via shutdown/systemctl
|
||||||
|
* Fix patches handler: Call reboot_system() instead of just logging
|
||||||
|
* Remove NoNewPrivileges and RestrictSUIDSGID from systemd service
|
||||||
|
* Add CAP_SYS_BOOT capability to systemd service for LXC reboot support
|
||||||
|
* Fix dpkg packaging: Remove linux-patch-api user creation, fix directory ownership
|
||||||
|
|
||||||
|
-- Echo <echo@moon-dragon.us> Sat, 02 May 2026 21:25:00 -0500
|
||||||
linux-patch-api (0.3.1-1) unstable; urgency=low
|
linux-patch-api (0.3.1-1) unstable; urgency=low
|
||||||
|
|
||||||
* Fix reboot endpoint: Implement actual system reboot via shutdown/systemctl
|
* Fix reboot endpoint: Implement actual system reboot via shutdown/systemctl
|
||||||
|
|||||||
@ -98,18 +98,9 @@ impl AptBackend {
|
|||||||
|
|
||||||
/// Run apt command and capture output
|
/// Run apt command and capture output
|
||||||
fn run_apt(&self, args: &[&str]) -> Result<String> {
|
fn run_apt(&self, args: &[&str]) -> Result<String> {
|
||||||
// Use sudo for operations that modify packages (install, upgrade, remove, purge)
|
// Service runs as root - no sudo needed for apt commands
|
||||||
let needs_sudo = args.first().is_some_and(|&cmd| {
|
let program = "apt";
|
||||||
matches!(
|
let cmd_args: Vec<&str> = args.to_vec();
|
||||||
cmd,
|
|
||||||
"install" | "upgrade" | "remove" | "purge" | "dist-upgrade" | "autoremove"
|
|
||||||
)
|
|
||||||
});
|
|
||||||
let (program, cmd_args): (&str, Vec<&str>) = if needs_sudo {
|
|
||||||
("sudo", ["apt"].iter().chain(args.iter()).copied().collect())
|
|
||||||
} else {
|
|
||||||
("apt", args.to_vec())
|
|
||||||
};
|
|
||||||
|
|
||||||
let output = Command::new(program)
|
let output = Command::new(program)
|
||||||
.args(&cmd_args)
|
.args(&cmd_args)
|
||||||
|
|||||||
Reference in New Issue
Block a user