kunoichi 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/kunoichi +11 -18
  2. data/lib/kunoichi/cli.rb +3 -1
  3. metadata +8 -28
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'kunoichi'
4
4
 
5
- # Hash for commandline flags that override configuration
6
- @override_config = Hash.new
5
+ # Hash for commandline flags
6
+ @config = Hash.new
7
7
 
8
8
  # Default configuration placement
9
9
  @conf_files = [ 'config.yml', '/etc/kunoichi/config.yml' ]
@@ -12,7 +12,7 @@ begin
12
12
  opts = GetoptLong.new(
13
13
  [ '--config-file', '-c', GetoptLong::REQUIRED_ARGUMENT ],
14
14
  [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
15
- [ '--dry_run', '-n', GetoptLong::NO_ARGUMENT ],
15
+ [ '--dry-run', '-n', GetoptLong::NO_ARGUMENT ],
16
16
  [ '--import', '-i', GetoptLong::REQUIRED_ARGUMENT ],
17
17
  [ '--generate-config', '-g', GetoptLong::OPTIONAL_ARGUMENT ],
18
18
  [ '--debug', '-d', GetoptLong::NO_ARGUMENT ],
@@ -31,15 +31,15 @@ begin
31
31
  when '--config-file'
32
32
  @conf_files = [ arg ]
33
33
  when '--dry-run'
34
- @override_config['no_kill'] = true
35
- @override_config['no_kill_ppid'] = true
34
+ @config['no_kill'] = true
35
+ @config['no_kill_ppid'] = true
36
36
  when '--debug'
37
- @override_config['daemon'] = false
38
- @override_config['syslog'] = false
39
- @override_config['logfile'] = false
40
- @override_config['debug'] = true
37
+ @config['daemon'] = false
38
+ @config['syslog'] = false
39
+ @config['logfile'] = false
40
+ @config['debug'] = true
41
41
  when '--pid-file'
42
- @override_config['pidfile'] = arg
42
+ @config['pidfile'] = arg
43
43
  when '--import'
44
44
  puts import_conf arg
45
45
  exit
@@ -64,18 +64,11 @@ end
64
64
  end
65
65
 
66
66
  # If we're done attempting ad have no @config it means none could be loaded
67
- unless @config.is_a? Hash
67
+ unless @config[:loaded]
68
68
  puts 'Could not find any configuration files. Tried to load: ' + @conf_files.to_s
69
69
  exit
70
70
  end
71
71
 
72
- # Handle commandline overrides in configuration
73
- [ 'debug', 'no_kill', 'no_kill_ppid', 'daemon', 'syslog', 'logfile', 'pidfile' ].each do |flag|
74
- unless @override_config[flag].nil?
75
- @config[flag] = @override_config[flag]
76
- end
77
- end
78
-
79
72
  # Start kunoichi
80
73
  begin
81
74
  Kunoichi::Daemon.new @config
@@ -15,11 +15,13 @@ end
15
15
  # Try to include yaml configuration
16
16
  def include_conf(file)
17
17
  begin
18
- raise 'empty file' unless @config = YAML.load_file(file)
18
+ raise 'empty file' unless readconf = YAML.load_file(file)
19
19
  rescue => e
20
20
  puts "Cannot load configuration: #{e.message}"
21
21
  exit
22
22
  end
23
+ @config = readconf.merge! @config
24
+ @config[:loaded] = true
23
25
  end
24
26
 
25
27
  # Parse a ninja configuration file and return kunoichi yaml configuration
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kunoichi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,27 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-03 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: logger
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 1.2.8
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 1.2.8
30
14
  - !ruby/object:Gem::Dependency
31
15
  name: syslog-logger
32
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &2156506320 !ruby/object:Gem::Requirement
33
17
  none: false
34
18
  requirements:
35
19
  - - ~>
@@ -37,12 +21,7 @@ dependencies:
37
21
  version: 1.6.8
38
22
  type: :runtime
39
23
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 1.6.8
24
+ version_requirements: *2156506320
46
25
  description: A Ruby rewrite of Tom Rune Flo's Ninja, a privilege escalation monitor.
47
26
  email:
48
27
  - alessandro@aggro.it
@@ -52,11 +31,12 @@ extensions: []
52
31
  extra_rdoc_files: []
53
32
  files:
54
33
  - lib/extensions/object.rb
55
- - lib/kunoichi.rb
56
34
  - lib/kunoichi/cli.rb
57
35
  - lib/kunoichi/kunoichi.rb
58
36
  - lib/kunoichi/proctable.rb
59
- - bin/kunoichi
37
+ - lib/kunoichi.rb
38
+ - !binary |-
39
+ YmluL2t1bm9pY2hp
60
40
  homepage: https://github.com/xstasi/kunoichi
61
41
  licenses: []
62
42
  post_install_message:
@@ -77,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
57
  version: '0'
78
58
  requirements: []
79
59
  rubyforge_project:
80
- rubygems_version: 1.8.24
60
+ rubygems_version: 1.8.11
81
61
  signing_key:
82
62
  specification_version: 3
83
63
  summary: Process privilege escalation monitor