Class: BSD::Control::Feature
- Inherits:
-
Struct
- Object
- Struct
- BSD::Control::Feature
- Defined in:
- lib/bsd/control/feature.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#context ⇒ Object
Returns the value of attribute context.
Actions collapse
-
#enable!(path) ⇒ Boolean
Enables a feature for a given file.
-
#disable!(path) ⇒ Boolean
Disables a feature for a given file.
-
#sysdef!(path) ⇒ Boolean
Restores the system default for a given file.
Queries collapse
-
#enabled?(path) ⇒ Boolean
Returns true when a feature is enabled.
-
#disabled?(path) ⇒ Boolean
Returns true when a feature is disabled.
-
#sysdef?(path) ⇒ Boolean
Returns true when the system default setting is used.
-
#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.
Predicates collapse
-
#prohibit_ptrace_capsicum? ⇒ Boolean
Returns true for
prohibit_ptrace_capsicum
. -
#pageexec? ⇒ Boolean
Returns true for
pageexec
. -
#mprotect? ⇒ Boolean
Returns true for
mprotect
. -
#segvguard? ⇒ Boolean
Returns true for
segvguard
. -
#aslr? ⇒ Boolean
Returns true for
aslr
. -
#shlibrandom? ⇒ Boolean
Returns true for
shlibrandom
. -
#disallow_map32bit? ⇒ Boolean
Returns true for
disallow_map32bit
. -
#insecure_kmod? ⇒ Boolean
Returns true for
insecure_kmod
. -
#harden_shm? ⇒ Boolean
Returns true for
harden_shm
.
Class Method Summary collapse
-
.available ⇒ Array<BSD::Control::Feature>
Returns an array of available features.
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
4 5 6 |
# File 'lib/bsd/control/feature.rb', line 4 def name @name end |
#context ⇒ Object
Returns the value of attribute context
4 5 6 |
# File 'lib/bsd/control/feature.rb', line 4 def context @context 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
#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 |
#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 |
#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 |
#sysdef!(path) ⇒ Boolean
Restores the system default for a given file
|
# File 'lib/bsd/control/feature.rb', line 45
|
#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 |
#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 |
#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 |
#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 |
#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
|
#pageexec? ⇒ Boolean
Returns true for pageexec
125 126 127 |
# File 'lib/bsd/control/feature.rb', line 125 def pageexec? name == "pageexec" end |
#mprotect? ⇒ Boolean
Returns true for mprotect
132 133 134 |
# File 'lib/bsd/control/feature.rb', line 132 def mprotect? name == "mprotect" end |
#segvguard? ⇒ Boolean
Returns true for segvguard
139 140 141 |
# File 'lib/bsd/control/feature.rb', line 139 def segvguard? name == "segvguard" end |
#aslr? ⇒ Boolean
Returns true for aslr
146 147 148 |
# File 'lib/bsd/control/feature.rb', line 146 def aslr? name == "aslr" end |
#shlibrandom? ⇒ Boolean
Returns true for shlibrandom
153 154 155 |
# File 'lib/bsd/control/feature.rb', line 153 def shlibrandom? name == "shlibrandom" 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 |
#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 |
#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 |