README:update

This commit is contained in:
0x1eef 2024-03-14 16:15:50 -03:00
parent a530104ae4
commit 93e04cb8b3

View file

@ -1,7 +1,7 @@
## About ## About
hbsdctl.rb is a C extension that binds libhbsdcontrol from the hbsdctl.rb provides Ruby bindings for libhbsdcontrol from the
[hardenedbsd](https://hardenedbsd.org) project to Ruby. Through [hardenedbsd](https://hardenedbsd.org) project. Through
this library, you can query what features are available and if this library, you can query what features are available and if
root: enable, disable or query the status of a feature for a root: enable, disable or query the status of a feature for a
given file. given file.
@ -10,11 +10,12 @@ given file.
__Features__ __Features__
As a regular user account, you can obtain a list of available features: As an unprivileged user or as a superuser, you can obtain a list of
available features:
``` ruby ``` ruby
#!/usr/bin/env ruby #!/usr/bin/env ruby
# As a regular user account # Required privileges: unprivileged user or superuser.
require "hbsdctl" require "hbsdctl"
BSD::Control BSD::Control
.available_features .available_features
@ -25,12 +26,12 @@ end
__Enable__ __Enable__
As a superuser account, you can enable or disable a feature for a given file. As a superuser, you can enable or disable a feature for a given file.
The example enables the mprotect feature for the emacs binary: The example enables the mprotect feature for the emacs binary:
``` ruby ``` ruby
#!/usr/bin/env ruby #!/usr/bin/env ruby
# As a superuser account # Required privileges: superuser.
require "hbsdctl" require "hbsdctl"
BSD::Control BSD::Control
.feature(:mprotect) .feature(:mprotect)
@ -39,15 +40,15 @@ BSD::Control
__Status__ __Status__
As a superuser account, you can query whether or not a feature is enabled or disabled As a superuser, you can query the status of a feature for a given file.
for a given file. There are four statuses that can be returned: `conflict`, `sysdef`, There are four statuses that can be returned: `conflict`, `sysdef`,
`enabled`, and `disabled`. The first status (conflict) is rare and indicates that a `enabled`, and `disabled`. The first status (conflict) is rare and indicates that a
feature is both enabled and disabled. The other three are more common. The `sysdef` feature is both enabled and disabled. The other three are more common. The `sysdef`
status indicates that a feature takes its settings from the system default (sysctl): status indicates that a feature takes its settings from the system default (sysctl):
``` ruby ``` ruby
#!/usr/bin/env ruby #!/usr/bin/env ruby
# As a superuser account # Required privileges: superuser.
require "hbsdctl" require "hbsdctl"
BSD::Control BSD::Control
.feature(:mprotect) .feature(:mprotect)
@ -63,7 +64,7 @@ A complete API reference is available at
**Rubygems.org** **Rubygems.org**
hbsdctl.rb can also be installed via rubygems.org. hbsdctl.rb can be installed via rubygems.org.
gem install hbsdctl.rb gem install hbsdctl.rb