Class: Ardecy::Harden::Modules::Drop
- Inherits:
-
Object
- Object
- Ardecy::Harden::Modules::Drop
show all
- Includes:
- Display
- Defined in:
- lib/ardecy/harden/modules.rb
Direct Known Subclasses
Blacklist::Af802154, Blacklist::Appletalk, Blacklist::Atm, Blacklist::Ax25, Blacklist::Can, Blacklist::CramFs, Blacklist::Dccp, Blacklist::Decnet, Blacklist::Econet, Blacklist::FreevxFs, Blacklist::HFs, Blacklist::HFsplus, Blacklist::Ipx, Blacklist::Jffs2, Blacklist::NHdlc, Blacklist::Netrom, Blacklist::P8022, Blacklist::P8023, Blacklist::Psnap, Blacklist::Rds, Blacklist::Rose, Blacklist::Sctp, Blacklist::SquashFs, Blacklist::Tipc, Blacklist::Udf, Blacklist::UvcVideo, Blacklist::Vivid, Blacklist::X25
Instance Method Summary
collapse
Methods included from Display
#display_fix_list, #kernel_show, #perm_show, #result, #show_bad_mod, #title
Constructor Details
#initialize(args) ⇒ Drop
Returns a new instance of Drop.
13
14
15
16
|
# File 'lib/ardecy/harden/modules.rb', line 13
def initialize(args)
@res = 'OK'
@args = args
end
|
Instance Method Details
#fix ⇒ Object
43
44
45
46
47
|
# File 'lib/ardecy/harden/modules.rb', line 43
def fix
return if @res =~ /OK/
BLACKLIST << "install #{@name} /bin/false"
end
|
#quit_unless_modules ⇒ Object
18
19
20
21
22
23
|
# File 'lib/ardecy/harden/modules.rb', line 18
def quit_unless_modules
unless File.exist? '/proc/modules'
warn '/proc/modules no found'
exit 1
end
end
|
#research_found ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/ardecy/harden/modules.rb', line 25
def research_found
quit_unless_modules
File.readlines('/proc/modules').each do |l|
return true if l =~ /^#{@name}/
end
false
end
|
#x ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/ardecy/harden/modules.rb', line 34
def x
@res = 'FAIL' if research_found
if @args[:audit]
show_bad_mod(@name)
@tab ? result(@res, @tab) : result(@res)
end
fix
end
|