Class: BSD::Control::Feature
- Inherits:
-
Struct
- Object
- Struct
- BSD::Control::Feature
- Defined in:
- lib/bsd/control/feature.rb
Instance Attribute Summary collapse
-
#disable ⇒ Object
Returns the value of attribute disable.
-
#enable ⇒ Object
Returns the value of attribute enable.
-
#name ⇒ Object
Returns the value of attribute name.
Actions collapse
-
#disable!(path) ⇒ Boolean
Disables a feature for a given file.
-
#enable!(path) ⇒ Boolean
Enables a feature for a given file.
-
#sysdef!(path) ⇒ Boolean
Restore system defaults for a given file.
Queries collapse
-
#conflict?(path) ⇒ Boolean
Returns true when a feature is in conflict (i.e: the feature is both enabled and disabled at the same time).
-
#disabled?(path) ⇒ Boolean
Returns true when a feature is disabled for a given file.
-
#enabled?(path) ⇒ Boolean
Returns true when a feature is enabled for a given file.
-
#status(path) ⇒ Symbol
Returns the status of a feature for a given file.
-
#sysdef?(path) ⇒ Boolean
Returns true when a feature is configured to use the system default.
Predicates collapse
-
#aslr? ⇒ Boolean
Returns true for the ASLR feature.
-
#disallow_map32bit? ⇒ Boolean
Returns true for the disallow-map32bit feature.
-
#harden_shm? ⇒ Boolean
Returns true for the harden SHM feature.
-
#insecure_kmod? ⇒ Boolean
Returns true for the insecure kmod feature.
-
#mprotect? ⇒ Boolean
Returns true for the mprotect feature.
-
#pageexec? ⇒ Boolean
Returns true for the pageexec feature.
-
#prohibit_ptrace_capsicum? ⇒ Boolean
Returns true for the prohibit ptrace capsicum feature.
-
#segvguard? ⇒ Boolean
Returns true for the segv-guard feature.
-
#shlibrandom? ⇒ Boolean
Returns true for the shlibrandom feature.
Class Method Summary collapse
-
.available ⇒ Array<BSD::Control::Feature>
Returns an array of available features.
Instance Attribute Details
#disable ⇒ Object
Returns the value of attribute disable
2 3 4 |
# File 'lib/bsd/control/feature.rb', line 2 def disable @disable end |
#enable ⇒ Object
Returns the value of attribute enable
2 3 4 |
# File 'lib/bsd/control/feature.rb', line 2 def enable @enable end |
#name ⇒ Object
Returns the value of attribute name
2 3 4 |
# File 'lib/bsd/control/feature.rb', line 2 def name @name end |
Class Method Details
.available ⇒ Array<BSD::Control::Feature>
Returns an array of available features.
6 7 8 |
# File 'lib/bsd/control/feature.rb', line 6 def self.available BSD::Control::FFI.available_features end |
Instance Method Details
#aslr? ⇒ Boolean
Returns true for the ASLR feature.
149 150 151 |
# File 'lib/bsd/control/feature.rb', line 149 def aslr? name == "aslr" end |
#conflict?(path) ⇒ Boolean
Returns true when a feature is in conflict (i.e: the feature is both enabled and disabled at the same time).
100 101 102 |
# File 'lib/bsd/control/feature.rb', line 100 def conflict?(path) status(path) == :conflict end |
#disable!(path) ⇒ Boolean
Disables a feature for a given file.
39 40 41 |
# File 'lib/bsd/control/feature.rb', line 39 def disable!(path) set!(path, BSD::Control::Disable) end |
#disabled?(path) ⇒ Boolean
Returns true when a feature is disabled for a given file.
79 80 81 |
# File 'lib/bsd/control/feature.rb', line 79 def disabled?(path) status(path) == :disabled end |
#disallow_map32bit? ⇒ Boolean
Returns true for the disallow-map32bit feature.
163 164 165 |
# File 'lib/bsd/control/feature.rb', line 163 def disallow_map32bit? name == "disallow_map32bit" end |
#enable!(path) ⇒ Boolean
Enables a feature for a given file.
24 25 26 |
# File 'lib/bsd/control/feature.rb', line 24 def enable!(path) set!(path, BSD::Control::Enable) end |
#enabled?(path) ⇒ Boolean
Returns true when a feature is enabled for a given file.
69 70 71 |
# File 'lib/bsd/control/feature.rb', line 69 def enabled?(path) status(path) == :enabled end |
#harden_shm? ⇒ Boolean
Returns true for the harden SHM feature.
177 178 179 |
# File 'lib/bsd/control/feature.rb', line 177 def harden_shm? name == "harden_shm" end |
#insecure_kmod? ⇒ Boolean
Returns true for the insecure kmod feature.
170 171 172 |
# File 'lib/bsd/control/feature.rb', line 170 def insecure_kmod? name == "insecure_kmod" end |
#mprotect? ⇒ Boolean
Returns true for the mprotect feature.
135 136 137 |
# File 'lib/bsd/control/feature.rb', line 135 def mprotect? name == "mprotect" end |
#pageexec? ⇒ Boolean
Returns true for the pageexec feature.
128 129 130 |
# File 'lib/bsd/control/feature.rb', line 128 def pageexec? name == "pageexec" end |
#prohibit_ptrace_capsicum? ⇒ Boolean
Returns true for the prohibit ptrace capsicum feature.
184 185 186 |
# File 'lib/bsd/control/feature.rb', line 184 def prohibit_ptrace_capsicum? name == "prohibit_ptrace_capsicum" end |
#segvguard? ⇒ Boolean
Returns true for the segv-guard feature.
142 143 144 |
# File 'lib/bsd/control/feature.rb', line 142 def segvguard? name == "segvguard" end |
#shlibrandom? ⇒ Boolean
Returns true for the shlibrandom feature.
156 157 158 |
# File 'lib/bsd/control/feature.rb', line 156 def shlibrandom? name == "shlibrandom" end |
#status(path) ⇒ Symbol
Returns the status of a feature for a given file. Status can be one of: ‘:conflict`, `:sysdef`, `:enabled`, `:disabled`.
114 115 116 117 118 |
# File 'lib/bsd/control/feature.rb', line 114 def status(path) FFI.status(self, path) rescue Errno::ENOATTR :sysdef end |
#sysdef!(path) ⇒ Boolean
Restore system defaults for a given file.
54 55 56 |
# File 'lib/bsd/control/feature.rb', line 54 def sysdef!(path) FFI.sysdef!(self, path) end |
#sysdef?(path) ⇒ Boolean
Returns true when a feature is configured to use the system default.
89 90 91 |
# File 'lib/bsd/control/feature.rb', line 89 def sysdef?(path) status(path) == :sysdef end |