rex-socket 0.1.17 → 0.1.18

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: 24fd1f504f256379c0d5d2edd6784c3023f56f03
4
- data.tar.gz: f173a85b8a8fcb821f45be200c8a1704caeeca77
3
+ metadata.gz: 5dd18788e55337f4c64c6a2b5bdc221b897a4ca9
4
+ data.tar.gz: 4b7d5ec7e28ea4cfecd8e3eeff2bb3fafd116882
5
5
  SHA512:
6
- metadata.gz: d3c3e16ee50aa43e3d96c6f41bb9b41541b24160839890dd1edb842e32e264141102be75d02778491593f830c2fb3e1a2af8485e5f68a81178758b9e2840374e
7
- data.tar.gz: 7d09132d390ff1cccaf0c66b485239d059a7959c0e68e2553b48305b7a02b8546fc2afbcc734d436bd67bd22046a115ea61ace6a710f15ed4539bcb8fc116d1f
6
+ metadata.gz: 9f8e493f4349b58068e7c33e1e5b116290ddd35b96f6eda50dc7577c61fb845999730e398c359773a5ddf05628a387ef41b9eb3f2ebd0f69da8c12d90e007c1c
7
+ data.tar.gz: 5532feff68e43c54f1c32318bae095097a1e9fd1b2d243e8f5582a8972f10a326221a69551781f7aad62ec9600e98e437a1e2eba5ff1d07978f25879196355d5
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -140,6 +140,14 @@ class Rex::Socket::Parameters
140
140
  self.ssl_cipher = hash['SSLCipher']
141
141
  end
142
142
 
143
+ if (hash['VHOST'])
144
+ self.ssl_cn = hash['VHOST']
145
+ end
146
+
147
+ if (hash['SSLCommonName'])
148
+ self.ssl_cn = hash['SSLCommonName']
149
+ end
150
+
143
151
  if (hash['SSLCert'] and ::File.file?(hash['SSLCert']))
144
152
  begin
145
153
  self.ssl_cert = ::File.read(hash['SSLCert'])
@@ -359,6 +367,10 @@ class Rex::Socket::Parameters
359
367
  # @return [String,Array]
360
368
  attr_accessor :ssl_cipher
361
369
 
370
+ # Which Common Name to use for certificate
371
+ # @return [String}
372
+ attr_accessor :ssl_cn
373
+
362
374
  # The SSL certificate, in pem format, stored as a string. See
363
375
  # {Rex::Socket::SslTcpServer#makessl}
364
376
  # @return [String]
@@ -13,12 +13,10 @@ module Rex::Socket::Ssl
13
13
 
14
14
  module CertProvider
15
15
 
16
- def self.ssl_generate_subject
16
+ def self.ssl_generate_subject(cn = Rex::Text.rand_hostname, org = Rex::Text.rand_name)
17
17
  st = Rex::Text.rand_state
18
18
  loc = Rex::Text.rand_name.capitalize
19
- org = Rex::Text.rand_name.capitalize
20
- cn = Rex::Text.rand_hostname
21
- "/C=US/ST=#{st}/L=#{loc}/O=#{org}/CN=#{cn}"
19
+ "/C=US/ST=#{st}/L=#{loc}/O=#{org.capitalize}/CN=#{cn}"
22
20
  end
23
21
 
24
22
  def self.ssl_generate_issuer
@@ -32,11 +30,11 @@ module Rex::Socket::Ssl
32
30
  # certificate. This matches a typical "snakeoil" cert.
33
31
  #
34
32
  # @return [String, String, Array]
35
- def self.ssl_generate_certificate
33
+ def self.ssl_generate_certificate(cn = Rex::Text.rand_hostname, org = Rex::Text.rand_name)
36
34
  yr = 24*3600*365
37
35
  vf = Time.at(Time.now.to_i - rand(yr * 3) - yr)
38
36
  vt = Time.at(vf.to_i + (rand(9)+1) * yr)
39
- subject = ssl_generate_subject
37
+ subject = ssl_generate_subject(cn, org)
40
38
  issuer = ssl_generate_issuer
41
39
  key = OpenSSL::PKey::RSA.new(2048){ }
42
40
  cert = OpenSSL::X509::Certificate.new
@@ -119,7 +117,7 @@ module Rex::Socket::Ssl
119
117
  if params.ssl_cert
120
118
  key, cert, chain = ssl_parse_pem(params.ssl_cert)
121
119
  else
122
- key, cert, chain = ssl_generate_certificate
120
+ key, cert, chain = ssl_generate_certificate(params.ssl_cn)
123
121
  end
124
122
 
125
123
  ctx = OpenSSL::SSL::SSLContext.new()
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.17"
3
+ VERSION = "0.1.18"
4
4
  end
5
5
  end
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.17
4
+ version: 0.1.18
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: 2019-02-27 00:00:00.000000000 Z
91
+ date: 2019-06-26 00:00:00.000000000 Z
92
92
  dependencies:
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: bundler
metadata.gz.sig CHANGED
Binary file