Ruby bindings for libhbsdcontrol(3)
Find a file
2024-03-01 16:19:29 -03:00
.bundle First commit 2024-02-29 22:29:43 -03:00
ext/hbsdctl.rb Define BSD::Control::Feature#set! as private 2024-03-01 16:19:29 -03:00
lib Add BSD::Control.library_version 2024-03-01 01:28:54 -03:00
.gitignore First commit 2024-02-29 22:29:43 -03:00
.projectile First commit 2024-02-29 22:29:43 -03:00
Gemfile First commit 2024-02-29 22:29:43 -03:00
Gemfile.lock First commit 2024-02-29 22:29:43 -03:00
hbsdctl.rb.gemspec gemspec: update 2024-02-29 23:32:15 -03:00
LICENSE Add LICENSE 2024-02-29 22:35:05 -03:00
Rakefile.rb First commit 2024-02-29 22:29:43 -03:00
README.md s/executable/path/g 2024-03-01 01:05:42 -03:00

About

hbsdctl.rb is a Ruby C extension that binds libhbsdcontrol from the hardenedbsd project. Through this library, you can query what features are available and if root, enable or disable those features for a given file.

Examples

Available features

As a regular user account, you can obtain a list of available features. But to enable or disable those features a superuser account is required:

#!/usr/bin/env ruby
# As a regular user account
require 'hbsdctl'
BSD::Control
  .available_features
  .each do
  print "The ", _1.name, " feature is available", "\n"
end

Enable feature

As a superuser account, you can enable or disable features for a given file. The example enables the mprotect feature for the emacs binary:

#!/usr/bin/env ruby
# As a root account
require 'hbsdctl'
BSD::Control
  .feature!(:mprotect)
  .enable!("/usr/local/bin/emacs")

Install

Git

hbsdctl.rb is distributed as a RubyGem through its git repositories.
GitHub, and GitLab are available as sources.

Rubygems.org

hbsdctl.rb can also be installed via rubygems.org.

gem install hbsdctl.rb

License

BSD Zero Clause.
See LICENSE.