• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An effective ACME v2 client: Manage keys on the cloud (e.g. S3)

Acmesmith: A simple, effective ACME v2 client to use with many servers and a cloud

ci Buy Me a Coffee at ko-fi.com

Acmesmith is an ACME (Automatic Certificate Management Environment) client that works perfect on environment with multiple servers. This client saves certificate and keys on cloud services (e.g. AWS S3) securely, then allow to deploy issued certificates onto your servers smoothly. This works well on Let's encrypt.

This tool is written in Ruby, but Acmesmith saves certificates in simple scheme, so you can fetch certificate by your own simple scripts.

Features

  • ACME v2 client designed to work on multiple servers
  • ACME registration, domain authorization, certificate requests
  • Storing keys in several ways
  • Challenge response
  • Many cloud services support
    • AWS S3 storage and Route 53 dns-01 responder support out-of-the-box
    • 3rd party plugins available for OpenStack designate, Google Cloud DNS, simple http-01, and Google Cloud Storage. See Plugins below

Installation

Add this line to your application's Gemfile:

gem 'acmesmith'

And then execute:

$ bundle

Or install it yourself as:

$ gem install acmesmith

Docker

docker run -v /path/to/acmesmith.yml:/app/acmesmith.yml:ro sorah/acmesmith:latest

Dockerfile is available. Default confguration file is at /app/acmesmith.yml.

Pre-built docker images are provided at https://hub.docker.com/r/sorah/acmesmith for your convenience Built with GitHub Actions & sorah-rbpkg/dockerfiles.

Usage

$ acmesmith new-account CONTACT              # Create account key (contact e.g. mailto:[email protected])
$ acmesmith order COMMON_NAME [SAN]     # request certificate for CN +COMMON_NAME+ with SANs +SAN+
$ acmesmith add-san COMMON_NAME [SAN]     # re-request existing certificate of CN with additional SAN(s)
$ acmesmith list [COMMON_NAME]                          # list certificates or its versions
$ acmesmith current COMMON_NAME                         # show current version for certificate
$ acmesmith show-certificate COMMON_NAME                # show certificate
$ acmesmith show-private-key COMMON_NAME                # show private key
$ acmesmith save-certificate COMMON_NAME --output=PATH  # Save certificate to a file
$ acmesmith save-private-key COMMON_NAME --output=PATH  # Save private key to a file
$ acmesmith save-pkcs12      COMMON_NAME --output=PATH  # Save certificate and private key to a PKCS12 file
$ acmesmith autorenew [-d DAYS] # Renew certificates which being expired soon
# Save (or update) certificate files and key in a one command
$ acmesmith save COMMON_NAME \
      --version-file=/tmp/cert.txt   # Path to save a certificate version for following run 
      --key-file=/tmp/cert.key       # Path to save a key
      --fullchain-file=/tmp/cert.pem # Path to save a certficiate and its chain (concatenated)

See acmesmith help [subcommand] for more help.

Configuration

See config.sample.yml to start. Default configuration file is ./acmesmith.yml.

directory: https://acme-v02.api.letsencrypt.org/directory # production

storage:
  # configure where to store keys and certificates; described later
  type: s3
  region: 'us-east-1'
  bucket: 'my-acmesmith-bucket'
  prefix: 'prod/'

challenge_responders:
  # configure how to respond ACME challenges; described later
  - route53: {}

Storage

Storage provider stores issued certificates, private keys and ACME account keys.

Challenge Responders

Challenge responders responds to ACME challenges to prove domain ownership to CA.

Common options

challenge_responders:
  ## Multiple responders are accepted.
  ## The first responder that supports a challenge and applicable for given domain name will be used.
  - {RESPONDER_TYPE}:
      {RESPONDER_OPTIONS}

    ### Filter (optional)
    filter:
      subject_name_exact:
        - my-app.example.com
      subject_name_suffix:
        - .example.org
      subject_name_regexp:
        - '\Aapp\d+.example.org\z'

  - {RESPONDER_TYPE}:
      {RESPONDER_OPTIONS}
    ...

Post Issuing Hooks

Post issuing hooks are configurable actions that are executed when a new certificate has been succesfully issued. The hooks are sequentially executed in the same order as they are configured, and they are configurable per certificate's common-name.

  • Shell script: shell
  • Amazon Certificate Manager (ACM): acm

Chain preference

If you want to prefer an alternative chain given by CA (RFC8555 Section 7.4.2.), use the following configuration. Preference may be delcared with common name.

When chain preferences are configured for the common name of an ordered certificate, Acmesmith will retrieve all available alternative chains and evaluate rules in an configured order. The first chain matched to a rule will be used and saved to a storage.

During rule evaluation, a root issuer name and key id are taken from the last available intermediate (Issuer and AKI) provided in a chain, when a chain doesn't have a root certificate (trust anchor).

chain_preferences:
  - root_issuer_name: "ISRG Root X1"
    ### Optionally, you may specify CA SKI/AKI:
    # root_issuer_key_id: "79:b4:59:e6:7b:b6:e5:e4:01:73:80:08:88:c8:1a:58:f6:e9:9b:6e"

    ### Filter by common name (optional)
    filter:
      exact:
        - my-app.example.com
      suffix:
        - .example.org
      regexp:
        - '\Aapp\d+.example.org\z'

Vendor dependent notes

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sorah/acmesmith.

Running tests

unit test:

bundle exec rspec

integration test using letsencrypt/pebble. needs Docker:

ACMESMITH_CI_START_PEBBLE=1 CI=1 bundle exec -t integration_pebble

Writing plugins

Publish as a gem (RubyGems). Files will be loaded automatically from lib/acmesmith/{plugin_type}/{name}.rb.

e.g.

  • storage: lib/acmesmith/storages/perfect_storage.rb & Acmesmith::Storages::PerfectStorage
  • challenge_responder: lib/acmesmith/challenge_responders/perfect_authority.rb & Acmesmith::Storages::PerfectAuthority
  • post_issuing_hook: lib/acmesmith/challenge_responders/nice_deploy.rb & Acmesmith::Storages::NiceDeploy

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

License

The gem is available as open source under the terms of the MIT License.

More Repositories

1

envchain

Environment variables meet macOS Keychain and gnome-keyring <3
C
1,116
star
2

mamiya

Faster deploy tool using tarballs and serf
Ruby
489
star
3

subsystemctl

Utility to run systemd in WSL2 with a Linux namespace
Rust
323
star
4

clarion

WebAuthn (U2F) helper for CLI operations (e.g. SSH Log in)
Ruby
79
star
5

itamae-secrets

Encrypted Data Bag for Itamae
Ruby
74
star
6

nginx_omniauth_adapter

Use omniauth for nginx auth_request
Ruby
68
star
7

niconico

wrapper of Mechanize, optimized for nicovideo.
Ruby
57
star
8

revision_plate

Rack application and middleware that serves endpoint returns application's REVISION.
Ruby
45
star
9

hocho

Hocho: Run Itamae easily with host inventory
Ruby
36
star
10

villein

Control serf agents from Ruby
Ruby
32
star
11

unite-ghq

Vim Script
31
star
12

days

Simple blog system built up with Sinatra
Ruby
30
star
13

config

config
Ruby
28
star
14

codily

Codificate your Fastly configuration in Ruby DSL
Ruby
27
star
15

infra_operator

what replaces specinfra (it's a goal...)
Ruby
26
star
16

etcvault

proxy for etcd, adding transparent encryption
Go
23
star
17

gentoo-build

shell scripts that builds systemd based gentoo box for x86_64 platform
Shell
23
star
18

himari

OIDC IdP for Small Team through Omniauth
Ruby
20
star
19

etcenv

Dump etcd keys into dotenv file or docker env file
Ruby
18
star
20

himeko

AWS IAM access key self service & management console federated login based on IAM user
Ruby
16
star
21

ec2nm

A DNS server serves your AWS EC2 instances' IP addresses by Name tag
Go
14
star
22

s3_proxy

simple rack app, proxies to Amazon S3
Ruby
11
star
23

needroleshere

Yet Another AWS IAM Roles Anywhere helper
Rust
11
star
24

jockey

alternative for https://github.com/play/play
JavaScript
10
star
25

corpshort

internal shortlink service
Ruby
10
star
26

hubot-zabbix

CoffeeScript
10
star
27

udon_tairiku

Clone of ra-men tairiku, designed for iPhone. UNMAINTAINED.
Objective-C
9
star
28

presen.vim

presentation software for Vim. Use markdown for presentation-file.
Vim Script
9
star
29

packer-builder-amazon-scratch

Go
9
star
30

skype-irc-bridge

Python
8
star
31

lambda-dns-axfr

Lambda function to perform DNS zone transfer to Route 53 Hosted Zone
Python
7
star
32

akane

your timeline logger.
Ruby
7
star
33

etcweb

Ruby
7
star
34

tagtodo

touch NFC tag to launch url. for Android device comes with NFC.
Scala
7
star
35

sorah-overlay

sorah's gentoo overlay
Shell
7
star
36

arch.sorah.jp

Arch Linux PKGBUILDs
Shell
6
star
37

tinatra

Ruby powered DSL, which designed for making twitter bots.
Ruby
6
star
38

lingr_for_android.js

Lingr for Android
JavaScript
6
star
39

cdd-vim

Very useful zsh script `cdd` for vim. zsh version: http://svn.coderepos.org/share/lang/zsh/cdd/cdd
6
star
40

binpkgbot

Robot to build gentoo binpkg cleanly, continuously, automatically, with a support of flag variant.
Ruby
6
star
41

listenize

可聴化 (kachôka, make listenable to <something>)
JavaScript
5
star
42

jenkinsfile-slack

Groovy
5
star
43

termtter-doc

Termtter document complete project
5
star
44

sorah-rec-utils

Collection of junk scripts for TV recorder.
Ruby
4
star
45

sandbox

Ruby
4
star
46

puma-jungle

Yet Another puma-jungle init.d script
Shell
4
star
47

prof

Profile of sorah.
4
star
48

snmp2mkr

Let monitor your SNMP devices with mackerel.io
Ruby
4
star
49

heroku-netbox

Python
4
star
50

sorah.jp

HTML
4
star
51

rubykaigi2017-nw

Ruby
4
star
52

apigatewayv2_rack

Rack app on AWS Lambda via API Gateway V2, function URL, and ALB
Ruby
4
star
53

ruboty-fastly

Ruby
3
star
54

vault2kube

manage Vault lease on Kubernetes secrets and keep it fresh
Rust
3
star
55

ruboty-irc

Ruby
3
star
56

aws4_signer

Simple signer module implements AWS4 signature
Ruby
3
star
57

ruby-old

This is not official mirror.
Ruby
3
star
58

s3-collect

File uploader direct to S3 from browser for collecting large files | Form URL with lifetime | built on CDK + API Gateway V2 & with aws-sdk-js and React
TypeScript
3
star
59

unite-bundler

Vim Script
3
star
60

sorah-topcoder

sora_h's answer code for topcoder
C++
3
star
61

infra-public

Public portion of sorah/infra
Ruby
3
star
62

h2

Ruby
3
star
63

coliseum

Ruby
3
star
64

cnw

Common codificated files for conference Wi-Fi networks
Ruby
3
star
65

movapic_uploader

Easy to upload picture to http://movapic.com/ in Android.
Java
3
star
66

bmwifiInfo

Show battery status, signal level, carrer name, status and connectivity type of B-mobile wifi (MF30, Japan Communications Inc.)
Objective-C
3
star
67

str_dn_2030

Control your STR-DN2030.
Ruby
3
star
68

nicoloid

Download video from nicovideo and convert to mp3
Ruby
3
star
69

onsg7

Online.sg #7 "Sinatra"
Ruby
3
star
70

ruby-tapper

Easy to switch rubies
2
star
71

bmwifiNotificatorForiOS

bmwifiNotificatorForiOS / Check status of b-mobile wifi (bm-mf30) for iOS
Objective-C
2
star
72

ruboty-imascg

Ruby
2
star
73

eorzea_weather

Ruby
2
star
74

xlat

Ruby
2
star
75

slampter

Ruby
2
star
76

ruboty-monday_is_coming

Ruby
2
star
77

yakiudon

Simple Diary Tool written in Sinatra+Ruby
Ruby
2
star
78

akane-bigquery

BigQuery storage plugin for akane.gem
Ruby
2
star
79

aandg_rec

Ruby
2
star
80

bmwifiNotificator

Bm-wifi notificator for osx/ Check status of b-mobile wifi (bm-mf30)
Objective-C
2
star
81

wifidiag

Quick Wi-Fi diagnostics page for clients, to support network ops
Ruby
2
star
82

logmetro

Go
2
star
83

mayu

locate employees in an office by Wi-Fi MAC address and WLC association data
Ruby
2
star
84

itamae-plugin-resource-portage

Itamae/MItamae resources for Portage (Gentoo Linux)
Ruby
2
star
85

sorah-codeforces

sora_h's answers for codeforces.com
Ruby
2
star
86

yubisashi

English <=> Japanese card application on web, idea from https://github.com/noplans/rk2011yubisashi
Ruby
2
star
87

easy-doc

Write a document easily
Ruby
2
star
88

one_line_bbs

One line bbs
Ruby
2
star
89

sorah.github.com

sorah.github.com
1
star
90

yakiudon-vim

post diary into your yakiudon diary system from __Vim__.
Vim Script
1
star
91

hocho-ec2

hocho host inventory provider for Amazon EC2
Ruby
1
star
92

trw

"Have a nice day" in English
1
star
93

whocares

Library for whocares chat
Ruby
1
star
94

spec_marker

RSpec formatter useful for profiling
Ruby
1
star
95

docker-rbenv

Shell
1
star
96

mobicoder

Convert source codes to single .mobi file for reading on kindle
Ruby
1
star
97

haruharu

なぞのゆれりんぐstreaming受信機
Ruby
1
star
98

mygc

MyGC - own your risk.
C
1
star
99

ako

Kakeibo, for me.
Ruby
1
star
100

anti_offensive_string

Respond error for requests include some offensive string, that may crash browsers
Ruby
1
star