Class: BSD::Control::Feature
- Inherits:
-
Struct
- Object
- Struct
- BSD::Control::Feature
- Defined in:
- lib/bsd/control/feature.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#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
Restores the system default for a given file.
Queries collapse
-
#disabled?(path) ⇒ Boolean
Returns true when a feature is disabled.
-
#enabled?(path) ⇒ Boolean
Returns true when a feature is enabled.
-
#invalid?(path) ⇒ Boolean
Returns true when a feature is in an invalid state (eg: the feature is both enabled and disabled at the same time).
-
#status(path) ⇒ Symbol
Returns the status of a feature for a given file.
-
#sysdef?(path) ⇒ Boolean
Returns true when the system default setting is used.
Predicates collapse
-
#aslr? ⇒ Boolean
Returns true for ‘aslr`.
-
#disallow_map32bit? ⇒ Boolean
Returns true for ‘disallow_map32bit`.
-
#harden_shm? ⇒ Boolean
Returns true for ‘harden_shm`.
-
#insecure_kmod? ⇒ Boolean
Returns true for ‘insecure_kmod`.
-
#mprotect? ⇒ Boolean
Returns true for ‘mprotect`.
-
#pageexec? ⇒ Boolean
Returns true for ‘pageexec`.
-
#prohibit_ptrace_capsicum? ⇒ Boolean
Returns true for ‘prohibit_ptrace_capsicum`.
-
#segvguard? ⇒ Boolean
Returns true for ‘segvguard`.
-
#shlibrandom? ⇒ Boolean
Returns true for ‘shlibrandom`.
Class Method Summary collapse
-
.available ⇒ Array<BSD::Control::Feature>
Returns an array of available features.
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context
4 5 6 |
# File 'lib/bsd/control/feature.rb', line 4 def context @context end |
#name ⇒ Object
Returns the value of attribute name
4 5 6 |
# File 'lib/bsd/control/feature.rb', line 4 def name @name end |
Class Method Details
.available ⇒ Array<BSD::Control::Feature>
Returns an array of available features
8 9 10 |
# File 'lib/bsd/control/feature.rb', line 8 def self.available BSD::Control.available_features end |
Instance Method Details
#aslr? ⇒ Boolean
Returns true for ‘aslr`
146 147 148 |
# File 'lib/bsd/control/feature.rb', line 146 def aslr? name == "aslr" end |
#disable!(path) ⇒ Boolean
Disables a feature for a given file
41 42 43 |
# File 'lib/bsd/control/feature.rb', line 41 def disable!(path) set!(path, DISABLED) end |
#disabled?(path) ⇒ Boolean
Returns true when a feature is disabled
79 80 81 |
# File 'lib/bsd/control/feature.rb', line 79 def disabled?(path) status(path) == :disabled end |
#disallow_map32bit? ⇒ Boolean
Returns true for ‘disallow_map32bit`
160 161 162 |
# File 'lib/bsd/control/feature.rb', line 160 def disallow_map32bit? name == "disallow_map32bit" end |
#enable!(path) ⇒ Boolean
Enables a feature for a given file
26 27 28 |
# File 'lib/bsd/control/feature.rb', line 26 def enable!(path) set!(path, ENABLED) end |
#enabled?(path) ⇒ Boolean
Returns true when a feature is enabled
69 70 71 |
# File 'lib/bsd/control/feature.rb', line 69 def enabled?(path) status(path) == :enabled end |
#harden_shm? ⇒ Boolean
Returns true for ‘harden_shm`
174 175 176 |
# File 'lib/bsd/control/feature.rb', line 174 def harden_shm? name == "harden_shm" end |
#insecure_kmod? ⇒ Boolean
Returns true for ‘insecure_kmod`
167 168 169 |
# File 'lib/bsd/control/feature.rb', line 167 def insecure_kmod? name == "insecure_kmod" end |
#invalid?(path) ⇒ Boolean
Returns true when a feature is in an invalid state (eg: the feature is both enabled and disabled at the same time)
100 101 102 |
# File 'lib/bsd/control/feature.rb', line 100 def invalid?(path) status(path) == :invalid end |
#mprotect? ⇒ Boolean
Returns true for ‘mprotect`
132 133 134 |
# File 'lib/bsd/control/feature.rb', line 132 def mprotect? name == "mprotect" end |
#pageexec? ⇒ Boolean
Returns true for ‘pageexec`
125 126 127 |
# File 'lib/bsd/control/feature.rb', line 125 def pageexec? name == "pageexec" end |
#prohibit_ptrace_capsicum? ⇒ Boolean
Returns true for ‘prohibit_ptrace_capsicum`
181 182 183 |
# File 'lib/bsd/control/feature.rb', line 181 def prohibit_ptrace_capsicum? name == "prohibit_ptrace_capsicum" end |
#segvguard? ⇒ Boolean
Returns true for ‘segvguard`
139 140 141 |
# File 'lib/bsd/control/feature.rb', line 139 def segvguard? name == "segvguard" end |
#shlibrandom? ⇒ Boolean
Returns true for ‘shlibrandom`
153 154 155 |
# File 'lib/bsd/control/feature.rb', line 153 def shlibrandom? name == "shlibrandom" end |
#status(path) ⇒ Symbol
Returns the status of a feature for a given file. Status could be: ‘:unknown`, `:enabled`, `:disabled`, `:sysdef`, or `:invalid`.
|
# File 'lib/bsd/control/feature.rb', line 104
|
#sysdef!(path) ⇒ Boolean
Restores the system default for a given file
|
# File 'lib/bsd/control/feature.rb', line 45
|
#sysdef?(path) ⇒ Boolean
Returns true when the system default setting is used
89 90 91 |
# File 'lib/bsd/control/feature.rb', line 89 def sysdef?(path) status(path) == :sysdef end |