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

harden daemon on OpenBSD #1815

Merged
merged 2 commits into from
Apr 9, 2022
Merged

harden daemon on OpenBSD #1815

merged 2 commits into from
Apr 9, 2022

Conversation

timkuijsten
Copy link
Contributor

@timkuijsten timkuijsten commented Feb 22, 2022

I've created a patch to harden the daemon on OpenBSD by using pledge(2) and unveil(2). This way the program gets killed if any syscall is called other than the basic networking or file system ones, preventing further exploitation of a system once a program is compromised. Furthermore, the view of the file system is restricted to only access the files and directories the daemon needs.

Restrict the available set of system calls to the daemon to the basic
network and filesystem operations on OpenBSD. Further reduce potential
harm by limiting file system access to the btcd data dir and the rpc
files.
@timkuijsten timkuijsten changed the title harden daemon harden daemon and btcctl on OpenBSD Feb 22, 2022
@jcvernaleo
Copy link
Member

Love the idea of taking advantage of pledge!

Looks like the tests are failing in the GH actions though (which run on linux).

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2140366923

  • 9 of 31 (29.03%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 54.167%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ossec/ossec.go 3 9 33.33%
btcd.go 6 22 27.27%
Totals Coverage Status
Change from base Build 2067189692: -0.01%
Covered Lines: 24776
Relevant Lines: 45740

💛 - Coveralls

@timkuijsten
Copy link
Contributor Author

Looks like the tests are failing in the GH actions though (which run on linux).

This is fixed now.

Whether or not we would like to pledge tools like btcctl is something we can decide later and IMHO not as important as seat belting the daemon.

@timkuijsten timkuijsten changed the title harden daemon and btcctl on OpenBSD harden daemon on OpenBSD Apr 9, 2022
@jcvernaleo jcvernaleo self-assigned this Apr 9, 2022
Copy link
Member

@jcvernaleo jcvernaleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

OK

@jcvernaleo
Copy link
Member

@timkuijsten totally agree that daemon is the most important target for pledge. Other tools are less vital but all else being equal, the more things that use pledge, the better.

@jcvernaleo jcvernaleo merged commit 3faf68c into btcsuite:master Apr 9, 2022
@timkuijsten timkuijsten deleted the pledge branch April 9, 2022 12:00
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

Successfully merging this pull request may close these issues.

3 participants