netbox-agent icon indicating copy to clipboard operation
netbox-agent copied to clipboard

add sudo support

Open ThomasADavis opened this issue 4 years ago • 4 comments

This allows the agent to run under a non-root account

ThomasADavis avatar Jan 20 '20 23:01 ThomasADavis

Note that sudo doesn't exist by default on all distributions.

ramnes avatar Jan 21 '20 11:01 ramnes

I agree with @ramnes

What about a variable in the configuration file to enable sudo or not?

Solvik avatar Jan 21 '20 18:01 Solvik

There are currently 3 different ways to execute an external program in the code.

I can combine them into one, along with a check function that can make sure everything is installed, and if it's not complain about/ignore it.

So, for sudo, if it's installed, and you run as root, no change would be needed; if sudo is not installed, it's no problem then. if your running the agent as non-root (which you really should do), then sudo will be needed, and if it's not installed, it can stop and complain.

This will prevent partial host registrations also.

ThomasADavis avatar Jan 21 '20 20:01 ThomasADavis

@ThomasADavis I've rebased the branch on master Are you still up to make the modification mentionned in your last comment ?

Thanks!

Solvik avatar May 01 '20 17:05 Solvik