Class: Puppet::Provider::Nexpose
- Inherits:
-
Puppet::Provider
- Object
- Puppet::Provider
- Puppet::Provider::Nexpose
- Defined in:
- lib/puppet/provider/nexpose.rb
Overview
Nexpose class
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.check_password(user, password) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/puppet/provider/nexpose.rb', line 30 def self.check_password(user, password) @conf = config nsc = Connection.new(@conf['server'], user, password, @conf['port']) begin nsc.login rescue false end end |
.config ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/puppet/provider/nexpose.rb', line 6 def self.config @api_file = '/opt/rapid7/nexpose/nsc/conf/api.conf' @conf = { 'user' => 'nxadmin', 'password' => 'nxpassword', 'server' => 'localhost', 'port' => 443, } if File.file?(@api_file) File.open(@api_file, 'r') do |f| f.each_line do |line| tokens = line.strip.split('=') @conf[tokens[0]] = tokens[1] end end end @conf end |
.connection ⇒ Object
25 26 27 28 |
# File 'lib/puppet/provider/nexpose.rb', line 25 def self.connection @conf = config Connection.new(@conf['server'], @conf['user'], @conf['password'], @conf['port']) end |
Instance Method Details
#check_password(user, password) ⇒ Object
44 45 46 |
# File 'lib/puppet/provider/nexpose.rb', line 44 def check_password(user, password) self.class.check_password(user, password) end |
#connection ⇒ Object
40 41 42 |
# File 'lib/puppet/provider/nexpose.rb', line 40 def connection self.class.connection end |