ovpn-key 1.2.3 → 1.2.4

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: 5a58f56fc5d8c35e9d3e43bdca07260535603ddac976c13a2a354c0a5c33034f
4
- data.tar.gz: 8468e5bf92c69ef8ca1fabeceb45751f852246ea83db18c2b137065a6e3768ed
3
+ metadata.gz: 51acb55f775aa0af543235ac57838cfaaaf63eb79b9cf1d2c2c7497ee59a49c8
4
+ data.tar.gz: ba52864b590e94f8e01c830ee493d8f15e7a2b8128bd986107cfc74123df7015
5
5
  SHA512:
6
- metadata.gz: ac5ae25b8c30b185b69e1b926b3408fcd29b97f19f8cc35d46790332d11e71f2e63812c46b82e7cfe60e253bae264761971d1d9e2aeaf1e597e8eef7876bb19d
7
- data.tar.gz: a666144534a3b7fab5123e17b5a3c2ffdf12d8146ebd9e24237594e0df01f7964d3e8d8aad62354a7fa7d3720e8c11ff32183245d05a05291ff41187a09a8f45
6
+ metadata.gz: 122b47f5f52f508fd8e7f7571a1550e791c94188230565ed568929208c856dbe23747ddb968d3ef0f5e72b565e750b31ab782043e6c744929eed6f82d6205a95
7
+ data.tar.gz: c71dcc46bd3b5815f2d0d469c072bc0825645843a1f4535e4a98be297babcb36846a2580104a875b3b2b8932736c205603cd0767ba565cb5e995c20ddb6d25d8
data/bin/ovpn-key CHANGED
@@ -82,10 +82,14 @@ if options[:init]
82
82
  else
83
83
  begin
84
84
  rc = YAML.load_file(File.expand_path("~/.#{APP_CONF}"))
85
+ rc ||= {}
86
+ abort "ERROR: invalid ~/.#{APP_CONF}" unless rc.is_a? Hash
85
87
  rescue Errno::ENOENT
86
88
  # no configuration file in home directory is not an error
89
+ rescue Errno::EACCES, Psych::SyntaxError => e
90
+ abort "ERROR: #{e}"
87
91
  end
88
- Dir.chdir File.expand_path(rc['cd']) if !File.exist?(APP_CONF) && rc['cd']
92
+ Dir.chdir File.expand_path(rc['cd']) if !File.exist?(APP_CONF) && rc && rc['cd']
89
93
  end
90
94
 
91
95
  lock_file = File.join(Dir.tmpdir, "ovpn-key-#{Digest::SHA256.hexdigest(Dir.pwd)}.lock")
@@ -118,8 +122,12 @@ end
118
122
 
119
123
  begin
120
124
  settings = YAML.load_file(APP_CONF)
125
+ settings ||= {}
126
+ abort "ERROR: invalid #{APP_CONF}" unless settings.is_a? Hash
121
127
  rescue Errno::ENOENT
122
128
  abort "Run `#{File.basename $PROGRAM_NAME} --init` before generating certificates"
129
+ rescue Errno::EACCES, Psych::SyntaxError => e
130
+ abort "ERROR: #{e}"
123
131
  end
124
132
  ZIP_DIR = settings['zip_dir'] || if rc && rc['zip_dir']
125
133
  rc['zip_dir']
data/lib/functions.rb CHANGED
@@ -12,7 +12,7 @@ def check_client(name)
12
12
  end
13
13
 
14
14
  def check_ca
15
- return if File.exist?('ca.crt') && (File.exist? 'ca.key')
15
+ return if File.exist?('ca.crt') && File.exist?('ca.key')
16
16
 
17
17
  abort "ERROR: no `ca.crt` or `ca.key`. Run `#{File.basename $PROGRAM_NAME} --ca` first."
18
18
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- VERSION = '1.2.3'
3
+ VERSION = '1.2.4'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ovpn-key
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasily Korytov