ovpn-key 0.8.4 → 0.8.6

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
  SHA256:
3
- metadata.gz: 0ae3146e987d293da8fbf2880e9696e94d7d51c06db2f63fd2c021d63158dea5
4
- data.tar.gz: fbac8d69275b82527304e063db26bdea596186a7dee71acd98d9a3da282a6f59
3
+ metadata.gz: 5c06246edcf8df830880f4ad8f5f6765339b2a39a697686c4a36245b6becbd87
4
+ data.tar.gz: 900eb66c44058003bdc1f2d4fea39697746ad2fbe90aa0733c8238d16df89b68
5
5
  SHA512:
6
- metadata.gz: 2dfbae985471d80c40a7ea2ada9b8dfdd237b3973027c737640e782f0dc8503cc466ee5560d0f3f0456a20c2199fba2407a59202a4bf4c08291ec2a820b02333
7
- data.tar.gz: 5451ceb967404146948d348bd63deb7d2bc2e73df9ed93c840c4cf160a1cb6048b923e48ad96b1c121efd64cd5386da6bdca20606dbfa9c69f5bd85b484710a8
6
+ metadata.gz: 607406e6afb34f21d0cea38cb6ade88e05da6ac8225090f52955804b66248bbb30644d2a5eabb2b1c5143367c23831363ab1fde304ffdc3f283aba4c49202c90
7
+ data.tar.gz: b39664b3431c3c034df5fe067eb186efe0ecd77707a3f4e6929f94972f5750426f4736c68c14ab668f00768d65caea014c75087e9ba8b724b5d3a122fa9863ef
data/README.md CHANGED
@@ -40,7 +40,7 @@ If you're brave, [let me know](https://github.com/chillum/ovpn-key/issues), wher
40
40
 
41
41
  ### Configuration
42
42
 
43
- Most of configuration is done in `open-vpn.key` and `openssl.ini` files in the directory.
43
+ It's just a single simple YAML file named [`ovpn-key.yml`](https://github.com/chillum/ovpn-key/blob/master/defaults/ovpn-key.yml).
44
44
 
45
45
  ovpn-key also processes `~/.ovpn-key.yml` file, for now it has only one possible setting:
46
46
  ```yaml
data/bin/ovpn-key CHANGED
@@ -65,7 +65,6 @@ if options[:generate_client] && options[:generate_zip]
65
65
  # I assume that user likely wants one of them and is confused with usage
66
66
  abort 'There can be only one: --client or --zip'
67
67
  end
68
- umask = File.umask 0o077
69
68
 
70
69
  if options[:init]
71
70
  unless options[:init] == '.'
@@ -179,8 +178,7 @@ if options[:generate_zip]
179
178
  gen_and_sign('client', options[:generate_zip], options[:no_password] ? nil : ask_password(options[:generate_zip]))
180
179
 
181
180
  zip_file = File.join(File.expand_path(ZIP_DIR), "#{File.basename ovpn_file, '.ovpn'}.tblk.zip")
182
- File.delete(zip_file) if File.exist?(zip_file)
183
- File.umask umask
181
+ FileUtils.rm_f(zip_file)
184
182
  Zip::File.open(zip_file, Zip::File::CREATE) do |zip|
185
183
  zip.get_output_stream(ovpn_file) {|f|
186
184
  f.write File.read(ovpn_file)
data/lib/functions.rb CHANGED
@@ -44,9 +44,8 @@ end
44
44
 
45
45
  def gen_key(certname, password)
46
46
  key = OpenSSL::PKey::RSA.new(KEY_SIZE)
47
- File.open("#{certname}.key", 'w') do |f|
48
- f.write password ? key.to_pem(OpenSSL::Cipher.new(ENCRYPT), password) : key
49
- end
47
+ File.write("#{certname}.key",
48
+ password ? key.to_pem(OpenSSL::Cipher.new(ENCRYPT), password) : key)
50
49
  end
51
50
 
52
51
  # type is one of: 'ca', 'server', 'client'
@@ -59,8 +58,8 @@ def sign_key(type, cn, password)
59
58
  ca_key = type == 'ca' ? key : unencrypt_ca_key
60
59
  cert.sign ca_key, OpenSSL::Digest.new(DIGEST)
61
60
 
62
- File.open(SERIAL_FILE, 'w') {|f| f.write serial }
63
- File.open("#{certname}.crt", 'w') {|f| f.write cert.to_pem }
61
+ File.write(SERIAL_FILE, serial)
62
+ File.write("#{certname}.crt", cert.to_pem)
64
63
  end
65
64
 
66
65
  def gen_cert(type, cn, pubkey, serial)
@@ -84,7 +83,7 @@ def basic_cert(type, cn)
84
83
  end
85
84
 
86
85
  def time_after_days(days)
87
- Time.now + days * 86_400 # days to seconds
86
+ Time.now + (days * 86_400) # days to seconds
88
87
  end
89
88
 
90
89
  # rubocop:disable Metrics/MethodLength
@@ -110,7 +109,6 @@ def customize_cert(type, cert)
110
109
  cert.add_extension ef.create_extension('keyUsage', 'digitalSignature')
111
110
  cert.add_extension ef.create_extension('extendedKeyUsage', 'clientAuth')
112
111
  end
113
-
114
112
  cert
115
113
  end
116
114
 
@@ -142,7 +140,7 @@ def update_crl(crl, ca_pass)
142
140
  crl.last_update = Time.now
143
141
  crl.next_update = time_after_days(EXPIRE['crl'])
144
142
  crl.sign(ca_key, OpenSSL::Digest.new(DIGEST))
145
- File.open(CRL_FILE, 'w') {|f| f.write crl.to_pem }
143
+ File.write(CRL_FILE, crl.to_pem)
146
144
  end
147
145
 
148
146
  def new_serial
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ::VERSION = '0.8.4'
3
+ VERSION = '0.8.6'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ovpn-key
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasily Korytov
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-03-08 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rubyzip
@@ -41,8 +40,8 @@ files:
41
40
  homepage: https://github.com/chillum/ovpn-key
42
41
  licenses:
43
42
  - Apache-2.0
44
- metadata: {}
45
- post_install_message:
43
+ metadata:
44
+ rubygems_mfa_required: 'true'
46
45
  rdoc_options: []
47
46
  require_paths:
48
47
  - lib
@@ -57,8 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
56
  - !ruby/object:Gem::Version
58
57
  version: '0'
59
58
  requirements: []
60
- rubygems_version: 3.2.3
61
- signing_key:
59
+ rubygems_version: 4.0.2
62
60
  specification_version: 4
63
61
  summary: Key management utility for OpenVPN
64
62
  test_files: []