There are non-root restrictions on the execution rights of the Proxmox CLI?

Gordon Kaltofen

New Member
Jul 28, 2014
8
0
1
Berlin
www.dresearch-fe.de
I have a question about a product feature.

There are non-root restrictions on the execution rights of the Proxmox CLI? I have found nothing in this regard in the wiki or iNet.

I've added an additional user 'jenkins' for automation, written in the WIKI. This remote login should not be 'root' just because the login is done without entering a password via preshared keys.

Since the CLI command 'qm' but is in '/usr/sbin', it needs sudoers rights.

1) First idea:
Configuration via '/etc/sudoers' with this line:

%jenkins ALL = NOPASSWD: /usr/sbin/qm

This means that users of the group 'jenkins' allowed to execute the command '/usr/sbin/qm' without entering the password.

But there is not this file. Is this type of configuration is not provided?

2) Second Idea: temporary workaound




If it does not work without root privileges, then jenkins to group 'root' to add.



Nevertheless, the execution of the command 'qm' is denied.

jenkins@testbed:~$ /usr/sbin/qm --help
please run as root

But I actually have this permission as member of root group.:(

If it should be relevant: In Proxmox VE Web-GUI is this user 'jenkins' member of group 'jenkins' with group role 'Administrator'.


Hence the question: work commands the CLI exclusively with the root account?

Thx for answers,
Gordon
 
1) First idea:
Configuration via '/etc/sudoers' with this line:

%jenkins ALL = NOPASSWD: /usr/sbin/qm

This means that users of the group 'jenkins' allowed to execute the command '/usr/sbin/qm' without entering the password.

But there is not this file. Is this type of configuration is not provided?

You need to install sudo package, then edit the /etc/sudoers file, after which you'll be able to execute sudo /usr/sbin/qm.
 
Thank you Aleksandrs for the good hint. That's worth a try.

Unfortunately, this probably will not solve my other problem with CLI. Therefore, it is better to follow Dietmar's probably recommendation and use the API instead of the CLI. It probably makes sense to write an API wrapper for scripting.

Thank you all for your efforts, guys.
 
Thanks Aleksandrs, that's a good indication - per se.

But, unfortunately, that will not solve my other problem with the CLI. Therefore, it makes sense to follow Dietmar's recommendation and instead use the API. It probably makes sense to write an API wrapper for scripting, but something is always.

Thank you for your efforts.
 
I have found a satisfactory solution. I use the pvesh command for API access via SSH.

Now the restricted user jenkins can execute the command pvesh without PW via SSH. I have shell wrapper scripts written to manage the VMs. To access the JSON objects in shell scripts, the program jq is very suitable.

Thanks again to everyone for all the hints and ideas.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!