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

Read wallet password from the file #1610

Closed
themantre opened this issue Nov 22, 2024 · 1 comment · Fixed by #1653
Closed

Read wallet password from the file #1610

themantre opened this issue Nov 22, 2024 · 1 comment · Fixed by #1653
Assignees
Milestone

Comments

@themantre
Copy link
Contributor

Describe the problem you'd like to have solved

Currently, to start the node, the user must provide the wallet password as an argument to the pactus-daemon executable. This approach is particularly vulnerable, even if pactus-daemon is run as sudo by a non-root user. For example, if the server gets compromised, it is easy to retrieve the wallet password without needing the sudo password by using a command like:

ps -p $(pidof pactus-daemon) -o args

Describe the ideal solution

To improve the security of the node, we can store the password in a file that is readable only by sudo. Then, the pactus-daemon process can be run with sudo and read the password from this file. This approach enhances security by protecting the wallet password with the sudo password.

@Ja7ad
Copy link
Contributor

Ja7ad commented Nov 25, 2024

Describe the problem you'd like to have solved

Currently, to start the node, the user must provide the wallet password as an argument to the pactus-daemon executable. This approach is particularly vulnerable, even if pactus-daemon is run as sudo by a non-root user. For example, if the server gets compromised, it is easy to retrieve the wallet password without needing the sudo password by using a command like:

ps -p $(pidof pactus-daemon) -o args

Describe the ideal solution

To improve the security of the node, we can store the password in a file that is readable only by sudo. Then, the pactus-daemon process can be run with sudo and read the password from this file. This approach enhances security by protecting the wallet password with the sudo password.

@b00f Currently, we have switched from reading the password using --password foobar to defining a new switch, --password-from-file /home/user/password.txt, to read the password from a file.

By defining a file with root access, no significant logic changes are required. We simply need a switch to read the file and extract the password from its content.

echo "your-secure-password" > /etc/pactus/wallet-password
chmod 600 /etc/pactus/wallet-password
chown root:root /etc/pactus/wallet-password

@Ja7ad Ja7ad self-assigned this Nov 25, 2024
@Ja7ad Ja7ad added this to the v1.7.0 milestone Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants