project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Feature] Support scoped sudo permissions instead of requiring sudo bash

Open Br00dkast opened this issue 2 months ago • 2 comments

[Feature] Support scoped sudo permissions instead of requiring sudo bash

PegaProx currently wraps many SSH operations for non-root users using a pattern similar to:

echo "<base64>" | base64 -d | sudo -n bash

This makes it difficult to deploy PegaProx according to least-privilege principles.

From a sudoers perspective, the only privileged executable being requested is bash, while the actual command is passed through stdin. This means administrators cannot safely allow individual commands such as pvecm status or ha-manager ... without effectively allowing an unrestricted root shell.

Requested change

Please separate SSH execution into unprivileged and privileged commands.

Unprivileged commands

Read-only operations should run directly as the configured SSH user where possible.

Examples include:

pvecm status
pveversion
sensors
cat /proc/net/dev
systemctl show ...
debsecan ...
apt-get -s dist-upgrade

For example, checking available updates with:

apt-get -s dist-upgrade

does not modify the system and should not require a root shell.

Privileged commands

Commands that genuinely require root privileges should execute the specific executable directly through sudo -n.

For example:

sudo -n /usr/sbin/ha-manager crm-command node-maintenance enable <node>

instead of:

echo "<payload>" | base64 -d | sudo -n bash

This would allow administrators to create narrowly scoped sudoers policies for the functionality they actually use.

Example:

pegaprox ALL=(root) NOPASSWD: /usr/sbin/ha-manager crm-command node-maintenance enable *
pegaprox ALL=(root) NOPASSWD: /usr/sbin/ha-manager crm-command node-maintenance disable *

Security benefit

This would allow PegaProx to be deployed with a dedicated pegaprox@pam service account and a restricted SSH key without granting:

NOPASSWD: ALL

or:

NOPASSWD: /bin/bash

A compromised PegaProx instance or SSH credential would therefore only have access to the explicitly permitted host operations.

It would also allow environments that already manage upgrades, reboots, hardening and other privileged host operations through tools such as Ansible/AWX to keep those responsibilities separated.

Ideally, the documentation could also include a minimum-permission sudoers example for the supported PegaProx SSH features.

Br00dkast avatar Sep 08 '26 07:09 Br00dkast

👋 Thanks for opening an issue!

It looks like the issue template was removed (or this was opened outside the templates). We rely on the Bug / Feature template so we can actually act on reports — a description-only issue with the template deleted almost always misses the details we need (version, repro, environment).

Please open a fresh issue using one of the templates (New issue → 🐛 Bug Report or ✨ Feature Request) and fill in the sections. 🐾

This is an automated message — closing for now; reopen with a completed template.

github-actions[bot] avatar Sep 08 '26 07:09 github-actions[bot]

In case anyone else stumbles on this closed issue, see #792

avsdev-cw avatar Sep 15 '26 14:09 avsdev-cw