ronivay / XenOrchestraInstallerUpdater

Xen Orchestra install/update script
GNU General Public License v3.0
1.14k stars 190 forks source link

Need to add "findmount" to sudoers #171

Closed JSylvia007 closed 1 year ago

JSylvia007 commented 1 year ago

OS Version: Ubuntu 22.04 Node.js version: v18.13.0 Yarn version: 1.22.19

Server specs Install works, this isn't a hardware issue.

Issue Apparently a change needs to be made to the update script that will add /usr/bin/findmnt to /etc/sudoers.d/xo-server-xouser. I recently updated to XO (commit #bfa02). I had been using a previous commit (but I can't remember which one), and remotes worked just fine.

I updated last night and I got an error when it tried to run a backup:

xo01 : Jan 30 09:36:45 : xouser : a password is required ; PWD=/opt/xo/xo-builds/xen-orchestra-202301292111/packages/xo-server ; USER=root ; COMMAND=/usr/bin/findmnt /opt/xo/mounts/d3563718-8bba-419c-bbe9-7243ff982b6d

I manually updated the /etc/sudoers.d/xo-server-xouser file and added /usr/bin/findmnt, then re-ran the metadata backup and it finished without issue.

Installation logfile Attach complete log as a file.

github-actions[bot] commented 1 year ago

This issue has been open for 14 days without activity. It will be closed in 5 days if not updated

ronivay commented 1 year ago

Hi,

Hmm interesting. Need to try to reproduce this. I see the official from sources documentation still doesn't mention anything about needing sudo permissions for findmnt: https://xen-orchestra.com/docs/installation.html#sudo

ronivay commented 1 year ago

Actually findmnt has been used for quite some time: https://github.com/vatesfr/xen-orchestra/pull/4003 so shouldn't be anything that was added recently, but could be that the "already mounted" situation happens so rarely that you just hit it now for the first time and this is actually missing from documentation as well. Log is quite clear that it tries to run findmnt as root there.

JSylvia007 commented 1 year ago

I wonder if it was just a one-time glitch.

I will have to do some experiments and let you know.

On Tue, Feb 28, 2023, 7:48 AM Roni Väyrynen @.***> wrote:

Actually findmnt has been used for quite some time: vatesfr/xen-orchestra#4003 https://github.com/vatesfr/xen-orchestra/pull/4003 so shouldn't be anything that was added recently.

— Reply to this email directly, view it on GitHub https://github.com/ronivay/XenOrchestraInstallerUpdater/issues/171#issuecomment-1448122146, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYQZLGFI5EMB5PMES5VXXDWZXXY7ANCNFSM6AAAAAAULICFBQ . You are receiving this because you authored the thread.Message ID: @.***>

ronivay commented 1 year ago

It could be, seems it's used in a situation when the remote is actually mounted already. This might've been overlooked in the sudo docs as well. I'll do some testing as well and report to XO repo (and fix this script) if it's just undocumented.

github-actions[bot] commented 1 year ago

This issue has been open for 14 days without activity. It will be closed in 5 days if not updated

github-actions[bot] commented 1 year ago

This issue has been open for 14 days without activity. It will be closed in 5 days if not updated

github-actions[bot] commented 1 year ago

This issue has been open for 14 days without activity. It will be closed in 5 days if not updated

ronivay commented 1 year ago

I wasn’t able to reproduce a situation where missing findmount root permissions would’ve caused other than logged error message. Remote was still mounted without issues. I guess it still makes sense to add it to sudoers file.

JSylvia007 commented 1 year ago

It could truly have been a fluke. I'm all for security first, so don't just make a change that was related to a ghost in my machine LOL.

github-actions[bot] commented 1 year ago

This issue has been open for 14 days without activity. It will be closed in 5 days if not updated

ronivay commented 1 year ago

After reading the earlier mentioned PR in XO repository again and checking the code where findmnt command is executed, it is evident that it's executed in a same way as mount and umount, as in with sudo if it's defined in configuration. I'll report this to XO repo and fix it here if that is indeed by design.

ref: https://github.com/vatesfr/xen-orchestra/pull/6835