Skip to content

Commit

Permalink
Add support for TransIP DNS Provider (home-assistant#1322)
Browse files Browse the repository at this point in the history
* Add TransIP DNS Provider

* Cleanup and fix SC errors.

* Fix SC2004.
  • Loading branch information
IceEyz authored May 23, 2020
1 parent b94bea1 commit 80da6e8
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 4 deletions.
26 changes: 26 additions & 0 deletions letsencrypt/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ netcup_api_key: ''
netcup_api_password: ''
gandi_api_key: ''
gandi_sharing_id: ''
transip_username: ''
transip_api_key: ''
```
## Example Configurations
Expand Down Expand Up @@ -200,6 +202,29 @@ dns:
cloudflare_api_key: 0123456789abcdef0123456789abcdef01234
```
### TransIP
You will need to generate an API key from the TransIP Control Panel at https://www.transip.nl/cp/account/api/.
The propagation limit will be automatically raised to 240 seconds.
Example configuration:
```yaml
email: [email protected]
domains:
- your.domain.tld
certfile: fullchain.pem
keyfile: privkey.pem
challenge: dns
dns:
provider: dns-transip
transip_username: transip-user
transip_api_key: |
-----BEGIN PRIVATE KEY-----
MII..ABCDEFGHIJKLMNOPQRSTUVWXYZ
AAAAAABCDEFGHIJKLMNOPQRSTUVWXYZ
-----END PRIVATE KEY-----
```
## Certificate files
Expand Down Expand Up @@ -227,6 +252,7 @@ dns-route53
dns-sakuracloud
dns-netcup
dns-gandi
dns-transip
```

## Support
Expand Down
2 changes: 2 additions & 0 deletions letsencrypt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FROM $BUILD_FROM
ARG CERTBOT_VERSION
ARG CERTBOT_NETCUP_VERSION
ARG CERTBOT_GANDI_VERSION
ARG CERTBOT_DNS_TRANSIP_VERSION

RUN apk add --no-cache --update \
libffi \
Expand Down Expand Up @@ -34,6 +35,7 @@ RUN apk add --no-cache --update \
certbot-dns-sakuracloud==${CERTBOT_VERSION} \
certbot-dns-netcup==${CERTBOT_NETCUP_VERSION} \
certbot-plugin-gandi==${CERTBOT_GANDI_VERSION} \
certbot-dns-transip==${CERTBOT_DNS_TRANSIP_VERSION} \
&& apk del .build-dependencies

# Copy data
Expand Down
3 changes: 2 additions & 1 deletion letsencrypt/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"args": {
"CERTBOT_VERSION": "1.2.0",
"CERTBOT_NETCUP_VERSION": "0.31.0.1",
"CERTBOT_GANDI_VERSION": "1.2.5"
"CERTBOT_GANDI_VERSION": "1.2.5",
"CERTBOT_DNS_TRANSIP_VERSION": "0.3.0"
}
}
6 changes: 4 additions & 2 deletions letsencrypt/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"keyfile": "str",
"challenge": "list(dns|http)",
"dns": {
"provider": "list(dns-cloudflare|dns-cloudxns|dns-digitalocean|dns-dnsimple|dns-dnsmadeeasy|dns-gehirn|dns-google|dns-linode|dns-luadns|dns-nsone|dns-ovh|dns-rfc2136|dns-route53|dns-sakuracloud|dns-netcup|dns-gandi)?",
"provider": "list(dns-cloudflare|dns-cloudxns|dns-digitalocean|dns-dnsimple|dns-dnsmadeeasy|dns-gehirn|dns-google|dns-linode|dns-luadns|dns-nsone|dns-ovh|dns-rfc2136|dns-route53|dns-sakuracloud|dns-netcup|dns-gandi|dns-transip)?",
"propagation_seconds": "int(60,3600)?",
"cloudflare_email": "email?",
"cloudflare_api_key": "str?",
Expand Down Expand Up @@ -66,7 +66,9 @@
"netcup_api_key": "str?",
"netcup_api_password": "str?",
"gandi_api_key": "str?",
"gandi_sharing_id": "str?"
"gandi_sharing_id": "str?",
"transip_username": "str?",
"transip_api_key": "str?"
}
},
"image": "homeassistant/{arch}-addon-letsencrypt"
Expand Down
11 changes: 10 additions & 1 deletion letsencrypt/rootfs/etc/cont-init.d/file-structure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ echo -e "dns_cloudxns_api_key = $(bashio::config 'dns.cloudxns_api_key')\n" \
"aws_secret_access_key = $(bashio::config 'dns.aws_secret_access_key')\n" \
"dns_sakuracloud_api_token = $(bashio::config 'dns.sakuracloud_api_token')\n" \
"dns_sakuracloud_api_secret = $(bashio::config 'dns.sakuracloud_api_secret')\n" \
"certbot_plugin_gandi:dns_api_key = $(bashio::config 'dns.gandi_api_key')" > /data/dnsapikey
"certbot_plugin_gandi:dns_api_key = $(bashio::config 'dns.gandi_api_key')\n" \
"certbot_dns_transip:dns_transip_username = $(bashio::config 'dns.transip_username')\n" \
"certbot_dns_transip:dns_transip_key_file = /data/transip-rsa.key" > /data/dnsapikey

chmod 600 /data/dnsapikey

## Prepare TransIP RSA key
if bashio::config.exists 'dns.transip_api_key'; then
TRANSIP_API_KEY=$(bashio::config 'dns.transip_api_key')
echo "${TRANSIP_API_KEY}" | openssl rsa -out /data/transip-rsa.key
chmod 600 /data/transip-rsa.key
fi
10 changes: 10 additions & 0 deletions letsencrypt/rootfs/etc/services.d/lets-encrypt/run
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ elif bashio::config.exists 'dns.google_creds'; then
elif bashio::config.exists 'dns.netcup_customer_id' && bashio::config.exists 'dns.netcup_api_key' && bashio::config.exists 'dns.netcup_api_password'; then
PROVIDER_ARGUMENTS+=("--authenticator" "certbot-dns-netcup:dns-netcup" "--certbot-dns-netcup:dns-netcup-credentials" /data/dnsapikey "--certbot-dns-netcup:dns-netcup-propagation-seconds" "${PROPAGATION_SECONDS}")

#TransIP
elif [ "${CHALLENGE}" == "dns" ] && [ "${DNS_PROVIDER}" == "dns-transip" ]; then
bashio::config.require.username 'dns.transip_username'
bashio::config.require 'dns.transip_api_key'
if (( PROPAGATION_SECONDS < 240 )); then
bashio::log.info "Increasing DNS propagation limit for TransIP to at least 240 seconds."
PROPAGATION_SECONDS=240
fi
PROVIDER_ARGUMENTS+=("--authenticator" "certbot-${DNS_PROVIDER}:${DNS_PROVIDER}" "--certbot-${DNS_PROVIDER}:${DNS_PROVIDER}-credentials" /data/dnsapikey "--certbot-${DNS_PROVIDER}:${DNS_PROVIDER}-propagation-seconds" "${PROPAGATION_SECONDS}")

# CloudFlare
elif [ "${DNS_PROVIDER}" == "dns-cloudflare" ]; then
if bashio::config.exists 'dns.cloudflare_api_token'; then
Expand Down

0 comments on commit 80da6e8

Please sign in to comment.