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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +9 -0
- data/README.md +12 -11
- data/lib/letscert.rb +1 -0
- data/lib/letscert/certificate.rb +2 -0
- data/lib/letscert/io_plugins/file_io_plugin_mixin.rb +6 -0
- data/lib/letscert/io_plugins/jwk_io_plugin_mixin.rb +2 -2
- data/lib/letscert/loggable.rb +1 -2
- data/lib/letscert/runner.rb +8 -3
- data/lib/letscert/version.rb +1 -1
- metadata +3 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cfc8029c8899c6a18ee1c61144cbf6b5ed7abe1
|
4
|
+
data.tar.gz: a3d1003fa3e102cbd986253947a3fd9df60d14ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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
|
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.
|
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.
|
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.
|
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.
|
33
|
+
Generate a single certificate for `example.org` and `www.example.org`:
|
33
34
|
|
34
35
|
```bash
|
35
|
-
letscert -d example.
|
36
|
-
--email my.name@
|
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.
|
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.
|
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
|
-
*
|
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
data/lib/letscert/certificate.rb
CHANGED
@@ -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?(
|
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
|
data/lib/letscert/loggable.rb
CHANGED
@@ -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
|
-
#
|
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.
|
data/lib/letscert/runner.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/letscert/version.rb
CHANGED
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.
|
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-
|
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
|