letsencrypt_webfaction 1.1.8 → 2.0.0

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: f4abb9871a5f7f8f9839c45ef8a55de46d46a9c5
4
- data.tar.gz: 62ec80d2bbc7dc7b0a166cb2ccbb75e18c953c37
3
+ metadata.gz: 8ac49657153360e6bee3e88beb0cf90ba58849eb
4
+ data.tar.gz: b1da0829bf31d762898e8040643d3c4a86bea8d4
5
5
  SHA512:
6
- metadata.gz: 673412c0a0b6d9d2f0e238b4c62e8a64880280c1c08c69317ff4ae56fa8e1f5949319f6401415ecfc80687427f67aac1343cd4b2da64a589834f5e0a00b43e85
7
- data.tar.gz: ad158c80ab95779bf688eeabd209bd1ae62bc9464415f8feb3e88a4fcb3f420809587bb42bec7f2cbe87dd48a3e939f2109ce2566e95d00e7ee7ebaefc709904
6
+ metadata.gz: 7b9faffb8512abe29eea9d4ea5268ddf600de29cb5257300e6a47ad157d50e2a7eee0442c0d8d6a61691e554c1f1e817a21a72773179fad0995f633f5aab0c6c
7
+ data.tar.gz: 044d7d24e039c562ffb4f1c121f54aba50d03144ff9c2b870315577700619a129ddfcecd57bc14969e242693d88242c4cb16c470ff758fd063c84f79875d59fc
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.gitignore CHANGED
@@ -13,3 +13,6 @@
13
13
 
14
14
  # Ignore local config.
15
15
  /.bundle
16
+
17
+ # Ignore spec next-failure file.
18
+ /spec/.examples.txt
@@ -4,6 +4,7 @@ AllCops:
4
4
  - 'bin/*'
5
5
  # Keep rubocop from scanning installed gems.
6
6
  - 'vendor/**/*'
7
+ TargetRubyVersion: 2.1
7
8
  # Line length is something that isn't dogmatic. 80 chars is a good recommendation.
8
9
  Metrics/LineLength:
9
10
  Enabled: false
@@ -1,3 +1,15 @@
1
+ v2.0.0
2
+
3
+ * Switch to using the Webfaction API for certificate installation.
4
+
5
+ *MIGRATION NOTES*
6
+
7
+ * New required parameters for Webfaction API: `username` and `password`. It is recommended that these be passed in a config file instead of being command line arguments.
8
+ * `--account_email`, `--admin_notification_email`, and `--support_email` are gone. `--letsencrypt_account_email` remains and needs to be set directly.
9
+ * Pony and direct emailing are gone. Since this utility uses the admin interface, the only reason to send emails are for errors, which are handled with the `MAILTO` string in the crontab, per the readme.
10
+ * `--cert_name` is a new conditional param. This defaults to the first domain given, with dots replaced by underscores.
11
+ * `--servername` and `--api_url` are new params with sane defaults.
12
+
1
13
  v1.1.8
2
14
 
3
15
  * Remove accidental runtime dependency on Pry.
data/Gemfile CHANGED
@@ -2,3 +2,14 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in test_gem.gemspec
4
4
  gemspec
5
+
6
+ group :development, :test do
7
+ gem 'bundler', '~> 1.11'
8
+ gem 'rake', '~> 10.0'
9
+ gem 'rspec', '~> 3.4'
10
+ gem 'rubocop', '~> 0.37'
11
+ gem 'simplecov', '~> 0.11'
12
+ gem 'pry', '~> 0.10'
13
+ gem 'pry-byebug', '~> 3.3'
14
+ gem 'webmock', '~> 2.1'
15
+ end
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  LetsEncrypt utility client for WebFaction hosts.
4
4
 
5
- This tool simplifies the manual process of using LetsEncrypt on WebFaction hosts. It can be added to the Cron scheduled task runner where it will validate your domains automatically, place the generated certificates in a common folder, and then email the WebFaction Support team to request installation, also notifying you.
5
+ This tool automates the process of using LetsEncrypt on WebFaction hosts. It can be added to the Cron scheduled task runner where it will validate your domains automatically, obtain the certificates, and then install them using the Webfaction API.
6
6
 
