Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hbsdctl.rb

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hbsdctl.rb

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

About

hbsdctl.rb provides Ruby bindings for libhbsdcontrol from the hardenedbsd project. Through this library, you can query what features are available and if root: enable, disable or query the status of a feature for a given file.

Examples

Features

As an unprivileged user or as a superuser, you can obtain a list of available features:

#!/usr/bin/env ruby
# Required privileges: unprivileged user or superuser.
require "hbsdctl"
BSD::Control
  .available_features
  .each do
  print "The ", _1.name, " feature is available", "\n"
end

Enable

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

#!/usr/bin/env ruby
# Required privileges: superuser.
require "hbsdctl"
BSD::Control
  .feature(:mprotect)
  .enable!("/usr/local/bin/emacs-29.2")

Status

As a superuser, you can query the status of a feature for a given file. There are four statuses that can be returned: conflict, sysdef, 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 status indicates that a feature takes its settings from the system default (sysctl):

#!/usr/bin/env ruby
# Required privileges: superuser.
require "hbsdctl"
BSD::Control
  .feature(:mprotect)
  .status("/bin/ls") # => :sysdef

Documentation

A complete API reference is available at 0x1eef.github.io/x/hbsdctl.rb.

Install

Rubygems.org

hbsdctl.rb can be installed via rubygems.org.

gem install hbsdctl.rb

Sources

License

BSD Zero Clause.
See LICENSE.

FAQs

Package last updated on 14 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc