letscert 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1c7540da4fdf5cbdc335d39e2bbe3ddbdf1c626
4
- data.tar.gz: 677697d448f263b70b20cea1d8b63e6a26a4db6b
3
+ metadata.gz: 7cfc8029c8899c6a18ee1c61144cbf6b5ed7abe1
4
+ data.tar.gz: a3d1003fa3e102cbd986253947a3fd9df60d14ae
5
5
  SHA512:
6
- metadata.gz: fe59f20eabe2f24f06d64613668146bb18280fc0e78b1cb24560eff2eb6dce9a19319dea8806f1f4e06d1abf15338f67bd513be74a53650e66c7fe45d3e69424
7
- data.tar.gz: 2bdc561629f525bea12e80ca1d5cace8ac851529be690ed8836dcd539c49e1243be9d0f745a8a9454b38431ad607cfe5e8cd11721975b7da6581c3ced2d41b13
6
+ metadata.gz: 4dcc9323bc64e22f3268c3c16dd7958bf94c7a78612b6826b568b263994cc8659c681139fa87ceda200dc6d567d7df5455c192f1753b385ecc116ef0d4253696
7
+ data.tar.gz: f6001ff81d51e9d3cc183bc1a4b2d737be4194c93a75788f7f53233d5e8f24a4b2f7165d1788a251570003b63756dafdaf7b4c5db07f9ce410276d7eca0d1d2b
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1
4
+ - 2.2
5
+ - 2.3.1
6
+
7
+ install:
8
+ - gem install bundler
9
+ - bundler install --path vendor/bundle --jobs=3 --retry=3
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/letscert.svg)](https://badge.fury.io/rb/letscert)
2
+ [![Build Status](https://travis-ci.org/sdaubert/letscert.svg?branch=master)](https://travis-ci.org/sdaubert/letscert)
2
3
 
3
4
  # letscert
4
5
  A simple `Let's Encrypt` client in ruby.
5
6
 
6
- I think `simp_le` do it the right way: it is simple, it is safe as it does not need to be
7
+ I think [kuba/simp_le](https://github.com/kuba/simp_le) do it the right way: it is simple, it is safe as it does not need to be
7
8
  run as root, but it is Python (no one is perfect :-)) So I started to create a clone, but
8
9
  in Ruby.
9
10
 
@@ -13,15 +14,15 @@ in Ruby.
13
14
  With full chain support (`fullchain.pem` file will contain all certificates):
14
15
 
15
16
  ```bash
16
- letscert -d example.com:/var/www/example.com/html --email my.name@domain.tld \
17
+ letscert -d example.org:/var/www/example.org/html --email my.name@example.org \
17
18
  -f account_key.json -f key.pem -f fullchain.pem
18
19
  ```
19
20
 
20
- else (certificate for example.com is in `cert.pem` file, rest of certification chain
21
+ else (certificate for example.org is in `cert.pem` file, rest of certification chain
21
22
  is in `chain.pem`):
22
23
 
23
24
  ```bash
24
- letscert -d example.com:/var/www/example.com/html --email my.name@domain.tld \
25
+ letscert -d example.org:/var/www/example.org/html --email my.name@example.org \
25
26
  -f account_key.json -f key.pem -f cert.pem -f chain.pem
26
27
  ```
27
28
 
@@ -29,11 +30,11 @@ Commands are the sames for certificate renewal.
29
30
 
30
31
 
31
32
  ## Generate a key pair and get a signed certificate for multi-domains:
32
- Generate a single certificate for `example.com` and `www.example.com`:
33
+ Generate a single certificate for `example.org` and `www.example.org`:
33
34
 
34
35
  ```bash
35
- letscert -d example.com -d www.example.com --default-root /var/www/html \
36
- --email my.name@domain.tld -f account_key.json -f key.pem -f fullchain.pem
36
+ letscert -d example.org -d www.example.org --default-root /var/www/html \
37
+ --email my.name@example.org -f account_key.json -f key.pem -f fullchain.pem
37
38
  ```
38
39
 
39
40
  Command is the same for certificate renewal.
@@ -43,7 +44,7 @@ Command is the same for certificate renewal.
43
44
  In this example, `xx` is 10:
44
45
 
45
46
  ```bash
46
- letscert -d example.com:/var/www/example.com/html --email my.name@domain.tld \
47
+ letscert -d example.org:/var/www/example.org/html --email my.name@example.org \
47
48
  -f account_key.json -f key.pem -f cert.pem -f chain.pem --valid-min 10d
48
49
  ```
49
50
 
@@ -54,7 +55,7 @@ seconds (no suffix).
54
55
  From directory where are stored `account_key.json` and `cert.pem` or `fullchain.pem`:
55
56
 
56
57
  ```bash
57
- letscert -d example.com:/var/www/example.com/html --email my.name@domain.tld --revoke
58
+ letscert -d example.org:/var/www/example.org/html --email my.name@example.org --revoke
58
59
  ```
59
60
 
60
61
 
@@ -69,7 +70,7 @@ letscert -d example.com:/var/www/example.com/html --email my.name@domain.tld --r
69
70
  * No configuration file.
70
71
  * Support multiple domains with multiple roots. Always create a single certificate per
71
72
  run (ie a certificate may have multiple SANs).
72
- * As `simp_le`, check the exit code to known if a renewal has happened:
73
+ * Check the exit code to known if a renewal has happened:
73
74
  * 0 if certificate data was created or updated;
74
75
  * 1 if renewal not necessary;
75
76
  * 2 in case of errors.
@@ -88,4 +89,4 @@ gem install letscert -P MediumSecurity
88
89
 
89
90
  The MediumSecurity trust profile will verify signed gems, but allow the installation of
90
91
  unsigned dependencies. This is necessary because not all of letcert’s dependencies are
91
- signed, so we cannot use HighSecurity.
92
+ signed, so we cannot use HighSecurity.
data/lib/letscert.rb CHANGED
@@ -21,6 +21,7 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  # Namespace for all letcert's classes.
24
+ # @author Sylvain Daubert
24
25
  module LetsCert
25
26
 
26
27
  # Base error class
@@ -22,6 +22,8 @@
22
22
  require 'acme-client'
23
23
  require_relative 'loggable'
24
24
 
25
+ # rubocop:disable Metrics/ClassLength, Style/MultilineBlockLayout
26
+ # rubocop:disable Style/BlockEndNewline, Style/BlockDelimiters
25
27
  module LetsCert
26
28
 
27
29
  # Class to handle ACME operations on certificates
@@ -54,6 +54,12 @@ module LetsCert
54
54
  def save_to_file(data)
55
55
  return if data.nil?
56
56
 
57
+ # Return if content did not change
58
+ if File.exist? name
59
+ old_content = File.read(name)
60
+ return if old_content == data
61
+ end
62
+
57
63
  logger.info { "saving #{@name}" }
58
64
  begin
59
65
  File.open(name, 'w') do |f|
@@ -41,8 +41,8 @@ module LetsCert
41
41
  # Ruby < 2.3.0 urlsafe_decode64 use struct_decode64. So the string
42
42
  # is rejected if padding is removed (which JWK do)
43
43
  # So, we have to reinject padding
44
- if !data.end_with?("=") && data.length % 4 != 0
45
- data = data.ljust((data.length + 3) & ~3, "=")
44
+ if !data.end_with?('=') && (data.length % 4).nonzero?
45
+ data = data.ljust((data.length + 3) & ~3, '=')
46
46
  end
47
47
  Base64.urlsafe_decode64(data)
48
48
  end
@@ -20,8 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- # Namespace for all letcert's classes.
24
- # @author Sylvain Daubert
23
+ # rubocop:disable Style/ClassVars
25
24
  module LetsCert
26
25
 
27
26
  # Mixin module to add loggability to a class.
@@ -227,6 +227,7 @@ module LetsCert
227
227
  # rubocop:disable Style/GuardClause
228
228
  def print_help_if_needed
229
229
  if @options[:print_help]
230
+ show_version
230
231
  puts @opt_parser
231
232
  exit RETURN_OK
232
233
  end
@@ -236,13 +237,17 @@ module LetsCert
236
237
  # @return [void]
237
238
  def show_version_if_needed
238
239
  if @options[:show_version]
239
- puts "letscert #{LetsCert::VERSION}"
240
- puts 'Copyright (c) 2016 Sylvain Daubert'
241
- puts 'License MIT: see http://opensource.org/licenses/MIT'
240
+ show_version
242
241
  exit RETURN_OK
243
242
  end
244
243
  end
245
244
 
245
+ def show_version
246
+ puts "letscert #{LetsCert::VERSION}"
247
+ puts 'Copyright (c) 2016 Sylvain Daubert'
248
+ puts 'License MIT: see http://opensource.org/licenses/MIT'
249
+ end
250
+
246
251
  # Set logger level from +:verbose+ option
247
252
  # @return [void]
248
253
  def set_logger_level
@@ -1,6 +1,6 @@
1
1
  module LetsCert
2
2
 
3
3
  # Letscert version number
4
- VERSION = '0.4.3'.freeze
4
+ VERSION = '0.4.4'.freeze
5
5
 
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letscert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Daubert
@@ -31,7 +31,7 @@ cert_chain:
31
31
  dMi8WSKt03lfzyxIqZseBwVYYn+XMlzCcJLXCUgZXHcBRRRDH5wGDqOqXjL25b2O
32
32
  6m3JJngqkCFrOw==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-10-12 00:00:00.000000000 Z
34
+ date: 2016-11-01 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: acme-client
@@ -142,6 +142,7 @@ extra_rdoc_files: []
142
142
  files:
143
143
  - ".gitignore"
144
144
  - ".rubocop.yml"
145
+ - ".travis.yml"
145
146
  - Gemfile
146
147
  - LICENSE
147
148
  - README.md
metadata.gz.sig CHANGED
Binary file