ilo-sdk 1.0.1 → 1.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.
- checksums.yaml +4 -4
- data/README.md +25 -19
- data/lib/ilo-sdk/helpers/https_cert_helper.rb +4 -2
- data/lib/ilo-sdk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f946ce92905f62313a97dad4c6e1b2af423e6b76
|
|
4
|
+
data.tar.gz: 759478851f155d9600c0758ebd01754f292d1f2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3fb34bebfd27fee718dcecc8fb53a2130b243aae7df2e349c8b5ce738b66f8832b588f072af15cd4d8b7d987c827d9951552e38f68246208f99ae0038321b312
|
|
7
|
+
data.tar.gz: 227ba06dbc423e26104c39b413e88c18aa5a183c237b133a1140d25521b56d81fb90c19a2800b59b42787215d298efa44f48835d7d437a12bc2886020194872b
|
data/README.md
CHANGED
|
@@ -211,26 +211,32 @@ client.set_fw_upgrade('www.firmwareupgrade.com')
|
|
|
211
211
|
|
|
212
212
|
#### HTTPS Certificate
|
|
213
213
|
```ruby
|
|
214
|
-
#
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
# Get the current SSL Certificate and check to see if expires within 24 hours
|
|
215
|
+
expiration = client.get_certificate.not_after.to_datetime
|
|
216
|
+
tomorrow = DateTime.now + 1
|
|
217
|
+
|
|
218
|
+
if expiration < tomorrow
|
|
219
|
+
# Generate a Certificate Signing Request:
|
|
220
|
+
# Params: country_code, state, city, organization, organizational_unit, common_name
|
|
221
|
+
client.generate_csr('US', 'Texas', 'Houston', 'myCompany', 'myUnit', 'example.com')
|
|
222
|
+
|
|
223
|
+
# Wait for the CSR to be generated (will take about 10 minutes):
|
|
224
|
+
csr = nil
|
|
225
|
+
while(csr.nil?) do
|
|
226
|
+
sleep(60) # 60 seconds
|
|
227
|
+
csr = client.get_csr
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Here you'll need to have a step that submits the csr to a certificate authority
|
|
231
|
+
# (or self-signs it) and gets back the signed certificate. It will look something like:
|
|
232
|
+
# -----BEGIN CERTIFICATE-----
|
|
233
|
+
# lines_of_secret_text
|
|
234
|
+
# -----END CERTIFICATE-----
|
|
235
|
+
# For this example, we're assuming we've read in the content of the certificate to the
|
|
236
|
+
# "cert" variable (as a string).
|
|
237
|
+
|
|
238
|
+
client.import_certificate(cert)
|
|
223
239
|
end
|
|
224
|
-
|
|
225
|
-
# Here you'll need to have a step that submits the csr to a certificate authority
|
|
226
|
-
# (or self-signs it) and gets back the signed certificate. It will look something like:
|
|
227
|
-
# -----BEGIN CERTIFICATE-----
|
|
228
|
-
# lines_of_secret_text
|
|
229
|
-
# -----END CERTIFICATE-----
|
|
230
|
-
# For this example, we're assuming we've read in the content of the certificate to the
|
|
231
|
-
# "cert" variable (as a string).
|
|
232
|
-
|
|
233
|
-
client.import_certificate(cert)
|
|
234
240
|
```
|
|
235
241
|
|
|
236
242
|
#### Log Entry
|
|
@@ -14,14 +14,16 @@ module ILO_SDK
|
|
|
14
14
|
module HttpsCertHelper
|
|
15
15
|
# Get the SSL Certificate
|
|
16
16
|
# @raise [RuntimeError] if the request failed
|
|
17
|
-
# @return [
|
|
17
|
+
# @return [OpenSSL::X509::Certificate] x509_certificate
|
|
18
|
+
# rubocop:disable Style/SymbolProc
|
|
18
19
|
def get_certificate
|
|
19
20
|
uri = URI.parse(URI.escape(@host))
|
|
20
21
|
options = { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE }
|
|
21
22
|
Net::HTTP.start(uri.host, uri.port, options) do |http|
|
|
22
|
-
http.peer_cert
|
|
23
|
+
http.peer_cert
|
|
23
24
|
end
|
|
24
25
|
end
|
|
26
|
+
# rubocop:enable Style/SymbolProc
|
|
25
27
|
|
|
26
28
|
# Import the x509 certificate
|
|
27
29
|
# @param [String] certificate
|
data/lib/ilo-sdk/version.rb
CHANGED