fix: add Proxmox 9 compatibility for VM guest agent permissions

- Detect Proxmox version in setup script
- Use VM.GuestAgent.Audit for PVE 9+ instead of VM.Monitor
- Update UI instructions to handle both PVE 8 and 9
- addresses #348
This commit is contained in:
Pulse Monitor
2025-08-23 07:45:56 +00:00
parent 1cc2852555
commit 9aa40e9f2a
2 changed files with 20 additions and 6 deletions
@@ -635,7 +635,7 @@ export const NodeModal: Component<NodeModalProps> = (props) => {
</li>
<li class="flex items-start">
<span class="text-green-500 mr-2 mt-0.5">✓</span>
<span>Sets up monitoring permissions (PVEAuditor + VM.Monitor{formData().enableBackupManagement ? ' + backup access' : ''})</span>
<span>Sets up monitoring permissions (PVEAuditor + guest agent access{formData().enableBackupManagement ? ' + backup access' : ''})</span>
</li>
<li class="flex items-start">
<span class="text-green-500 mr-2 mt-0.5">✓</span>
@@ -708,7 +708,7 @@ export const NodeModal: Component<NodeModalProps> = (props) => {
<div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs mb-1">
<button type="button"
onClick={async () => {
const cmd = 'pveum aclmod / -user pulse-monitor@pam -role PVEAuditor && pveum role delete PulseMonitor 2>/dev/null; pveum role add PulseMonitor -privs VM.Monitor && pveum aclmod / -user pulse-monitor@pam -role PulseMonitor';
const cmd = 'pveum aclmod / -user pulse-monitor@pam -role PVEAuditor && pveum role delete PulseMonitor 2>/dev/null; PVE_VERSION=$(pveversion --verbose | grep "pve-manager" | cut -d"/" -f2 | cut -d"." -f1); if [ "$PVE_VERSION" -ge "9" ]; then pveum role add PulseMonitor -privs VM.GuestAgent.Audit; else pveum role add PulseMonitor -privs VM.Monitor; fi && pveum aclmod / -user pulse-monitor@pam -role PulseMonitor';
if (await copyToClipboard(cmd)) {
showSuccess('Command copied!');
}
@@ -721,7 +721,7 @@ export const NodeModal: Component<NodeModalProps> = (props) => {
<path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path>
</svg>
</button>
<code class="text-gray-800 dark:text-gray-200 whitespace-pre-line">{'pveum aclmod / -user pulse-monitor@pam -role PVEAuditor\npveum role delete PulseMonitor 2>/dev/null\npveum role add PulseMonitor -privs VM.Monitor\npveum aclmod / -user pulse-monitor@pam -role PulseMonitor'}</code>
<code class="text-gray-800 dark:text-gray-200 whitespace-pre-line">{'pveum aclmod / -user pulse-monitor@pam -role PVEAuditor\npveum role delete PulseMonitor 2>/dev/null\n# Detect PVE version and use appropriate permissions\nPVE_VERSION=$(pveversion --verbose | grep "pve-manager" | cut -d"/" -f2 | cut -d"." -f1)\nif [ "$PVE_VERSION" -ge "9" ]; then\n pveum role add PulseMonitor -privs VM.GuestAgent.Audit # PVE 9+\nelse\n pveum role add PulseMonitor -privs VM.Monitor # PVE 8 and below\nfi\npveum aclmod / -user pulse-monitor@pam -role PulseMonitor'}</code>
</div>
<div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs">
<button type="button"
@@ -742,7 +742,7 @@ export const NodeModal: Component<NodeModalProps> = (props) => {
<code class="text-gray-800 dark:text-gray-200">pveum aclmod /storage -user pulse-monitor@pam -role PVEDatastoreAdmin</code>
</div>
<p class="text-gray-600 dark:text-gray-400 text-xs mt-1">
PVEAuditor gives read-only access. PulseMonitor adds VM guest agent access for disk usage. PVEDatastoreAdmin on /storage adds backup management.
PVEAuditor gives read-only access. PulseMonitor adds VM guest agent access for disk usage (VM.Monitor for PVE 8, VM.GuestAgent.Audit for PVE 9+). PVEDatastoreAdmin on /storage adds backup management.
</p>
</div>
+16 -2
View File
@@ -2144,10 +2144,24 @@ fi
echo "Setting up permissions..."
pveum aclmod / -user pulse-monitor@pam -role PVEAuditor%s
# Create PulseMonitor role with VM.Monitor permission (remove old one if exists)
# Detect Proxmox version to handle permission differences
PVE_VERSION=$(pveversion --verbose | grep "pve-manager" | cut -d'/' -f2 | cut -d'.' -f1)
echo "Detected Proxmox VE version $PVE_VERSION"
# Create PulseMonitor role with appropriate permissions based on PVE version
echo "Setting up PulseMonitor role for guest agent access..."
pveum role delete PulseMonitor 2>/dev/null || true
pveum role add PulseMonitor -privs VM.Monitor
if [ "$PVE_VERSION" -ge "9" ]; then
# Proxmox 9+ uses VM.GuestAgent.Audit instead of VM.Monitor
echo "Using Proxmox 9+ permissions (VM.GuestAgent.Audit)"
pveum role add PulseMonitor -privs VM.GuestAgent.Audit
else
# Proxmox 8 and below use VM.Monitor
echo "Using Proxmox 8 permissions (VM.Monitor)"
pveum role add PulseMonitor -privs VM.Monitor
fi
pveum aclmod / -user pulse-monitor@pam -role PulseMonitor
echo ""