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
166 167 168 |
# File 'lib/bsd/control/feature.rb', line 166 def prohibit_ptrace_capsicum? name == "prohibit_ptrace_capsicum" end |
#enable!(path) ⇒ Boolean
Enables a feature for a given file
23 24 25 |
# File 'lib/bsd/control/feature.rb', line 23 def enable!(path) set!(path, ENABLED) end |
#disable!(path) ⇒ Boolean
Disables a feature for a given file
35 36 37 |
# File 'lib/bsd/control/feature.rb', line 35 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 39
|
#enabled?(path) ⇒ Boolean
Returns true when a feature is enabled
59 60 61 |
# File 'lib/bsd/control/feature.rb', line 59 def enabled?(path) status(path) == :enabled end |
#disabled?(path) ⇒ Boolean
Returns true when a feature is disabled
68 69 70 |
# File 'lib/bsd/control/feature.rb', line 68 def disabled?(path) status(path) == :disabled end |
#sysdef?(path) ⇒ Boolean
Returns true when the system default setting is used
77 78 79 |
# File 'lib/bsd/control/feature.rb', line 77 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)
87 88 89 |
# File 'lib/bsd/control/feature.rb', line 87 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 91
|
#pageexec? ⇒ Boolean
Returns true for pageexec
110 111 112 |
# File 'lib/bsd/control/feature.rb', line 110 def pageexec? name == "pageexec" end |
#mprotect? ⇒ Boolean
Returns true for mprotect
117 118 119 |
# File 'lib/bsd/control/feature.rb', line 117 def mprotect? name == "mprotect" end |
#segvguard? ⇒ Boolean
Returns true for segvguard
124 125 126 |
# File 'lib/bsd/control/feature.rb', line 124 def segvguard? name == "segvguard" end |
#aslr? ⇒ Boolean
Returns true for aslr
131 132 133 |
# File 'lib/bsd/control/feature.rb', line 131 def aslr? name == "aslr" end |
#shlibrandom? ⇒ Boolean
Returns true for shlibrandom
138 139 140 |
# File 'lib/bsd/control/feature.rb', line 138 def shlibrandom? name == "shlibrandom" end |
#disallow_map32bit? ⇒ Boolean
Returns true for disallow_map32bit
145 146 147 |
# File 'lib/bsd/control/feature.rb', line 145 def disallow_map32bit? name == "disallow_map32bit" end |
#insecure_kmod? ⇒ Boolean
Returns true for insecure_kmod
152 153 154 |
# File 'lib/bsd/control/feature.rb', line 152 def insecure_kmod? name == "insecure_kmod" end |
#harden_shm? ⇒ Boolean
Returns true for harden_shm
159 160 161 |
# File 'lib/bsd/control/feature.rb', line 159 def harden_shm? name == "harden_shm" end |