ovpn-key 0.8.2 → 0.8.3
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/lib/functions.rb +5 -6
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f649f93527c7712d821cd815cca027fcb048f2313c8c68993abee8f2c5705c1b
|
4
|
+
data.tar.gz: b989f0b2f6dac9564ec407073f50e6cfc7d3578a57f8ee4c7f107682e80c6e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e614802f5bd70e6885bb122a0f74d43c88d18d45a2a0b433f2de46dead191a4eb3e3a7563f16fc2757714924f56f7b3191740dcdf079d7783424cdfaf981b63
|
7
|
+
data.tar.gz: e357e4d4dd0995f6982b44ed5a6a1985c8dd08482a3064d5386d156a8624f78c6ed598cddffe0d31770ac66214685753d8228718426dcd3951429c872404fa82
|
data/lib/functions.rb
CHANGED
@@ -26,11 +26,11 @@ def ask_password(name)
|
|
26
26
|
password
|
27
27
|
end
|
28
28
|
|
29
|
-
def unencrypt_ca_key
|
29
|
+
def unencrypt_ca_key(pass = '')
|
30
30
|
begin
|
31
|
-
OpenSSL::PKey::RSA.new File.read('ca.key'),
|
31
|
+
OpenSSL::PKey::RSA.new File.read('ca.key'), pass
|
32
32
|
rescue OpenSSL::PKey::RSAError
|
33
|
-
# this means the file is encrypted
|
33
|
+
# this means the file is encrypted or pass is wrong
|
34
34
|
OpenSSL::PKey::RSA.new File.read('ca.key'), ask_password('ca')
|
35
35
|
end
|
36
36
|
rescue OpenSSL::PKey::RSAError
|
@@ -127,7 +127,7 @@ def revoke(certname)
|
|
127
127
|
crl.next_update = Time.now + EXPIRE['crl'] * 86_400 # days to seconds
|
128
128
|
crl.add_revoked(revoke)
|
129
129
|
begin
|
130
|
-
update_crl(crl,
|
130
|
+
update_crl(crl, '')
|
131
131
|
rescue OpenSSL::PKey::RSAError
|
132
132
|
retry
|
133
133
|
end
|
@@ -146,10 +146,9 @@ end
|
|
146
146
|
# rubocop:disable Metrics/AbcSize
|
147
147
|
def update_crl(crl, ca_pass)
|
148
148
|
# rubocop:enable Metrics/AbcSize
|
149
|
-
ca_key =
|
149
|
+
ca_key = unencrypt_ca_key(ca_pass)
|
150
150
|
crl.last_update = Time.now
|
151
151
|
crl.next_update = Time.now + EXPIRE['crl'] * 86_400 # days to seconds
|
152
|
-
crl.version = crl.version + 1
|
153
152
|
crl.sign(ca_key, OpenSSL::Digest.new(DIGEST))
|
154
153
|
File.open(CRL_FILE, 'w') {|f| f.write crl.to_pem }
|
155
154
|
end
|
data/lib/version.rb
CHANGED