surtr 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/surtr +92 -0
- data/lib/surtr.rb +6 -0
- data/lib/surtr/version.rb +3 -0
- data/surtr.gemspec +37 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 948f1f0c63f5e9a2e40c94b2ea2761be99cec4c0d40e530f8085835a031b1146
|
4
|
+
data.tar.gz: 1efd1384bdf99926d1ccc47632079c8919852cce7bbd3235bb7787760762a82d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6cb57508b08bccac29502ac7735fc9c955425e579ba193e0f62014368c62f7f8f10c21b5789dca22f2b9de2a59fb55f3a6f130bde0a3ab84aa1f99c58d5c9526
|
7
|
+
data.tar.gz: 3cc3980493007ae740f9f090e49b934280c7bdfa6a1ee4fa461cc79fdf8119d875d5214cd2f2d6cb06ea7c977617d4ec1e926a0db511e47941295cd17bb373d1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Nathan Baum
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Surtr
|
2
|
+
|
3
|
+
A tool for managing Let's Encrypt certificates.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
gem install surtr
|
8
|
+
|
9
|
+
## Commands
|
10
|
+
|
11
|
+
### surtr acme genkey
|
12
|
+
|
13
|
+
Generate a signing key for ACME requests.
|
14
|
+
|
15
|
+
### surtr acme register EMAIL
|
16
|
+
|
17
|
+
Register the signing key with Let's Encrypt.
|
18
|
+
|
19
|
+
### surtr acme authorize challenge DOMAIN
|
20
|
+
|
21
|
+
Begin or resume a DNS challenge for the specified domain.
|
22
|
+
|
23
|
+
### surtr acme authorize verify DOMAIN
|
24
|
+
|
25
|
+
For when the DNS has updated: verify the authorization.
|
26
|
+
|
27
|
+
### surtr acme certificate DESTINATION DOMAINS...
|
28
|
+
|
29
|
+
Obtain a certificate for DOMAINS and store the files in DESTINATION.
|
30
|
+
|
31
|
+
### surtr dns gcp NAME TYPE VALUE
|
32
|
+
|
33
|
+
Add a DNS record to GCP.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "surtr"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/surtr
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "surtr"
|
4
|
+
require "clamp"
|
5
|
+
require "abbrev"
|
6
|
+
|
7
|
+
module Clamp::Subcommand::Declaration
|
8
|
+
def find_subcommand (name)
|
9
|
+
names = recognised_subcommands.flat_map(&:names)
|
10
|
+
names = Abbrev.abbrev(names)[name]
|
11
|
+
name = names
|
12
|
+
recognised_subcommands.find{|sc|sc.is_called?(name)}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Clamp do
|
17
|
+
|
18
|
+
subcommand %w(dns), "Manage DNS" do
|
19
|
+
|
20
|
+
option "--project", "PROJECT", "google cloud project name", required: true, environment_variable: "SURTR_GCP_PROJECT"
|
21
|
+
|
22
|
+
subcommand %w(gcp), "Add a DNS record" do
|
23
|
+
|
24
|
+
parameter "NAME", "record name"
|
25
|
+
parameter "TYPE", "record type"
|
26
|
+
parameter "VALUE", "record value"
|
27
|
+
|
28
|
+
def execute
|
29
|
+
Surtr::DNS.gcp project, name, type, value
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
subcommand %w(acme), "Manage ACME" do
|
37
|
+
|
38
|
+
option "--keyfile", "FILE", "where to store the ACME key", default: ENV["HOME"] + "/.acme.pem", environment_variable: "SURTR_ACME_KEYFILE"
|
39
|
+
option "--endpoint", "STRING", "which ACME endpoint to use [staging, v01]", default: "v01", environment_variable: "SURTR_ACME_ENDPOINT" do |val|
|
40
|
+
fail ArgumentError, "endpoint must be either `staging' or `v01'" unless %w(staging v01).member?(val)
|
41
|
+
end
|
42
|
+
|
43
|
+
subcommand %w(key), "Generate ACME key" do
|
44
|
+
|
45
|
+
def execute
|
46
|
+
Surtr::ACME.genkey keyfile
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
subcommand %w(register), "Register private key with ACME" do
|
52
|
+
|
53
|
+
parameter "EMAIL", "email address", environment_variable: "SURTR_ACME_REGISTER_EMAIL"
|
54
|
+
|
55
|
+
def execute
|
56
|
+
Surtr::ACME.register keyfile, endpoint, email
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
subcommand %w(certificate), "Get a certificate" do
|
62
|
+
|
63
|
+
parameter "DESTINATION", "directory the certificate files will be put in"
|
64
|
+
parameter "DOMAIN ...", "domains to generate a certificate for"
|
65
|
+
|
66
|
+
def execute
|
67
|
+
Surtr::ACME.certificate keyfile, endpoint, destination, domain_list
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
subcommand %w(authorize), "Authorize a domain" do
|
73
|
+
|
74
|
+
parameter "DOMAIN", "domain name", environment_variable: "SURTR_ACME_AUTH_DOMAIN"
|
75
|
+
|
76
|
+
subcommand %w(c challenge), "Begin authorization challenge" do
|
77
|
+
def execute
|
78
|
+
Surtr::ACME.challenge keyfile, endpoint, domain
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
subcommand %w(verify validate), "Verify authorization" do
|
83
|
+
def execute
|
84
|
+
Surtr::ACME.verify keyfile, endpoint, domain
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
data/lib/surtr.rb
ADDED
data/surtr.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "surtr/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "surtr"
|
8
|
+
spec.version = Surtr::VERSION
|
9
|
+
spec.authors = ["Nathan Baum"]
|
10
|
+
spec.email = ["n@p12a.org.uk"]
|
11
|
+
|
12
|
+
spec.summary = "A tool for managing Let's Encrypt certificates."
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
21
|
+
"public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
f.match(%r{^(test|spec|features)/})
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_dependency "clamp", "~> 1.2"
|
32
|
+
spec.add_dependency "google-cloud-dns", "~> 0.28"
|
33
|
+
spec.add_dependency "acme-client", "~> 0.6"
|
34
|
+
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: surtr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nathan Baum
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: clamp
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: google-cloud-dns
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.28'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.28'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: acme-client
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.16'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.16'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- n@p12a.org.uk
|
86
|
+
executables:
|
87
|
+
- surtr
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/console
|
97
|
+
- bin/setup
|
98
|
+
- exe/surtr
|
99
|
+
- lib/surtr.rb
|
100
|
+
- lib/surtr/version.rb
|
101
|
+
- surtr.gemspec
|
102
|
+
homepage:
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata:
|
106
|
+
allowed_push_host: https://rubygems.org
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.7.6
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: A tool for managing Let's Encrypt certificates.
|
127
|
+
test_files: []
|