Skip to content

Commit 473121e

Browse files
committed
Initial import.
0 parents  commit 473121e

18 files changed

+1846
-0
lines changed

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Standard Python stuff
2+
*.pyc
3+
/build/
4+
/dist/
5+
/venv/
6+
/*.egg-info/
7+
8+
# testing
9+
/.tox/
10+
11+
# make sure users don't commit private key material
12+
*.json
13+
*.pem
14+
*.der
15+
# ... as well as external IO plugin script
16+
/external_pem.sh
17+
18+
# `sshfs user@host:$ROOT public_html/` and `--default_root=public_html`
19+
/public_html/

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1. Read MANIFESTO from README.
2+
3+
2. https://google.github.io/styleguide/pyguide.html and
4+
https://www.python.org/dev/peps/pep-0008/

LICENSE.txt

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include README.md
2+
include CONTRIBUTING.md
3+
include LICENSE.txt

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# simp_le
2+
3+
Simple [Let's Encrypt](https://letsencrypt.org) client.
4+
5+
```shell
6+
simp_le -f fullchain.pem -f key.pem \
7+
-d example.com -d www.example.com --default_root /var/www/html \
8+
-d other.com:/var/www/other_html
9+
```
10+
11+
For more info see `simp_le --help`.
12+
13+
## Manifest
14+
15+
1. [UNIX philosophy](https://en.wikipedia.org/wiki/Unix_philosophy):
16+
Do one thing and do it well!
17+
18+
2. `simp_le --valid_min ${seconds?} -f cert.pem` implies that
19+
`cert.pem` is valid for at at least `valid_min`. Register new ACME
20+
CA account if necessary. Issue new certificate if no previous
21+
key/certificate/chain found. Renew only if necessary.
22+
23+
3. (Sophisticated) "manager" for
24+
`${webroot?}/.well-known/acme-challenges` only. No challenges other
25+
than `http-01`. Existing web-server must be be running already.
26+
27+
4. No magical webserver auto-configuration.
28+
29+
5. Owner of `${webroot?}/.well-known/acme-challenges` must be able to
30+
run the script, without privilege escalation (`sudo`, `root`,
31+
etc.).
32+
33+
6. `crontab` friendly: fully automatable - no prompts, etc.
34+
35+
7. No configuration files. CLI flags as the sole interface! Users
36+
should write their own wrapper scripts or use shell aliases if
37+
necessary.
38+
39+
8. Support multiple domains with multiple roots. Always create single
40+
SAN certificate per `simp_le` run.
41+
42+
9. Flexible storage capabilities. Built-in `simp_le -f fullchain.pem
43+
-f privkey.pem`, `simp_le -f chain.pem -f cert.pem -d privkey.pem`,
44+
etc. Extensions through `simp_le -f external_pem.sh`.
45+
46+
10. Do not allow specifying output file paths. Users should symlink if
47+
necessary!
48+
49+
11. No need to allow arbitrary command when renewal has happened: just
50+
compare cert before and after (`sha256sum`, `mtime`, etc.).
51+
52+
12. `--server` (support multiple CAs).
53+
54+
## Installation
55+
56+
```shell
57+
sudo ./bootstrap.sh
58+
./venv.sh
59+
. venv/bin/activate
60+
```
61+
62+
## Examples
63+
64+
Have a look into `./examples/`.

bootstrap.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh -xe
2+
3+
bootstrap_deb () {
4+
apt-get update
5+
6+
install () {
7+
apt-get install -y --no-install-recommends "$@"
8+
}
9+
10+
install \
11+
ca-certificates \
12+
gcc \
13+
libssl-dev \
14+
libffi-dev \
15+
python \
16+
python-dev \
17+
python-virtualenv
18+
19+
# virtualenv binary can be found in different packages depending on
20+
# distro version
21+
install virtualenv || true
22+
}
23+
24+
bootstrap_rpm () {
25+
installer=$(command -v dnf || command -v yum)
26+
"${installer?}" install -y \
27+
ca-certificates \
28+
gcc \
29+
libffi-devel \
30+
openssl-devel \
31+
python \
32+
python-devel \
33+
python-virtualenv
34+
}
35+
36+
if [ -f /etc/debian_version ]
37+
then
38+
bootstrap_deb
39+
elif [ -f /etc/redhat-release ]
40+
then
41+
bootstrap_rpm
42+
fi

examples/external_pem.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
# Dummy example external script that loads/saves key/cert/chain to
3+
# /tmp/foo; `simp_le -f external_pem.sh`.
4+
5+
load () {
6+
cat /tmp/foo
7+
}
8+
9+
save () {
10+
cat - > /tmp/foo
11+
}
12+
13+
persisted () {
14+
echo key cert chain
15+
}
16+
17+
case $1 in
18+
save)
19+
save
20+
;;
21+
load)
22+
load
23+
;;
24+
persisted)
25+
persisted
26+
;;
27+
esac

pyi/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build/
2+
/dist/

pyi/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
all:
2+
pyinstaller simp_le.spec
3+
4+
clean:
5+
rm -rf build dist

pyi/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[PyInstaller](http://www.pyinstaller.org/) setup for simp_le.
2+
3+
```shell
4+
pip install -r requirements.txt
5+
make clean all
6+
./dist/simp_le --test
7+
./dist/simp_le --help
8+
```

0 commit comments

Comments
 (0)