Class: Ardecy::Harden::Perms::DirCheck
- Inherits:
-
Object
- Object
- Ardecy::Harden::Perms::DirCheck
- Includes:
- Display
- Defined in:
- lib/ardecy/harden/perms.rb
Direct Known Subclasses
Ardecy::Harden::Perms::Directory::Boot, Ardecy::Harden::Perms::Directory::CronDaily, Ardecy::Harden::Perms::Directory::Home, Ardecy::Harden::Perms::Directory::LibMod, Ardecy::Harden::Perms::Directory::UsrLibMod, Ardecy::Harden::Perms::Directory::UsrSrc
Instance Method Summary collapse
- #fix ⇒ Object
-
#initialize(args) ⇒ DirCheck
constructor
A new instance of DirCheck.
- #scan ⇒ Object
- #x ⇒ Object
Methods included from Display
#display_fix_list, #kernel_show, #perm_show, #result, #show_bad_mod, #title
Constructor Details
#initialize(args) ⇒ DirCheck
Returns a new instance of DirCheck.
11 12 13 14 15 16 |
# File 'lib/ardecy/harden/perms.rb', line 11 def initialize(args) @args = args @res = 'OK' @exp = 0755 @tab = 2 end |
Instance Method Details
#fix ⇒ Object
34 35 36 37 38 |
# File 'lib/ardecy/harden/perms.rb', line 34 def fix return unless @args[:fix] File.chmod @exp, @name unless @res =~ /OK/ end |
#scan ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ardecy/harden/perms.rb', line 23 def scan return unless Dir.exist? @name perm = File.stat(@name).mode & 07777 @line = "Permission on #{@name}" perm_show(@line, @exp) if @args[:audit] @res = 'FAIL' if perm > @exp @tab ? result(@res, @tab) : result(@res) if @args[:audit] end |
#x ⇒ Object
18 19 20 21 |
# File 'lib/ardecy/harden/perms.rb', line 18 def x scan fix end |