Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does tuptime need root? #13

Closed
anarcat opened this issue Nov 25, 2015 · 7 comments
Closed

does tuptime need root? #13

anarcat opened this issue Nov 25, 2015 · 7 comments

Comments

@anarcat
Copy link
Contributor

anarcat commented Nov 25, 2015

it looks like tuptime runs as root all the time... is that really necessary?

couldn't it be running as a dedicated user?

@rfrail3
Copy link
Collaborator

rfrail3 commented Nov 27, 2015

It's not neccesary, I picked up root for avoid than the other users modified the data base file.

Do you consider right the creation of an user "tuptime"? There is no problem.

@anarcat
Copy link
Contributor Author

anarcat commented Nov 27, 2015

we could create a tuptime user, of course, in the debian package. this is fairly standard procedure.

i just wonder what would happen if a regular user would run tuptime without write access to the database - won't sqlite try to lock it and fail?

@rfrail3
Copy link
Collaborator

rfrail3 commented Nov 27, 2015

That scenario is covered, only the user that have write permission can upload the database registers, any other unprivileged user can only read it, but both will have the same values.

For example, if tuptime was installed with root and you run it with a normal user enabling verbose mode, these two lines are printed:

WARNING values not saved into db - Test file permissions
WARNING attempt to write a readonly database

But, the values are updated internally in python execution without writing anyting. The only exception is the first execution after a startup. In that case, if you do the same, the message is:

ERROR After system restart, the values must be saved into db. Please, execute tuptime with a privileged user.

But it is a uncommon case, because if the init manager execute it, any user fall in the example case at the top.

@anarcat
Copy link
Contributor Author

anarcat commented Nov 27, 2015

right, okay. i will let you do a release then will work on creating a user in the debian package.

you can also do it yourself if you wish. i think it should only be a matter of changing the cron job, the service file, and adding/removing a user in the debian/post* scripts. A recent example of this in a debian package i maintain is willie:

https://sources.debian.net/src/willie/5.5.1-1/debian/postrm/#L28
https://sources.debian.net/src/willie/5.5.1-1/debian/postrm/#L28
https://sources.debian.net/src/willie/5.5.1-1/debian/init.d/#L50

note that, in the debian package, you may want to ship the init.d file properly as well, to support users who do not wish to run systemd, which is still supported in debian...

@rfrail3
Copy link
Collaborator

rfrail3 commented Nov 28, 2015

Off course, let me the time for do it...

@anarcat
Copy link
Contributor Author

anarcat commented Nov 29, 2015

no problem, of course. :)

@rfrail3
Copy link
Collaborator

rfrail3 commented Dec 10, 2015

Hi Anarcat,

It's done, please, review it.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants