letsencrypt_webfaction 2.2.3 → 3.0.0
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -0
- data/README.md +18 -107
- data/certs/will_in_wi.pem +8 -8
- data/docs/rbenv.md +31 -0
- data/docs/upgrading.md +49 -0
- data/exe/letsencrypt_webfaction +7 -2
- data/letsencrypt_webfaction.gemspec +1 -0
- data/lib/letsencrypt_webfaction.rb +1 -1
- data/lib/letsencrypt_webfaction/application.rb +32 -84
- data/lib/letsencrypt_webfaction/application/init.rb +55 -0
- data/lib/letsencrypt_webfaction/application/run.rb +133 -0
- data/lib/letsencrypt_webfaction/certificate_installer.rb +0 -2
- data/lib/letsencrypt_webfaction/certificate_issuer.rb +52 -0
- data/lib/letsencrypt_webfaction/domain_validator.rb +1 -1
- data/lib/letsencrypt_webfaction/errors.rb +5 -0
- data/lib/letsencrypt_webfaction/logger_output.rb +14 -0
- data/lib/letsencrypt_webfaction/options.rb +72 -0
- data/lib/letsencrypt_webfaction/options/certificate.rb +50 -0
- data/templates/letsencrypt_webfaction.toml +58 -0
- metadata +35 -18
- metadata.gz.sig +0 -0
- data/config.defaults.yml +0 -12
- data/config.example.yml +0 -8
- data/lib/letsencrypt_webfaction/args_parser.rb +0 -143
- data/lib/letsencrypt_webfaction/args_parser/array_validator.rb +0 -9
- data/lib/letsencrypt_webfaction/args_parser/defined_values_validator.rb +0 -13
- data/lib/letsencrypt_webfaction/args_parser/field.rb +0 -48
- data/lib/letsencrypt_webfaction/args_parser/string_validator.rb +0 -9
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: letsencrypt_webfaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Johnston
|
@@ -10,9 +10,9 @@ bindir: exe
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDhTCCAm2gAwIBAgIBATANBgkqhkiG9w0BAQsFADBEMRAwDgYDVQQDDAd3aWxs
|
14
14
|
aWFtMRwwGgYKCZImiZPyLGQBGRYMam9obnN0b25oYXVzMRIwEAYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYCdXMwHhcNMTgwNjEwMTMxNTEwWhcNMTkwNjEwMTMxNTEwWjBEMRAwDgYDVQQD
|
16
16
|
DAd3aWxsaWFtMRwwGgYKCZImiZPyLGQBGRYMam9obnN0b25oYXVzMRIwEAYKCZIm
|
17
17
|
iZPyLGQBGRYCdXMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDl8XJy
|
18
18
|
iFDfTJHbPnQ43vJKAjVPwxRnPhThFeWgYlZ//SU6ZbO4GqewDSMyCrjtWOq+mE59
|
@@ -23,14 +23,14 @@ cert_chain:
|
|
23
23
|
gkKUO+QWHBNH4QL3AgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAd
|
24
24
|
BgNVHQ4EFgQUFOFAV8TE1Qa285rrUux+StPq5WowIgYDVR0RBBswGYEXd2lsbGlh
|
25
25
|
bUBqb2huc3RvbmhhdXMudXMwIgYDVR0SBBswGYEXd2lsbGlhbUBqb2huc3Rvbmhh
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
dXMudXMwDQYJKoZIhvcNAQELBQADggEBAEZ6tJ2dwjke8nJbBATwwqwqqyISybGc
|
27
|
+
/uw0ApMsYfK0pninuCV5jfpm4WbmqokqNOfbYvlHLpBKGz7uxJRKOioe6Ivl7LJu
|
28
|
+
EHiagTaawLYJK0tZ3fH4K7VFx4pXNIbg6LYzOTIflaBQkVSkaVNfrczTJM11aADC
|
29
|
+
qy0EH65AuAgNtypTvnCKGB6pztMIgxK0FTSdZnnxtC1ReQ1U8MpsaYpOap2Yvofo
|
30
|
+
ilYPju4QWNSvpNVhV+T7JUvAHXva3Rayfp8SKRpvX8ZpRCjvpYfgbmNxXO2ST1qb
|
31
|
+
KBba/yJfCMh+B65HfRUXBQRRDtJ2Vu8i0WmRUKenahAnpkkeVmqhWwY=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-
|
33
|
+
date: 2018-06-10 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: acme-client
|
@@ -46,6 +46,20 @@ dependencies:
|
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 0.6.0
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: toml-rb
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.1'
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.1'
|
49
63
|
description: A tool to simplify the manual process of using LetsEncrypt on Webfaction
|
50
64
|
hosts. It can be added to cron where it will validate your domains automatically,
|
51
65
|
place the generated certs in a common folder, and then email the WebFaction support
|
@@ -73,20 +87,23 @@ files:
|
|
73
87
|
- bin/rubocop
|
74
88
|
- bin/setup
|
75
89
|
- certs/will_in_wi.pem
|
76
|
-
-
|
77
|
-
-
|
90
|
+
- docs/rbenv.md
|
91
|
+
- docs/upgrading.md
|
78
92
|
- exe/letsencrypt_webfaction
|
79
93
|
- letsencrypt_webfaction.gemspec
|
80
94
|
- lib/letsencrypt_webfaction.rb
|
81
95
|
- lib/letsencrypt_webfaction/application.rb
|
82
|
-
- lib/letsencrypt_webfaction/
|
83
|
-
- lib/letsencrypt_webfaction/
|
84
|
-
- lib/letsencrypt_webfaction/args_parser/defined_values_validator.rb
|
85
|
-
- lib/letsencrypt_webfaction/args_parser/field.rb
|
86
|
-
- lib/letsencrypt_webfaction/args_parser/string_validator.rb
|
96
|
+
- lib/letsencrypt_webfaction/application/init.rb
|
97
|
+
- lib/letsencrypt_webfaction/application/run.rb
|
87
98
|
- lib/letsencrypt_webfaction/certificate_installer.rb
|
99
|
+
- lib/letsencrypt_webfaction/certificate_issuer.rb
|
88
100
|
- lib/letsencrypt_webfaction/domain_validator.rb
|
101
|
+
- lib/letsencrypt_webfaction/errors.rb
|
102
|
+
- lib/letsencrypt_webfaction/logger_output.rb
|
103
|
+
- lib/letsencrypt_webfaction/options.rb
|
104
|
+
- lib/letsencrypt_webfaction/options/certificate.rb
|
89
105
|
- lib/letsencrypt_webfaction/webfaction_api_credentials.rb
|
106
|
+
- templates/letsencrypt_webfaction.toml
|
90
107
|
homepage: https://github.com/will-in-wi/letsencrypt-webfaction
|
91
108
|
licenses:
|
92
109
|
- MIT
|
@@ -107,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
124
|
version: '0'
|
108
125
|
requirements: []
|
109
126
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.7.7
|
111
128
|
signing_key:
|
112
129
|
specification_version: 4
|
113
130
|
summary: LetsEncrypt utility client for WebFaction hosts.
|
metadata.gz.sig
CHANGED
Binary file
|
data/config.defaults.yml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
key_size: 4096
|
2
|
-
# We need an ACME server to talk to, see github.com/letsencrypt/boulder
|
3
|
-
endpoint: 'https://acme-v01.api.letsencrypt.org/'
|
4
|
-
domains: []
|
5
|
-
public: []
|
6
|
-
letsencrypt_account_email: ''
|
7
|
-
api_url: 'https://api.webfaction.com/'
|
8
|
-
username: ''
|
9
|
-
password: ''
|
10
|
-
servername: ''
|
11
|
-
cert_name: ''
|
12
|
-
quiet: false
|
data/config.example.yml
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
# See config.defaults.yml for all available settings.
|
2
|
-
|
3
|
-
key_size: 4096
|
4
|
-
endpoint: 'https://acme-v01.api.letsencrypt.org/'
|
5
|
-
letsencrypt_account_email: 'me@example.com'
|
6
|
-
domains: ['example.com','www.example.com']
|
7
|
-
# The webroot of the application.
|
8
|
-
public: '/home/myuser/webapps/myapp/public_html'
|
@@ -1,143 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'socket'
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
require 'letsencrypt_webfaction'
|
6
|
-
require 'letsencrypt_webfaction/args_parser/field'
|
7
|
-
require 'letsencrypt_webfaction/args_parser/string_validator'
|
8
|
-
require 'letsencrypt_webfaction/args_parser/defined_values_validator'
|
9
|
-
require 'letsencrypt_webfaction/args_parser/array_validator'
|
10
|
-
|
11
|
-
module LetsencryptWebfaction
|
12
|
-
class ArgsParser
|
13
|
-
BANNER = 'Usage: letsencrypt_webfaction [options]'.freeze
|
14
|
-
DEFAULTS_PATH = 'config.defaults.yml'.freeze
|
15
|
-
VALID_KEY_SIZES = [2048, 4096].freeze
|
16
|
-
|
17
|
-
FIELDS = [
|
18
|
-
Field::IntegerField.new(:key_size, 'Size of private key (e.g. 4096)', [DefinedValuesValidator.new(VALID_KEY_SIZES)]),
|
19
|
-
Field.new(:endpoint, 'ACME endpoint (e.g. https://acme-v01.api.letsencrypt.org/)', [StringValidator.new]),
|
20
|
-
Field::ListField.new(:domains, 'Comma separated list of domains. The first one will be the common name.', [ArrayValidator.new]),
|
21
|
-
Field::ListField.new(:public, 'Locations on the filesystem served by the desired sites (e.g. "~/webapps/myapp/public_html,~/webapps/myapp1/public_html")', [ArrayValidator.new]),
|
22
|
-
Field.new(:letsencrypt_account_email, 'The email address associated with your account.', [StringValidator.new]),
|
23
|
-
Field.new(:api_url, 'The URL to the Webfaction API.', [StringValidator.new]),
|
24
|
-
Field.new(:username, 'The username for your Webfaction account.', [StringValidator.new]),
|
25
|
-
Field.new(:password, 'The password for your Webfaction account.', [StringValidator.new]),
|
26
|
-
Field.new(:servername, 'The server on which this application resides (e.g. Web123).', [StringValidator.new]),
|
27
|
-
Field.new(:cert_name, 'The name of the certificate in the Webfaction UI.', [StringValidator.new]),
|
28
|
-
Field::BooleanField.new(:quiet, 'Whether to display text on success.', []),
|
29
|
-
].freeze
|
30
|
-
|
31
|
-
# Set up getters.
|
32
|
-
FIELDS.map(&:identifier).each do |field|
|
33
|
-
attr_reader field
|
34
|
-
end
|
35
|
-
|
36
|
-
# Set up boolean getters
|
37
|
-
FIELDS.reject(&:value?).map(&:identifier).each do |field|
|
38
|
-
define_method "#{field}?" do
|
39
|
-
instance_variable_get("@#{field}") || false
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# EMail config is special, as it only comes from the config file, due to complexity.
|
44
|
-
attr_reader :email_configuration
|
45
|
-
|
46
|
-
def initialize(options)
|
47
|
-
@options = options
|
48
|
-
|
49
|
-
@errors = {}
|
50
|
-
|
51
|
-
# Set defaults from default config file.
|
52
|
-
file_path = File.join(File.dirname(__FILE__), '../../', DEFAULTS_PATH)
|
53
|
-
load_config!(File.expand_path(file_path))
|
54
|
-
|
55
|
-
# TODO: Rework this to not exit on instantiation due to help text or version.
|
56
|
-
parse!
|
57
|
-
end
|
58
|
-
|
59
|
-
def errors
|
60
|
-
errors = {}
|
61
|
-
|
62
|
-
FIELDS.each do |field|
|
63
|
-
val = instance_variable_get("@#{field.identifier}")
|
64
|
-
next if field.valid? val
|
65
|
-
errors[field.identifier] ||= []
|
66
|
-
errors[field.identifier] << "Invalid #{field.identifier} '#{val}'"
|
67
|
-
end
|
68
|
-
|
69
|
-
errors
|
70
|
-
end
|
71
|
-
|
72
|
-
def valid?
|
73
|
-
errors.empty?
|
74
|
-
end
|
75
|
-
|
76
|
-
private
|
77
|
-
|
78
|
-
def load_config!(config_path)
|
79
|
-
config = YAML.load_file(config_path)
|
80
|
-
FIELDS.each do |field|
|
81
|
-
next unless config[field.identifier.to_s]
|
82
|
-
instance_variable_set("@#{field.identifier}", field.sanitize(config[field.identifier.to_s]))
|
83
|
-
end
|
84
|
-
|
85
|
-
@email_configuration = config['email_configuration'] || {}
|
86
|
-
end
|
87
|
-
|
88
|
-
def handle_config(opts)
|
89
|
-
opts.on('--config=CONFIG', 'Path to config file. Arguments passed to the program will override corresponding directives in the config file.') do |c|
|
90
|
-
# Set defaults.
|
91
|
-
load_config!(c)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def handle_help(opts)
|
96
|
-
opts.on('-h', '--help', 'Prints this help') do
|
97
|
-
puts opts
|
98
|
-
exit
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def handle_version(opts)
|
103
|
-
opts.on_tail('--version', 'Show version') do
|
104
|
-
puts LetsencryptWebfaction::VERSION
|
105
|
-
exit
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def handle_field(opts, field)
|
110
|
-
argument = "--#{field.identifier}"
|
111
|
-
argument += "=#{field.identifier.upcase}" if field.value?
|
112
|
-
opts.on(argument, field.description) do |val|
|
113
|
-
instance_variable_set("@#{field.identifier}", field.sanitize(val))
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def opt_parser
|
118
|
-
OptionParser.new do |opts|
|
119
|
-
opts.banner = BANNER
|
120
|
-
|
121
|
-
handle_config(opts)
|
122
|
-
handle_help(opts)
|
123
|
-
handle_version(opts)
|
124
|
-
FIELDS.each { |field| handle_field(opts, field) }
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def parse!
|
129
|
-
opt_parser.parse!(@options)
|
130
|
-
|
131
|
-
# Set default hostname
|
132
|
-
if @servername.nil? || @servername == ''
|
133
|
-
@servername = Socket.gethostname.split('.')[0].sub(/^./, &:upcase)
|
134
|
-
end
|
135
|
-
|
136
|
-
# Set default cert_name
|
137
|
-
if @cert_name.nil? || @cert_name == ''
|
138
|
-
@cert_name = @domains[0] if @domains.any?
|
139
|
-
end
|
140
|
-
@cert_name = @cert_name.gsub(/[^a-zA-Z\d_]/, '_')
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module LetsencryptWebfaction
|
2
|
-
class ArgsParser
|
3
|
-
class Field
|
4
|
-
attr_reader :identifier, :description, :validators
|
5
|
-
|
6
|
-
def initialize(identifier, description, validators = [])
|
7
|
-
@identifier = identifier
|
8
|
-
@description = description
|
9
|
-
@validators = validators
|
10
|
-
end
|
11
|
-
|
12
|
-
def sanitize(val)
|
13
|
-
val
|
14
|
-
end
|
15
|
-
|
16
|
-
def valid?(val)
|
17
|
-
validators.reject { |validator| validator.valid?(val) }.empty?
|
18
|
-
end
|
19
|
-
|
20
|
-
def value?
|
21
|
-
true
|
22
|
-
end
|
23
|
-
|
24
|
-
class IntegerField < Field
|
25
|
-
def sanitize(val)
|
26
|
-
val.to_i
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class ListField < Field
|
31
|
-
def sanitize(val)
|
32
|
-
return val if val.is_a?(Array)
|
33
|
-
val.split(',').map(&:strip).compact
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class BooleanField < Field
|
38
|
-
def sanitize(val)
|
39
|
-
val || false
|
40
|
-
end
|
41
|
-
|
42
|
-
def value?
|
43
|
-
false
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|