rex-socket 0.1.7 → 0.1.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92ddd973eb7d16ebd11f040c398d294c62f8caf3
4
- data.tar.gz: 59c01a8084132ba7df79382a23ff6ab835a5480e
3
+ metadata.gz: 18bb58a6a55981a1a6e883d7a60f99851162d6f8
4
+ data.tar.gz: 66d105060da27f4303522d2947196abab1bb58b1
5
5
  SHA512:
6
- metadata.gz: 4d5161ad095c421332a0180bd18985d64bf7dc2abb719dce49a442b10bc8a7d5a976c34f18d5882969341c321b6af87328c52daed44fd0ce6cf2153b45e52b02
7
- data.tar.gz: 35eb1b361afd7e6df0def370c54e6539f0619ff2f820193b3628595d7671e2abc6c7a42694a071195659f06d97791b2dc44fc15a40ee9a2e161426fbdbf86d9e
6
+ metadata.gz: 5226bee52b4a24107ef6673fe73002eba689ec865e82ffc534e6992f05c80223a47b005da96b8292cc6db9464608a4fb4a6d97863d1fcd4ef208de0b5ead7715
7
+ data.tar.gz: 77a6ee0ad79d35244ea92ed9fb7a20279886640acdd0150e233641d1e3e35afd248f35124691a67630f446e3d5f773d83cfb12ec33751c8e218ec38f75088fb7
checksums.yaml.gz.sig CHANGED
Binary file
@@ -148,6 +148,22 @@ class Rex::Socket::Parameters
148
148
  end
149
149
  end
150
150
 
151
+ if (hash['SSLClientCert'] and ::File.file?(hash['SSLClientCert']))
152
+ begin
153
+ self.ssl_client_cert = ::File.read(hash['SSLClientCert'])
154
+ rescue ::Exception => e
155
+ elog("Failed to read client cert: #{e.class}: #{e}", LogSource)
156
+ end
157
+ end
158
+
159
+ if (hash['SSLClientKey'] and ::File.file?(hash['SSLClientKey']))
160
+ begin
161
+ self.ssl_client_key = ::File.read(hash['SSLClientKey'])
162
+ rescue ::Exception => e
163
+ elog("Failed to read client key: #{e.class}: #{e}", LogSource)
164
+ end
165
+ end
166
+
151
167
  if hash['Proxies']
152
168
  self.proxies = hash['Proxies'].split(',').map{|a| a.strip}.map{|a| a.split(':').map{|b| b.strip}}
153
169
  end
@@ -353,10 +369,16 @@ class Rex::Socket::Parameters
353
369
  attr_accessor :ssl_compression
354
370
 
355
371
  #
356
- # The SSL context verification mechanism
372
+ # The client SSL certificate
373
+ #
374
+ attr_accessor :ssl_client_cert
357
375
  #
376
+ # The client SSL key
377
+ #
378
+ attr_accessor :ssl_client_key
379
+ #
380
+ # SSL certificate verification mode for SSL context
358
381
  attr_accessor :ssl_verify_mode
359
-
360
382
  #
361
383
  # Whether we should use IPv6
362
384
  # @return [Bool]
@@ -37,7 +37,9 @@ begin
37
37
  end
38
38
 
39
39
  #
40
- # Set the SSL flag to true and call the base class's create_param routine.
40
+ # Set the SSL flag to true,
41
+ # create placeholders for client certs,
42
+ # call the base class's create_param routine.
41
43
  #
42
44
  def self.create_param(param)
43
45
  param.ssl = true
@@ -95,6 +97,16 @@ begin
95
97
  # Build the SSL connection
96
98
  self.sslctx = OpenSSL::SSL::SSLContext.new(version)
97
99
 
100
+ # Configure client certificate
101
+ if params and params.ssl_client_cert
102
+ self.sslctx.cert = OpenSSL::X509::Certificate.new(params.ssl_client_cert)
103
+ end
104
+
105
+ # Configure client key
106
+ if params and params.ssl_client_key
107
+ self.sslctx.key = OpenSSL::PKey::RSA.new(params.ssl_client_key)
108
+ end
109
+
98
110
  # Configure the SSL context
99
111
  # TODO: Allow the user to specify the verify mode callback
100
112
  # Valid modes:
@@ -319,6 +331,20 @@ begin
319
331
  sslsock.peer_cert_chain if sslsock
320
332
  end
321
333
 
334
+ #
335
+ # Access to client cert
336
+ #
337
+ def client_cert
338
+ sslsock.sslctx.cert if sslsock
339
+ end
340
+
341
+ #
342
+ # Access to client key
343
+ #
344
+ def client_key
345
+ sslsock.sslctx.key if sslsock
346
+ end
347
+
322
348
  #
323
349
  # Access to the current cipher
324
350
  #
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rex-socket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Maloney
@@ -88,7 +88,7 @@ cert_chain:
88
88
  G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
89
89
  8mVuTXnyJOKRJA==
90
90
  -----END CERTIFICATE-----
91
- date: 2017-06-25 00:00:00.000000000 Z
91
+ date: 2017-06-30 00:00:00.000000000 Z
92
92
  dependencies:
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: bundler
metadata.gz.sig CHANGED
Binary file