itamae-plugin-recipe-certbot 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +2 -0
- data/LICENSE +22 -0
- data/README.md +60 -0
- data/Rakefile +6 -0
- data/itamae-plugin-recipe-certbot.gemspec +35 -0
- data/lib/itamae/plugin/recipe/certbot/command.rb +13 -0
- data/lib/itamae/plugin/recipe/certbot/cron.rb +38 -0
- data/lib/itamae/plugin/recipe/certbot/get.rb +63 -0
- data/lib/itamae/plugin/recipe/certbot/templates/etc/cron.d/itamae-certbot.erb +3 -0
- data/lib/itamae/plugin/recipe/certbot/version.rb +9 -0
- data/lib/itamae/plugin/recipe/certbot.rb +1 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5cccaf3da15d10f3e88c4f27cfb8e3adc8ec3a1bacdb363bfb80225b23ca8783
|
4
|
+
data.tar.gz: c9aeef2ccdead3d3f240911bbc5b2d6f4073b7da14947ef2768940e7e273a363
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 690846ae3f82a4dc211d7492be1169aebf7883e98a4552f8786835951f6a603e84ae5cc41fafa253a8f525047f9b50ca592880d406d9f4fd6c0377c89140deec
|
7
|
+
data.tar.gz: bd7bbd9fef38484c3f1fbbacc1996aad178e6e596e4c893d50f49c8a607f11da5cc3d7a8d387dd7a10399e489c3f9b6bc46e14178e98b71accce11bba7a83295
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
## Unreleased
|
2
|
+
## v0.3.0 - 2023-11-22
|
3
|
+
- Rename gem from [`itamae-plugin-recipe-letsencrypt`][prior] to `itamae-plugin-recipe-certbot`
|
4
|
+
- Updated Certbot installation
|
5
|
+
- Revised certificates getting/updating process
|
6
|
+
|
7
|
+
[prior]: https://github.com/hatappi/itamae-plugin-recipe-letsencrypt
|
8
|
+
|
9
|
+
## v0.2.1 - 2017/01/10
|
10
|
+
- Support Amazon Linux
|
11
|
+
|
12
|
+
## v0.2.0 - 2016/12/18
|
13
|
+
- Support Standalone Challenge Type
|
14
|
+
|
15
|
+
## v0.1.0 - 2016/12/18
|
16
|
+
- First release :tada:
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Yusaku Hatanaka (hatappi)
|
4
|
+
Copyright (c) 2023 gemmaro
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Itamae plugin recipe Certbot
|
2
|
+
|
3
|
+
This gem is an [Itamae][] plugin for getting the [Let's Encrypt][le] certificates with [Certbot][].
|
4
|
+
|
5
|
+
[Certbot]: https://certbot.eff.org/
|
6
|
+
[Itamae]: https://github.com/ryotarai/itamae
|
7
|
+
[le]: https://letsencrypt.org/
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's `Gemfile`:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'itamae-plugin-recipe-certbot'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute `bundle`.
|
18
|
+
Or install it yourself as `gem install itamae-plugin-recipe-certbot`.
|
19
|
+
|
20
|
+
## Support
|
21
|
+
|
22
|
+
- [Debian GNU/Linux 10 (buster)][buster]
|
23
|
+
|
24
|
+
[buster]: https://www.debian.org/releases/buster/
|
25
|
+
|
26
|
+
Contributions are welcome for other platforms.
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
### Recipe
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
include_recipe "certbot::get"
|
34
|
+
```
|
35
|
+
|
36
|
+
### Node
|
37
|
+
|
38
|
+
`node.yml`:
|
39
|
+
|
40
|
+
```yaml
|
41
|
+
certbot:
|
42
|
+
domains:
|
43
|
+
- test.example.com
|
44
|
+
- test2.example.com
|
45
|
+
email: test@example.com
|
46
|
+
webroot_path: /var/www/example
|
47
|
+
```
|
48
|
+
|
49
|
+
```shell
|
50
|
+
itamae -y node.yml
|
51
|
+
```
|
52
|
+
|
53
|
+
Other attributes are set to defaults as in `lib/itamae/plugin/recipe/certbot/get.rb`.
|
54
|
+
Note that process of the port selected by `challenge_type` needs to be stopped.
|
55
|
+
|
56
|
+
## License
|
57
|
+
|
58
|
+
The gem is available as open source under the terms of the [MIT License][mit].
|
59
|
+
|
60
|
+
[mit]: http://opensource.org/licenses/MIT
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'itamae/plugin/recipe/certbot/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "itamae-plugin-recipe-certbot"
|
7
|
+
spec.version = Itamae::Plugin::Recipe::Certbot::VERSION
|
8
|
+
spec.authors = ["Yusaku Hatanaka (hatappi)", "gemmaro"]
|
9
|
+
spec.email = ["hata.yusaku.1225@gmail.com", "gemmaro.dev@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Itamae plugin to install Certbot}
|
12
|
+
spec.description = 'Itamae plugin recipe Certbot is a Itamae plugin to install and configure Certbot.'
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.homepage = 'https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "itamae-plugin-resource-snappy", "~> 0.1.0"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
|
26
|
+
spec.metadata = {
|
27
|
+
'rubygems_mfa_required' => 'true',
|
28
|
+
'bug_tracker_uri' => 'https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot/issues',
|
29
|
+
'changelog_uri' => 'https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot/src/branch/main/CHANGELOG.md',
|
30
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/itamae-plugin-recipe-certbot',
|
31
|
+
'homepage_uri' => spec.homepage,
|
32
|
+
'source_code_uri' => spec.homepage,
|
33
|
+
'wiki_uri' => 'https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot/wiki',
|
34
|
+
}
|
35
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
include_recipe 'command'
|
2
|
+
|
3
|
+
node.reverse_merge!(
|
4
|
+
certbot: {
|
5
|
+
cron: {
|
6
|
+
user: 'root',
|
7
|
+
file_path: '/etc/cron.d/itamae-certbot',
|
8
|
+
},
|
9
|
+
}
|
10
|
+
)
|
11
|
+
|
12
|
+
node.validate! do
|
13
|
+
{
|
14
|
+
certbot: {
|
15
|
+
cron: {
|
16
|
+
user: string,
|
17
|
+
file_path: string,
|
18
|
+
},
|
19
|
+
}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
template node[:certbot][:cron][:file_path] do
|
24
|
+
variables user: node[:certbot][:cron][:user],
|
25
|
+
command: node[:certbot][:command]
|
26
|
+
source 'templates/etc/cron.d/itamae-certbot.erb'
|
27
|
+
end
|
28
|
+
|
29
|
+
service_name = case node[:platform]
|
30
|
+
when 'amazon'
|
31
|
+
'crond'
|
32
|
+
else
|
33
|
+
'cron'
|
34
|
+
end
|
35
|
+
|
36
|
+
service service_name do
|
37
|
+
action :start
|
38
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
include_recipe 'command'
|
4
|
+
|
5
|
+
node.reverse_merge!(
|
6
|
+
certbot: {
|
7
|
+
challenge_type: 'http-01',
|
8
|
+
authenticator: 'standalone',
|
9
|
+
debug_mode: false,
|
10
|
+
snappy_executable: '/snap/bin/certbot',
|
11
|
+
live_dir: '/etc/letsencrypt/live',
|
12
|
+
}
|
13
|
+
)
|
14
|
+
|
15
|
+
node.validate! do
|
16
|
+
{
|
17
|
+
certbot: {
|
18
|
+
challenge_type: string,
|
19
|
+
authenticator: string,
|
20
|
+
debug_mode: boolean,
|
21
|
+
snappy_executable: string,
|
22
|
+
live_dir: string,
|
23
|
+
|
24
|
+
domains: array_of(string),
|
25
|
+
email: string,
|
26
|
+
webroot_path: optional(string),
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
package 'snapd'
|
32
|
+
|
33
|
+
snappy 'certbot' do
|
34
|
+
classic true
|
35
|
+
end
|
36
|
+
|
37
|
+
link node[:certbot][:command] do
|
38
|
+
to node[:certbot][:snappy_executable]
|
39
|
+
end
|
40
|
+
|
41
|
+
# get each domain certificate
|
42
|
+
node[:certbot][:domains].each do |domain|
|
43
|
+
execute "get #{domain} certificate" do
|
44
|
+
cmd = [
|
45
|
+
node[:certbot][:command],
|
46
|
+
'certonly',
|
47
|
+
'--agree-tos',
|
48
|
+
"--domain", domain,
|
49
|
+
"-m", node[:certbot][:email],
|
50
|
+
'-n', # Run non-interactively
|
51
|
+
'--keep',
|
52
|
+
"--authenticator", node[:certbot][:authenticator],
|
53
|
+
"--preferred-challenges", node[:certbot][:challenge_type],
|
54
|
+
]
|
55
|
+
cmd += ["--webroot", node[:certbot][:webroot_path]] if node[:certbot][:webroot_path]
|
56
|
+
cmd << '--debug' if node[:certbot][:debug_mode]
|
57
|
+
command cmd.shelljoin
|
58
|
+
|
59
|
+
dir = File.join(node[:certbot][:live_dir], domain)
|
60
|
+
exists = ["test", "-d", dir].shelljoin
|
61
|
+
not_if exists
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "itamae/plugin/recipe/certbot/version"
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: itamae-plugin-recipe-certbot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yusaku Hatanaka (hatappi)
|
8
|
+
- gemmaro
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2023-11-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: itamae-plugin-resource-snappy
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.1.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.1.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.12'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.12'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.0'
|
70
|
+
description: Itamae plugin recipe Certbot is a Itamae plugin to install and configure
|
71
|
+
Certbot.
|
72
|
+
email:
|
73
|
+
- hata.yusaku.1225@gmail.com
|
74
|
+
- gemmaro.dev@gmail.com
|
75
|
+
executables: []
|
76
|
+
extensions: []
|
77
|
+
extra_rdoc_files: []
|
78
|
+
files:
|
79
|
+
- ".gitignore"
|
80
|
+
- CHANGELOG.md
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- itamae-plugin-recipe-certbot.gemspec
|
86
|
+
- lib/itamae/plugin/recipe/certbot.rb
|
87
|
+
- lib/itamae/plugin/recipe/certbot/command.rb
|
88
|
+
- lib/itamae/plugin/recipe/certbot/cron.rb
|
89
|
+
- lib/itamae/plugin/recipe/certbot/get.rb
|
90
|
+
- lib/itamae/plugin/recipe/certbot/templates/etc/cron.d/itamae-certbot.erb
|
91
|
+
- lib/itamae/plugin/recipe/certbot/version.rb
|
92
|
+
homepage: https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata:
|
96
|
+
rubygems_mfa_required: 'true'
|
97
|
+
bug_tracker_uri: https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot/issues
|
98
|
+
changelog_uri: https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot/src/branch/main/CHANGELOG.md
|
99
|
+
documentation_uri: https://www.rubydoc.info/gems/itamae-plugin-recipe-certbot
|
100
|
+
homepage_uri: https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot
|
101
|
+
source_code_uri: https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot
|
102
|
+
wiki_uri: https://codeberg.org/gemmaro/itamae-plugin-recipe-certbot/wiki
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubygems_version: 3.3.26
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: Itamae plugin to install Certbot
|
122
|
+
test_files: []
|