bullion 0.3.0 → 0.3.1
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 +4 -4
- data/.rspec +0 -1
- data/Dockerfile +6 -16
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/Rakefile +20 -5
- data/lib/bullion/challenge_client.rb +1 -1
- data/lib/bullion/challenge_clients/dns.rb +10 -13
- data/lib/bullion/models/account.rb +2 -2
- data/lib/bullion/models/authorization.rb +1 -1
- data/lib/bullion/models/certificate.rb +1 -1
- data/lib/bullion/models/challenge.rb +7 -0
- data/lib/bullion/models/order.rb +1 -1
- data/lib/bullion/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1897a626efbdecba9680874c7c3266b74bcfdbbe75e6b9646876cdac0951166
|
4
|
+
data.tar.gz: 9615ce0ee849c308eb6c0e19ca265e08f2794decb0b204fe1d3b4ed0896e7705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f78395c368c1b52af2cf043615c89925697f48faf40d7fa5623198b44b14eece6085d7a49d00bbaff53c7e4d24dafe2fb8fb65fc7f788a872de98c3a75e6aa2a
|
7
|
+
data.tar.gz: d89899a9513543bbba121496a4c214f96ee327e98d7993c5806b436a32e2c16256dc9296f82fa74ab3a558ddaba8755dd895c8534a07e77580f5b964efbad118
|
data/.rspec
CHANGED
data/Dockerfile
CHANGED
@@ -1,34 +1,25 @@
|
|
1
|
-
FROM ruby:3.1
|
1
|
+
FROM ruby:3.1 AS build
|
2
2
|
|
3
3
|
ENV RACK_ENV=development
|
4
4
|
|
5
5
|
COPY . /build
|
6
6
|
|
7
|
-
RUN
|
8
|
-
&& apk --no-cache add git mariadb-client mariadb-connector-c \
|
9
|
-
runit sqlite-dev \
|
10
|
-
&& apk --no-cache add --virtual build-dependencies \
|
11
|
-
build-base mariadb-dev
|
7
|
+
RUN apt-get update && apt-get upgrade -y && apt-get install -y libsqlite3-dev sqlite3 curl libsodium-dev
|
12
8
|
|
13
|
-
RUN
|
14
|
-
&& cd /build \
|
9
|
+
RUN cd /build \
|
15
10
|
&& gem build bullion.gemspec \
|
16
11
|
&& mv bullion*.gem /bullion.gem
|
17
12
|
|
18
13
|
WORKDIR /build
|
19
14
|
|
20
|
-
FROM ruby:3.1
|
15
|
+
FROM ruby:3.1
|
21
16
|
LABEL maintainer="Jonathan Gnagy <jonathan.gnagy@gmail.com>"
|
22
17
|
|
23
18
|
ENV BULLION_PORT=9292
|
24
19
|
ENV BULLION_ENVIRONMENT=development
|
25
20
|
ENV DATABASE_URL=sqlite3:///tmp/bullion.db
|
26
21
|
|
27
|
-
RUN
|
28
|
-
&& apk --no-cache add git mariadb-client mariadb-connector-c \
|
29
|
-
runit sqlite-dev \
|
30
|
-
&& apk --no-cache add --virtual build-dependencies \
|
31
|
-
build-base mariadb-dev
|
22
|
+
RUN apt-get update && apt-get upgrade -y && apt-get -y install libsqlite3-dev sqlite3 curl libsodium-dev
|
32
23
|
|
33
24
|
RUN mkdir /app
|
34
25
|
|
@@ -47,8 +38,7 @@ RUN chmod +x /entrypoint.sh \
|
|
47
38
|
|
48
39
|
WORKDIR /app
|
49
40
|
|
50
|
-
RUN gem install bullion.gem
|
51
|
-
&& apk del build-dependencies
|
41
|
+
RUN gem install bullion.gem
|
52
42
|
|
53
43
|
USER nobody
|
54
44
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -36,7 +36,7 @@ Whether run locally or via Docker, the following environment variables configure
|
|
36
36
|
| `CA_CERT_PATH` | `$CA_DIR/tls.crt` | Public cert for Bullion. If Bullion is an intermediate CA, you'll want to include the root CA's public cert in this file as well the signed cert for Bullion. |
|
37
37
|
| `CA_DOMAINS` | `example.com` | A comma-delimited list of domains for which Bullion will sign certificate requests. Subdomains are automatically allowed. Certificates containing other domains will be rejected. |
|
38
38
|
| `CERT_VALIDITY_DURATION` | `7776000` | How long should issued certs be valid (in seconds)? Default is 90 days. |
|
39
|
-
| `DATABASE_URL` | _None_ | **(Required)** A shorthand for telling Bullion how to connect to a database. Acceptable URLs will either
|
39
|
+
| `DATABASE_URL` | _None_ | **(Required)** A shorthand for telling Bullion how to connect to a database. Acceptable URLs will either begin with `sqlite3:` or [`mysql2://`](https://github.com/brianmario/mysql2#using-active-records-database_url). |
|
40
40
|
| `DNS01_NAMESERVERS` | _None_ | A comma-delimited list of nameservers to use for resolving [DNS-01](https://letsencrypt.org/docs/challenge-types/#dns-01-challenge) challenges. Usually you'll want this to be set to your _internal_ nameservers so internal names resolve correctly. When not set, it'll use the host's DNS. |
|
41
41
|
| `LOG_LEVEL` | `warn` | Log level for Bullion. Supported levels (starting with the noisiest) are debug, info, warn, error, and fatal. |
|
42
42
|
| `BULLION_PORT` | `9292` | TCP port Bullion will listen on. |
|
data/Rakefile
CHANGED
@@ -20,7 +20,14 @@ namespace :db do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
RSpec::Core::RakeTask.new(:spec)
|
23
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
24
|
+
t.exclude_pattern = "spec/integration/**{,/*/**}/*_spec.rb"
|
25
|
+
t.rspec_opts = "--require spec_helper"
|
26
|
+
end
|
27
|
+
RSpec::Core::RakeTask.new(:integration_testing) do |t|
|
28
|
+
t.pattern = "spec/integration/**{,/*/**}/*_spec.rb"
|
29
|
+
t.rspec_opts = "--require integration_helper"
|
30
|
+
end
|
24
31
|
RuboCop::RakeTask.new(:rubocop)
|
25
32
|
YARD::Rake::YardocTask.new
|
26
33
|
|
@@ -64,7 +71,14 @@ task :prep do
|
|
64
71
|
end
|
65
72
|
|
66
73
|
task :demo do
|
67
|
-
|
74
|
+
rack_env = "test"
|
75
|
+
database_url = "sqlite3:#{File.expand_path(".")}/tmp/db/#{rack_env}.sqlite3"
|
76
|
+
system("RACK_ENV=\"#{rack_env}\" DATABASE_URL=\"#{database_url}\" bundle exec rake db:migrate")
|
77
|
+
system(
|
78
|
+
"RACK_ENV=\"#{rack_env}\" DATABASE_URL=\"#{database_url}\" " \
|
79
|
+
"LOG_LEVEL='#{ENV.fetch("LOG_LEVEL", "info")}' " \
|
80
|
+
"rackup -D -P #{File.expand_path(".")}/tmp/daemon.pid"
|
81
|
+
)
|
68
82
|
end
|
69
83
|
|
70
84
|
task :foreground_demo do
|
@@ -85,10 +99,11 @@ task :cleanup do
|
|
85
99
|
end
|
86
100
|
end
|
87
101
|
|
88
|
-
Rake::Task["
|
102
|
+
Rake::Task["integration_testing"].enhance(["cleanup"])
|
89
103
|
|
90
|
-
task
|
104
|
+
task test: %i[prep db:migrate spec demo integration_testing]
|
105
|
+
task unit: %i[prep db:migrate spec]
|
91
106
|
|
92
|
-
task
|
107
|
+
task default: %i[test rubocop yard]
|
93
108
|
|
94
109
|
task local_demo: %i[prep db:migrate foreground_demo]
|
@@ -23,29 +23,26 @@ module Bullion
|
|
23
23
|
Base64.urlsafe_encode64(digest).sub(/[\s=]*\z/, "")
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
|
26
|
+
def dns_name
|
27
|
+
"_acme-challenge.#{identifier}"
|
28
|
+
end
|
28
29
|
|
30
|
+
def dns_value
|
29
31
|
# Randomly select a nameserver to pull the TXT record
|
30
32
|
nameserver = NAMESERVERS.sample
|
31
33
|
|
32
|
-
LOGGER.debug "Looking up #{
|
33
|
-
records = records_for(
|
34
|
-
raise "Failed to find records for #{
|
34
|
+
LOGGER.debug "Looking up #{dns_name}"
|
35
|
+
records = records_for(dns_name, nameserver)
|
36
|
+
raise "Failed to find records for #{dns_name}" unless records
|
35
37
|
|
36
38
|
record = records.map(&:strings).flatten.first
|
37
|
-
LOGGER.debug "Resolved #{
|
39
|
+
LOGGER.debug "Resolved #{dns_name} to value #{record}"
|
38
40
|
record
|
39
|
-
rescue
|
40
|
-
msg = ["Resolution error for #{
|
41
|
+
rescue StandardError => e
|
42
|
+
msg = ["Resolution error '#{e.message}' for #{dns_name}"]
|
41
43
|
msg << "via #{nameserver}" if nameserver
|
42
44
|
LOGGER.info msg.join(" ")
|
43
45
|
false
|
44
|
-
rescue StandardError => e
|
45
|
-
msg = ["Error '#{e.message}' for #{name}"]
|
46
|
-
msg << "with #{nameserver}" if nameserver
|
47
|
-
LOGGER.warn msg.join(" ")
|
48
|
-
false
|
49
46
|
end
|
50
47
|
|
51
48
|
def records_for(name, nameserver = nil)
|
@@ -11,6 +11,13 @@ module Bullion
|
|
11
11
|
validates :acme_type, inclusion: { in: %w[http-01 dns-01] }
|
12
12
|
validates :status, inclusion: { in: %w[invalid pending processing valid] }
|
13
13
|
|
14
|
+
scope :dns01, -> { where(acme_type: "dns-01") }
|
15
|
+
scope :http01, -> { where(acme_type: "http-01") }
|
16
|
+
|
17
|
+
def identifier
|
18
|
+
authorization.identifier["value"]
|
19
|
+
end
|
20
|
+
|
14
21
|
def init_values
|
15
22
|
self.expires ||= Time.now + (60 * 60)
|
16
23
|
self.token ||= SecureRandom.alphanumeric(48)
|
data/lib/bullion/models/order.rb
CHANGED
data/lib/bullion/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Gnagy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|