Closed peercoinops closed 7 years ago
Can you explain what is the problem here?
Let's say I use the net install of minimal raspbian which is the root user. Installing Peerbox no other system account is created. I would need to manually create a system account to run and manage Peerbox/ppcoind so that it does not run as root. If Peerbox upon install created these accounts then this step would be unneeded. This system account is the same idea behind webservers like nginx,apache which create system accounts to run as the process and only root to get any required priveleges such as port 80.
If Peerbox runs as root or with ``sudo" this would also mean that the files and process is as root user, which also as seen by the user using sudo causes other issues. By having a system account, even running as sudo would ensure that Peerbox runs as the system account rather than root.
More generally, if the Pi running Peerbox is shared with other services, it seems that it would be better to restrict Peerbox process and related files to a separate account.
For the postinst script, creating a user 'peerbox' similar to how postgres user is created
In peercoin_rpc.py there is a call to getpass. So if try to run as sudo this call would fail, though ppcoind would still start as peerbox user.
with open('/home/{0}/.ppcoin/ppcoin.conf'.format(getpass.getuser()), 'r') as conf:
Another thing with this change is that when running peerbox it should be ran as the peerbox user, otherwise it won't be able to access the ppcoin configuration. I guess that's the same behavior though as existing peerbox.
There are quite a few places in the code where it relies on getpass.getuser(), since it seems it assumes there might be multiple instances of ppcoind running. Too many changes to make.
I might just make a separate script available for those that want to use it.
Peerbox user (maybe "peerbox"?) so that the process runs as non-root system account. sudo access only to start,stop, and restart ppcoind daemon.
All processes, folders, configuration should also be owned by this system account.