rex-socket 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rex/socket/parameters.rb +24 -2
- data/lib/rex/socket/ssl_tcp.rb +27 -1
- data/lib/rex/socket/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18bb58a6a55981a1a6e883d7a60f99851162d6f8
|
4
|
+
data.tar.gz: 66d105060da27f4303522d2947196abab1bb58b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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]
|
data/lib/rex/socket/ssl_tcp.rb
CHANGED
@@ -37,7 +37,9 @@ begin
|
|
37
37
|
end
|
38
38
|
|
39
39
|
#
|
40
|
-
# Set the SSL flag to true
|
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
|
#
|
data/lib/rex/socket/version.rb
CHANGED
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.
|
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-
|
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
|