7
7
  For more documentation, as well as walkthroughs, [see the wiki](https://github.com/will-in-wi/letsencrypt-webfaction/wiki)!
8
8
 
@@ -18,9 +18,9 @@ For more documentation, as well as walkthroughs, [see the wiki](https://github.c
18
18
 
19
19
  [Certbot](https://certbot.eff.org/) is the "official" (in that it was the first and to some extent reference client) Let's Encrypt client. Let's Encrypt decided to focus Certbot on a particular use case, namely the configuration of servers which are directly facing the internet and can have the Certbot application run as root. For other use cases, they encourage the implementation of other clients tailored to different cases. This has spawned a wide variety of alternative implementations.
20
20
 
21
- LetsEncrypt WebFaction is just such an alternative implementation. It was built because the WebFaction use case does not fit in the Certbot preconditions, namely that users don't have root access to change the frontend Nginx server configuration. WebFaction thus far requires that we place the certificate and private key somewhere on the server and then submit a ticket to install the certificate. This is exactly the workflow that is being automated.
21
+ LetsEncrypt WebFaction is just such an alternative implementation. It was built because the WebFaction use case does not fit in the Certbot preconditions, namely that users don't have root access to change the frontend Nginx server configuration. WebFaction has a custom API we use to install the certificate.
22
22
 
23
- Certbot could probably be used in "manual" mode to create the certificate on disk, and then something else wired up to make the certificate installation request. For various reasons, I decided not to do this. If someone creates instructions to do this, I'd be happy to link to it from [the wiki](https://github.com/will-in-wi/letsencrypt-webfaction/wiki).
23
+ Certbot could probably be used in "webroot" mode to create the certificate on disk, and have someone write a custom plugin to install using the API. For various reasons, I decided not to do this. If someone creates instructions to do this, I'd be happy to link to it from [the wiki](https://github.com/will-in-wi/letsencrypt-webfaction/wiki).
24
24
 
25
25
  ## Prerequisite topics
26
26
 
@@ -67,7 +67,7 @@ This will simplify the running of the LetsEncrypt WebFaction command, by setting
67
67
 
68
68
  After saving `~/.bash_profile`, run the command `source $HOME/.bash_profile` to apply the new settings.
69
69
 
70
- Now, you are ready to run `letsencrypt_webfaction` from your SSH session to get certificates. See below for usage.
70
+ Now, you are ready to run `letsencrypt_webfaction` from your SSH session to get certificates. See below for usage.
71
71
 
72
72
  ### RBEnv
73
73
 
@@ -75,13 +75,13 @@ This method is useful if you are already using RBEnv to manage Ruby, or if you a
75
75
 
76
76
  Follow the instructions to [set up RBEnv](https://github.com/rbenv/rbenv) and [Ruby Build](https://github.com/rbenv/ruby-build#readme) on your WebFaction server.
77
77
 
78
- Once you have done so, install Ruby 2.1+ (probably 2.3.0 at time of writing). Then set the local Ruby and install the Gem. Finally unset the local Ruby so that you don't run into problems.
78
+ Once you have done so, install Ruby 2.1+ (probably 2.3.1 at time of writing). Then set the local Ruby and install the Gem. Finally unset the local Ruby so that you don't run into problems.
79
79
 
80
- $ rbenv install 2.3.0 # Installs Ruby 2.3.0
81
- $ rbenv local 2.3.0 # Sets Ruby 2.3.0 as the default version in the current folder.
80
+ $ rbenv install 2.3.1 # Installs Ruby 2.3.1
81
+ $ rbenv local 2.3.1 # Sets Ruby 2.3.1 as the default version in the current folder.
82
82
  $ gem install letsencrypt_webfaction # Installs this utility from RubyGems.
83
83
  $ rbenv rehash # Makes RBenv aware of the letsencrypt_webfaction utility.
84
- $ rm .ruby-version # Unsets Ruby 2.3.0 as the default version in the current folder.
84
+ $ rm .ruby-version # Unsets Ruby 2.3.1 as the default version in the current folder.
85
85
 
86
86
  ## Usage
87
87
 
@@ -89,19 +89,19 @@ Once you have done so, install Ruby 2.1+ (probably 2.3.0 at time of writing). Th
89
89
 
90
90
  The syntax of the letsencrypt_webfaction command is as follows:
91
91
 
92
- $ letsencrypt_webfaction --account_email <email-address> --domains <domain[,domain[,domain...]]> --public <server-folder>
92
+ $ letsencrypt_webfaction --letsencrypt_account_email <email-address> --domains <domain[,domain[,domain...]]> --public <server-folder> --username <webfaction-username> --password <webfaction-password>
93
93
 
94
94
 
95
95
  ### Options:
96
96
 
97
97
  The basic parameters are as follows:
98
98
 
99
- * `--account_email`
99
+ * `--letsencrypt_account_email`
100
100
 
101
- Your WebFaction contact email address.
101
+ The email address you want associated with the issued certificates.
102
+
103
+ * `--domains`
102
104
 
103
- * `--domains`
104
-
105
105
  The domains for which you want to create certificates, separated by commas (with no spaces). The domains must be served from the same folder. There is one certificate per webapp, regardless of how many domains are served from it.
106
106
 
107
107
  * `--public`
@@ -114,24 +114,32 @@ The basic parameters are as follows:
114
114
 
115
115
  In some cases (such as with some Node.js or Python applications), you may need to create this folder. See [here](https://github.com/will-in-wi/letsencrypt-webfaction/issues/24) for an example of this workaround.
116
116
 
117
- If you have several webapps, then you will need to issue the command several times. The command can be run from any folder.
117
+ * `--username`
118
+
119
+ The username you use to log into the Webfaction control panel.
120
+
121
+ * `--password`
122
+
123
+ The password you use to log into the Webfaction control panel.
124
+
125
+ It is better to place this in a config file than to put it in the command line.
126
+
127
+ If you have several webapps, then you will need to issue the command several times. The command can be run from any folder.
118
128
 
119
129
  Other parameters (which are generally best left to their default values, unless you have a perticular need to change them) can be found in the `config.defaults.yml` configuration file (see below in the "More detailed examples" section).
120
130
 
121
131
  ### Example
122
- Here is a basic example which issues one certificate for both yourdomain.com and www.yourdomain.com, both of which are served by `~/webapps/yourapp/wordpress` and your WebFaction contact email address is you@youremail.com. This assumes that both yourdomain.com and www.yourdomain.com are served from the same folder.
132
+ Here is a basic example which issues one certificate for both yourdomain.com and www.yourdomain.com, both of which are served by `~/webapps/yourapp/wordpress` and your WebFaction contact email address is you@youremail.com. This assumes that both yourdomain.com and www.yourdomain.com are served from the same folder.
123
133
 
124
- $ letsencrypt_webfaction --account_email you@youremail.com --domains yourdomain.com,www.yourdomain.com --public ~/webapps/yourapp/wordpress/
134
+ $ letsencrypt_webfaction --letsencrypt_account_email you@youremail.com --domains yourdomain.com,www.yourdomain.com --public ~/webapps/yourapp/wordpress/
125
135
 
126
136
  ### Testing
127
137
 
128
- To test certificate issuance, consider using the [LetsEncrypt staging server](https://community.letsencrypt.org/t/testing-against-the-lets-encrypt-staging-environment/6763). This doesn't have the rate limit of 5 certs per domain every 7 days. You can add the `--endpoint https://acme-staging.api.letsencrypt.org/` parameter to the `letsencrypt_webfaction` command to do so.
129
-
130
- When testing, you will also want to change the `--support_email` parameter, so that an email is not sent needlessly to WebFaction Support. To do this, add `--support_email ""` (so no support email is sent) or `--support_email you@youremail.com` (so the support email is sent to you).
138
+ To test certificate issuance, consider using the [LetsEncrypt staging server](https://community.letsencrypt.org/t/testing-against-the-lets-encrypt-staging-environment/6763). This doesn't have the rate limit of 5 certs per domain every 7 days. You can add the `--endpoint https://acme-staging.api.letsencrypt.org/` parameter to the `letsencrypt_webfaction` command to do so.
131
139
 
132
140
  A test command could thus be something like the following:
133
141
 
134
- $ letsencrypt_webfaction --account_email you@youremail.com --domains yourdomain.com,www.yourdomain.com --public ~/webapps/yourapp/wordpress/ --endpoint https://acme-staging.api.letsencrypt.org/ --support_email you@youremail.com
142
+ $ letsencrypt_webfaction --letsencrypt_account_email you@youremail.com --domains yourdomain.com,www.yourdomain.com --public ~/webapps/yourapp/wordpress/ --endpoint https://acme-staging.api.letsencrypt.org/
135
143
 
136
144
 
137
145
  ### Operation
@@ -153,9 +161,9 @@ Normally, you will run the script manually once to get the certificate, and then
153
161
  Your Cron task could look something like:
154
162
 
155
163
  # System Ruby Installation
156
- 0 4 1 */2 * PATH=$PATH:$GEM_HOME/bin GEM_HOME=$HOME/.letsencrypt_webfaction/gems RUBYLIB=$GEM_HOME/lib ruby2.2 $HOME/.letsencrypt_webfaction/gems/bin/letsencrypt_webfaction --account_email [you@youremail.com] --domains [yourdomain.com,www.yourdomain.com] --public ~/webapps/[yourapp/your_public_html]/
164
+ 0 4 1 */2 * PATH=$PATH:$GEM_HOME/bin:/usr/local/bin GEM_HOME=$HOME/.letsencrypt_webfaction/gems RUBYLIB=$GEM_HOME/lib ruby2.2 $HOME/.letsencrypt_webfaction/gems/bin/letsencrypt_webfaction --letsencrypt_account_email [you@youremail.com] --domains [yourdomain.com,www.yourdomain.com] --public ~/webapps/[yourapp/your_public_html]/
157
165
  # RBEnv Installation
158
- 0 4 1 */2 * RBENV_ROOT=~/.rbenv RBENV_VERSION=2.3.0 ~/.rbenv/bin/rbenv exec letsencrypt_webfaction --account_email [you@youremail.com] --domains [yourdomain.com,www.yourdomain.com] --public ~/webapps/[yourapp/your_public_html]/
166
+ 0 4 1 */2 * RBENV_ROOT=~/.rbenv RBENV_VERSION=2.3.1 ~/.rbenv/bin/rbenv exec letsencrypt_webfaction --letsencrypt_account_email [you@youremail.com] --domains [yourdomain.com,www.yourdomain.com] --public ~/webapps/[yourapp/your_public_html]/
159
167
 
160
168
  This [would run](http://crontab.guru/#0_4_1_*/2_*) at 4 a.m. on the first day of January, March, May, July, September, and November. Certificates expire three months after issuance, so modify as desired (for example, you may want to run the task every two months initially, to be sure that everything is working before extending the period). Change the date of the Cron task so that WebFaction staff don't simultaneously receive all certificate change requests on the first day of the month.
161
169
 
@@ -182,7 +190,7 @@ To upgrade, run one of the following two commands to fetch and install the newes
182
190
  GEM_HOME=$HOME/.letsencrypt_webfaction/gems RUBYLIB=$GEM_HOME/lib gem2.2 install letsencrypt_webfaction
183
191
 
184
192
  # For RBenv
185
- RBENV_VERSION=2.3.0 gem install letsencrypt_webfaction
193
+ RBENV_VERSION=2.3.1 gem install letsencrypt_webfaction
186
194
  ```
187
195
 
188
196
  ### More detailed examples
@@ -4,7 +4,9 @@ endpoint: 'https://acme-v01.api.letsencrypt.org/'
4
4
  domains: []
5
5
  public: ''
6
6
  output_dir: '~/le_certs/'
7
- support_email: 'support@webfaction.com'
8
- account_email: ''
9
- admin_notification_email: '' # Defaults to the value given in account_email.
10
- letsencrypt_account_email: '' # Defaults to the value given in account_email.
7
+ letsencrypt_account_email: ''
8
+ api_url: 'https://api.webfaction.com/'
9
+ username: ''
10
+ password: ''
11
+ servername: ''
12
+ cert_name: ''
@@ -2,7 +2,7 @@
2
2
 
3
3
  key_size: 4096
4
4
  endpoint: 'https://acme-v01.api.letsencrypt.org/'
5
- account_email: 'me@example.com'
5
+ letsencrypt_account_email: 'me@example.com'
6
6
  domains:
7
7
  - 'example.com'
8
8
  - 'www.example.com'
@@ -29,13 +29,4 @@ Gem::Specification.new do |spec|
29
29
  spec.required_ruby_version = '>= 2.1.0'
30
30
 
31
31
  spec.add_runtime_dependency 'acme-client', '>=0.4.1'
32
- spec.add_runtime_dependency 'pony', '~> 1.11'
33
-
34
- spec.add_development_dependency 'bundler', '~> 1.11'
35
- spec.add_development_dependency 'rake', '~> 10.0'
36
- spec.add_development_dependency 'rspec', '~> 3.4'
37
- spec.add_development_dependency 'rubocop', '~> 0.37'
38
- spec.add_development_dependency 'simplecov', '~> 0.11'
39
- spec.add_development_dependency 'pry', '~> 0.10'
40
- spec.add_development_dependency 'pry-byebug', '~> 3.3'
41
32
  end
@@ -1,3 +1,3 @@
1
1
  module LetsencryptWebfaction
2
- VERSION = '1.1.8'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -3,9 +3,8 @@ require 'acme-client'
3
3
 
4
4
  require 'letsencrypt_webfaction/args_parser'
5
5
  require 'letsencrypt_webfaction/domain_validator'
6
- require 'letsencrypt_webfaction/certificate_writer'
7
- require 'letsencrypt_webfaction/instructions'
8
- require 'letsencrypt_webfaction/emailer'
6
+ require 'letsencrypt_webfaction/certificate_installer'
7
+ require 'letsencrypt_webfaction/webfaction_api_credentials'
9
8
 
10
9
  module LetsencryptWebfaction
11
10
  class Application
@@ -24,24 +23,16 @@ module LetsencryptWebfaction
24
23
  return unless validator.validate!
25
24
 
26
25
  # Write the obtained certificates.
27
- certificate_writer.write!
28
-
29
- # Send emails.
30
- emailer.send!
26
+ certificate_installer.install!
31
27
  end
32
28
 
33
29
  private
34
30
 
35
- def emailer
36
- @emails ||= LetsencryptWebfaction::Emailer.new instructions, support_email: @options.support_email, account_email: @options.account_email, notification_email: @options.admin_notification_email, email_configuration: @options.email_configuration
37
- end
38
-
39
- def instructions
40
- @instructions ||= LetsencryptWebfaction::Instructions.new certificate_writer.output_dir, @options.domains
41
- end
42
-
43
- def certificate_writer
44
- @certificate_writer ||= LetsencryptWebfaction::CertificateWriter.new(@options.output_dir, @options.domains.first, certificate)
31
+ def certificate_installer
32
+ @certificate_installer ||= begin
33
+ credentials = LetsencryptWebfaction::WebfactionApiCredentials.new username: @options.username, password: @options.password, servername: @options.servername, api_server: @options.api_url
34
+ LetsencryptWebfaction::CertificateInstaller.new(@options.cert_name, certificate, credentials)
35
+ end
45
36
  end
46
37
 
47
38
  def certificate
@@ -1,4 +1,5 @@
1
1
  require 'optparse'
2
+ require 'socket'
2
3
  require 'yaml'
3
4
 
4
5
  require 'letsencrypt_webfaction'
@@ -19,10 +20,12 @@ module LetsencryptWebfaction
19
20
  Field::ListField.new(:domains, 'Comma separated list of domains. The first one will be the common name.', [ArrayValidator.new]),
20
21
  Field.new(:public, 'Location on the filesystem served by the desired site (e.g. ~/webapps/myapp/public_html)', [StringValidator.new]),
21
22
  Field.new(:output_dir, 'Location on the filesystem to which the certs will be saved.', [StringValidator.new]),
22
- Field.new(:support_email, 'The email address of the ISP support.', []),
23
- Field.new(:account_email, 'The email address associated with your account.', [StringValidator.new]),
24
- Field.new(:admin_notification_email, 'The email address associated with your account. Defaults to the value of account_email.', []),
25
- Field.new(:letsencrypt_account_email, 'The email address associated with your account. Defaults to the value of account_email.', []),
23
+ Field.new(:letsencrypt_account_email, 'The email address associated with your account.', [StringValidator.new]),
24
+ Field.new(:api_url, 'The URL to the Webfaction API.', [StringValidator.new]),
25
+ Field.new(:username, 'The username for your Webfaction account.', [StringValidator.new]),
26
+ Field.new(:password, 'The password for your Webfaction account.', [StringValidator.new]),
27
+ Field.new(:servername, 'The server on which this application resides (e.g. Web123).', [StringValidator.new]),
28
+ Field.new(:cert_name, 'The name of the certificate in the Webfaction UI.', [StringValidator.new]),
26
29
  ].freeze
27
30
 
28
31
  # Set up getters.
@@ -114,15 +117,17 @@ module LetsencryptWebfaction
114
117
  end
115
118
 
116
119
  def parse!
120
+ # rubocop:disable Style/GuardClause
117
121
  opt_parser.parse!(@options)
118
122
 
119
- # Set defaults from other fields.
120
- if @admin_notification_email.nil? || @admin_notification_email == ''
121
- @admin_notification_email = @account_email
123
+ # Set default hostname
124
+ if @servername.nil? || @servername == ''
125
+ @servername = Socket.gethostname.split('.')[0].sub(/^./, &:upcase)
122
126
  end
123
127
 
124
- if @letsencrypt_account_email.nil? || @letsencrypt_account_email == ''
125
- @letsencrypt_account_email = @account_email
128
+ # Set default cert_name
129
+ if @cert_name.nil? || @cert_name == ''
130
+ @cert_name = @domains[0].tr('.', '_') if @domains.any?
126
131
  end
127
132
  end
128
133
  end
@@ -0,0 +1,38 @@
1
+ require 'xmlrpc/client'
2
+
3
+ module LetsencryptWebfaction
4
+ class CertificateInstaller
5
+ WEBFACTION_API_VERSION = 2
6
+
7
+ def initialize(cert_name, certificate, credentials)
8
+ @cert_name = cert_name
9
+ @certificate = certificate
10
+ @credentials = credentials
11
+ end
12
+
13
+ def install!
14
+ cert_list = server_client.call('list_certificates', session_id)
15
+ action = if cert_list.find { |cert| cert['name'] == @cert_name }
16
+ 'update_certificate'
17
+ else
18
+ 'create_certificate'
19
+ end
20
+ server_client.call(action, session_id, @cert_name, @certificate.to_pem, @certificate.request.private_key.to_pem, @certificate.chain_to_pem)
21
+
22
+ true
23
+ end
24
+
25
+ private
26
+
27
+ def server_client
28
+ @server_client ||= XMLRPC::Client.new2(@credentials.api_server)
29
+ end
30
+
31
+ def session_id
32
+ @session_id ||= begin
33
+ login_resp = server_client.call('login', @credentials.username, @credentials.password, @credentials.servername, WEBFACTION_API_VERSION)
34
+ login_resp[0]
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,15 @@
1
+ module LetsencryptWebfaction
2
+ class WebfactionApiCredentials
3
+ attr_reader :username
4
+ attr_reader :password
5
+ attr_reader :servername
6
+ attr_reader :api_server
7
+
8
+ def initialize(username:, password:, servername:, api_server:)
9
+ @username = username
10
+ @password = password
11
+ @servername = servername
12
+ @api_server = api_server
13
+ end
14
+ end
15
+ end
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: 1.1.8
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Johnston
@@ -30,7 +30,7 @@ cert_chain:
30
30
  urnVFSXSvmjoq2UEqNf39Ffw4ZJ2QYuxlOLEInXhf1Rij1+KYHwHoT6qaOmk+fgY
31
31
  XWr3WAp8Tv/ogSwGuBGWtsjMTEzbRxAJbRXQDFEMeXJAvzon0o6hUtU=
32
32
  -----END CERTIFICATE-----
33
- date: 2016-08-20 00:00:00.000000000 Z
33
+ date: 2016-11-17 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: acme-client
@@ -46,118 +46,6 @@ dependencies:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: 0.4.1
49
- - !ruby/object:Gem::Dependency
50
- name: pony
51
- requirement: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: '1.11'
56
- type: :runtime
57
- prerelease: false
58
- version_requirements: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '1.11'
63
- - !ruby/object:Gem::Dependency
64
- name: bundler
65
- requirement: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.11'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '1.11'
77
- - !ruby/object:Gem::Dependency
78
- name: rake
79
- requirement: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '10.0'
84
- type: :development
85
- prerelease: false
86
- version_requirements: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: '10.0'
91
- - !ruby/object:Gem::Dependency
92
- name: rspec
93
- requirement: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '3.4'
98
- type: :development
99
- prerelease: false
100
- version_requirements: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - "~>"
103
- - !ruby/object:Gem::Version
104
- version: '3.4'
105
- - !ruby/object:Gem::Dependency
106
- name: rubocop
107
- requirement: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - "~>"
110
- - !ruby/object:Gem::Version
111
- version: '0.37'
112
- type: :development
113
- prerelease: false
114
- version_requirements: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - "~>"
117
- - !ruby/object:Gem::Version
118
- version: '0.37'
119
- - !ruby/object:Gem::Dependency
120
- name: simplecov
121
- requirement: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: '0.11'
126
- type: :development
127
- prerelease: false
128
- version_requirements: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - "~>"
131
- - !ruby/object:Gem::Version
132
- version: '0.11'
133
- - !ruby/object:Gem::Dependency
134
- name: pry
135
- requirement: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: '0.10'
140
- type: :development
141
- prerelease: false
142
- version_requirements: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - "~>"
145
- - !ruby/object:Gem::Version
146
- version: '0.10'
147
- - !ruby/object:Gem::Dependency
148
- name: pry-byebug
149
- requirement: !ruby/object:Gem::Requirement
150
- requirements:
151
- - - "~>"
152
- - !ruby/object:Gem::Version
153
- version: '3.3'
154
- type: :development
155
- prerelease: false
156
- version_requirements: !ruby/object:Gem::Requirement
157
- requirements:
158
- - - "~>"
159
- - !ruby/object:Gem::Version
160
- version: '3.3'
161
49
  description: A tool to simplify the manual process of using LetsEncrypt on Webfaction
162
50
  hosts. It can be added to cron where it will validate your domains automatically,
163
51
  place the generated certs in a common folder, and then email the WebFaction support
@@ -196,10 +84,9 @@ files:
196
84
  - lib/letsencrypt_webfaction/args_parser/defined_values_validator.rb
197
85
  - lib/letsencrypt_webfaction/args_parser/field.rb
198
86
  - lib/letsencrypt_webfaction/args_parser/string_validator.rb
199
- - lib/letsencrypt_webfaction/certificate_writer.rb
87
+ - lib/letsencrypt_webfaction/certificate_installer.rb
200
88
  - lib/letsencrypt_webfaction/domain_validator.rb
201
- - lib/letsencrypt_webfaction/emailer.rb
202
- - lib/letsencrypt_webfaction/instructions.rb
89
+ - lib/letsencrypt_webfaction/webfaction_api_credentials.rb
203
90
  homepage: https://github.com/will-in-wi/letsencrypt-webfaction
204
91
  licenses:
205
92
  - MIT
@@ -220,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
107
  version: '0'
221
108
  requirements: []
222
109
  rubyforge_project:
223
- rubygems_version: 2.5.1
110
+ rubygems_version: 2.6.8
224
111
  signing_key:
225
112
  specification_version: 4
226
113
  summary: LetsEncrypt utility client for WebFaction hosts.
metadata.gz.sig CHANGED
Binary file
@@ -1,35 +0,0 @@
1
- module LetsencryptWebfaction
2
- class CertificateWriter
3
- attr_reader :output_dir
4
-
5
- def initialize(output_dir, domain, certificate)
6
- @certificate = certificate
7
-
8
- cert_date = Time.now.strftime('%Y%m%d%H%M%S')
9
-
10
- expanded_dir = File.expand_path(output_dir)
11
- @output_dir = File.join(expanded_dir, domain, cert_date)
12
- end
13
-
14
- def write!
15
- create_folder!
16
-
17
- # Save the certificate and key
18
- write_file!('privkey.pem', @certificate.request.private_key.to_pem)
19
- write_file!('cert.pem', @certificate.to_pem)
20
- write_file!('chain.pem', @certificate.chain_to_pem)
21
- write_file!('fullchain.pem', @certificate.fullchain_to_pem)
22
- end
23
-
24
- private
25
-
26
- def create_folder!
27
- # Make sure the output directory exists.
28
- FileUtils.mkdir_p(output_dir)
29
- end
30
-
31
- def write_file!(filename, data)
32
- File.write(File.join(@output_dir, filename), data)
33
- end
34
- end
35
- end
@@ -1,36 +0,0 @@
1
- require 'pony'
2
-
3
- module LetsencryptWebfaction
4
- class Emailer
5
- SUBJECT_MESSAGE = 'New certificate installation'.freeze
6
-
7
- def initialize(instructions, support_email: '', account_email: '', notification_email: '', email_configuration: {})
8
- @instructions = instructions
9
-
10
- raise Error, 'Missing account_email' if account_email == '' || account_email.nil?
11
- raise Error, 'Missing notification_email' if notification_email == '' || notification_email.nil?
12
-
13
- @support_email = support_email
14
- @account_email = account_email
15
- @notification_email = notification_email
16
-
17
- Pony.options = email_configuration
18
- end
19
-
20
- def send!
21
- send_to_support!
22
- send_to_account!
23
- end
24
-
25
- def send_to_support!
26
- return if @support_email.nil? || @support_email == ''
27
- Pony.mail(to: @support_email, from: @account_email, subject: SUBJECT_MESSAGE, body: @instructions.instructions)
28
- end
29
-
30
- def send_to_account!
31
- Pony.mail(to: @notification_email, from: @notification_email, subject: SUBJECT_MESSAGE, body: @instructions.full_message(support_email: @support_email != ''))
32
- end
33
-
34
- class Error < StandardError; end
35
- end
36
- end
@@ -1,48 +0,0 @@
1
- module LetsencryptWebfaction
2
- class Instructions
3
- def initialize(output_dir, domains)
4
- @output_dir = output_dir
5
- @domains = domains
6
- end
7
-
8
- def context(support_email: true)
9
- out = 'LetsEncrypt Webfaction has generated a new certificate for ' \
10
- "#{to_sentence @domains}. The certificates have been placed in " \
11
- "#{@output_dir}. "
12
-
13
- out << if support_email
14
- 'WebFaction support has been contacted with the following message:'
15
- else
16
- 'Go to https://help.webfaction.com, log in, and paste the ' \
17
- 'following text into a new ticket:'
18
- end
19
-
20
- out
21
- end
22
-
23
- def instructions
24
- "Please apply the new certificate in #{@output_dir} to " \
25
- "#{to_sentence @domains}. Thanks!"
26
- end
27
-
28
- def full_message(support_email: true)
29
- context(support_email: support_email) + "\n\n" + instructions
30
- end
31
-
32
- private
33
-
34
- # Borrowed (with simplifications) from ActiveSupport.
35
- def to_sentence(str)
36
- case str.length
37
- when 0
38
- ''
39
- when 1
40
- str[0].to_s.dup
41
- when 2
42
- "#{str[0]} and #{str[1]}"
43
- else
44
- "#{str[0...-1].join(', ')}, and #{str[-1]}"
45
- end
46
- end
47
- end
48
- end