summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Peukert2023-07-09 11:25:12 +0200
committerDaniel Peukert2023-07-09 11:25:12 +0200
commit51fca7757143bec0f00932270a24137c3ee93a77 (patch)
treeaeb29e5e5060f060679776731148ac95656a9662
parent8555695b2ebebe627ae7c4f6e6acf6515c6de1c3 (diff)
downloadaur-51fca7757143bec0f00932270a24137c3ee93a77.tar.gz
Use different upstream for certbot-dns-vultr
-rw-r--r--.SRCINFO27
-rw-r--r--LICENSE21
-rw-r--r--PKGBUILD38
-rw-r--r--certbot-dns-vultr.install18
-rw-r--r--vultr-hook.py103
5 files changed, 50 insertions, 157 deletions
diff --git a/.SRCINFO b/.SRCINFO
index efa3d244b6dd..ff278d97398c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,21 +1,20 @@
pkgbase = certbot-dns-vultr
- pkgdesc = Cerbot hooks for Vultr DNS
- pkgver = 20190506
- pkgrel = 5
- url = https://aur.archlinux.org/packages/certbot-dns-vultr
+ pkgdesc = Authenticator plugin for Certbot to configure Vultr to respond to ACME dns-01 challenges to obtain HTTPS certificates
+ pkgver = 0.2.0
+ pkgrel = 1
+ epoch = 1
+ url = https://github.com/bsorahan/certbot-dns-vultr
install = certbot-dns-vultr.install
arch = any
license = MIT
+ makedepends = python-setuptools
depends = certbot
- depends = python
- depends = python-certifi
- depends = python-chardet
- depends = python-idna
- depends = python-requests
- depends = python-urllib3
- source = vultr-hook.py
- source = LICENSE
- sha512sums = bed005e71fee528dc8a2f96d9012f73a65571b5ce137eb38a361662076c6d50c6ed2d6fb65fead411f6cfd6203c98f93687e422fe78ff5fe410df040d8028d72
- sha512sums = 3be99701a9cd1575f3d6a2e57769f1e507f75af9b09e23882a663415db8c569d10e2f4a7dd321df51571cc23c87e331b347f09bc8cf9fea86a09c191b7b54ee7
+ depends = dns-lexicon
+ depends = python>=3.4.0
+ depends = python-acme
+ depends = python-mock
+ depends = python-zope-interface
+ source = certbot-dns-vultr-0.2.0.tar.gz::https://github.com/bsorahan/certbot-dns-vultr/archive/v0.2.0.tar.gz
+ sha512sums = 5e19a42238f55b543218f524f65edba593a610bec3dec45b3764c180d6bcd781f37d6106089e415a97cde3894db8aa59523bf8152dee377c110800606c83b797
pkgname = certbot-dns-vultr
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 410f1b5c0e53..000000000000
--- a/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2019 Terry Kerr
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/PKGBUILD b/PKGBUILD
index 63f5876541e1..fcba77e127fe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,23 +1,33 @@
# Maintainer: Daniel Peukert <daniel@peukert.cc>
pkgname='certbot-dns-vultr'
-pkgver='20190506'
-_commit='5acb7e2b6d66f21decb3a37ed0d7ec808eefe844'
-pkgrel='5'
-pkgdesc='Cerbot hooks for Vultr DNS'
+pkgver='0.2.0'
+pkgrel='1'
+epoch='1'
+pkgdesc='Authenticator plugin for Certbot to configure Vultr to respond to ACME dns-01 challenges to obtain HTTPS certificates'
arch=('any')
-url="https://aur.archlinux.org/packages/$pkgname"
+url="https://github.com/bsorahan/$pkgname"
license=('MIT')
-depends=('certbot' 'python' 'python-certifi' 'python-chardet' 'python-idna' 'python-requests' 'python-urllib3')
+depends=('certbot' 'dns-lexicon' 'python>=3.4.0' 'python-acme' 'python-mock' 'python-zope-interface')
+makedepends=('python-setuptools')
install="$pkgname.install"
-source=(
- 'vultr-hook.py'
- 'LICENSE'
-)
-sha512sums=('bed005e71fee528dc8a2f96d9012f73a65571b5ce137eb38a361662076c6d50c6ed2d6fb65fead411f6cfd6203c98f93687e422fe78ff5fe410df040d8028d72'
- '3be99701a9cd1575f3d6a2e57769f1e507f75af9b09e23882a663415db8c569d10e2f4a7dd321df51571cc23c87e331b347f09bc8cf9fea86a09c191b7b54ee7')
+source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
+sha512sums=('5e19a42238f55b543218f524f65edba593a610bec3dec45b3764c180d6bcd781f37d6106089e415a97cde3894db8aa59523bf8152dee377c110800606c83b797')
+
+_sourcedirectory="$pkgname-$pkgver"
+
+build() {
+ cd "$srcdir/$_sourcedirectory/"
+ python setup.py build
+}
+
+# Tests currently don't pass
+# check() {
+# cd "$srcdir/$_sourcedirectory/"
+# python -m unittest discover --verbose
+# }
package() {
- cd "$srcdir/"
- install -Dm755 'vultr-hook.py' "$pkgdir/usr/bin/$pkgname"
+ cd "$srcdir/$_sourcedirectory/"
+ python setup.py install --root="$pkgdir/" --optimize=1 --skip-build
install -Dm644 'LICENSE' "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
diff --git a/certbot-dns-vultr.install b/certbot-dns-vultr.install
index 267f8fe55a0d..206c9e4d1b83 100644
--- a/certbot-dns-vultr.install
+++ b/certbot-dns-vultr.install
@@ -1,11 +1,19 @@
post_install() {
- echo '==> To use this package, set VULTR_API_KEY and use the following certbot options:'
- echo '==> --manual'
- echo '==> --manual-auth-hook certbot-dns-vultr'
- echo '==> --manual-cleanup-hook certbot-dns-vultr'
+ echo '==> To use this package, create a credential file in this format:'
+ echo '==> dns_vultr_token = aabbccddeeff112233445566778899'
+ echo '==> Once that is done, use the following certbot options:'
+ echo '==> --authenticator dns-vultr'
+ echo '==> --dns-vultr-credentials /path/to/credential/file.ini'
echo '==> --preferred-challenges dns-01'
}
+post_upgrade() {
+ if [[ "$2" =~ ^20190506-[0-9]+$ ]]; then
+ echo '==> WARNING: THIS PACKAGE NOW USES A CREDENTIAL FILE'
+ post_install
+ fi
+}
+
post_remove() {
- echo "==> Don't forget to remove the hook from your certbot command"
+ echo "==> Don't forget to remove the package from your certbot command"
}
diff --git a/vultr-hook.py b/vultr-hook.py
deleted file mode 100644
index 41a110905668..000000000000
--- a/vultr-hook.py
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/env python3
-import os
-import requests
-import sys
-from typing import Iterator
-
-DOMAIN = os.environ.get("CERTBOT_DOMAIN")
-TOKEN = os.environ.get("CERTBOT_VALIDATION")
-AUTH_OUTPUT = os.environ.get("CERTBOT_AUTH_OUTPUT")
-API_KEY = os.environ.get("VULTR_API_KEY")
-
-API_EP = "https://api.vultr.com/v1/"
-DOMAIN_LIST_EP = "{}{}".format(API_EP, "dns/list")
-RECORD_LIST_EP = "{}{}".format(API_EP, "dns/records")
-RECORD_ADD_EP = "{}{}".format(API_EP, "dns/create_record")
-RECORD_DEL_EP = "{}{}".format(API_EP, "dns/delete_record")
-SESSION = requests.Session()
-SESSION.headers.update({"API-Key": API_KEY})
-
-
-def main():
- if None in [DOMAIN, TOKEN, API_KEY]:
- sys.stderr.write("CERTBOT_DOMAIN, CERTBOT_VALIDATION "
- " and VULTR_API_KEY must all be defined\n")
- sys.exit(1)
-
- if AUTH_OUTPUT is None:
- pre_hook()
- else:
- post_hook()
-
-
-def subdomains(domain: str) -> Iterator[str]:
- """Generator of all subdomains within the domain,
- given from the longest to the shortest.
-
- Ex: "one.two.three" ->
- "one.two.three"
- "two.three"
- "three"
- """
- for i in range(domain.count(".") + 1):
- yield domain.split(".", i)[-1]
-
-
-def pre_hook():
- """Add a new TXT record."""
-
- # extract all domains managed by the Vultr API
- managed_domains = SESSION.get(DOMAIN_LIST_EP).json()
- managed_domains = [o["domain"] for o in managed_domains]
- managed_domain = None
-
- # find the subdomain of DOMAIN managed by Vultr
- for subdomain in subdomains(DOMAIN):
- if subdomain in managed_domains:
- managed_domain = subdomain
- break
- if managed_domain is None:
- raise ValueError(
- "no suitable managed domain found for {}".format(DOMAIN))
-
- # echo managed domain for post hook to pick up
- sys.stdout.write(managed_domain)
-
- # get the subdomain part relative to the managed domain
- subdomain = DOMAIN.rpartition(managed_domain)[0][:-1]
-
- # add the record
- if subdomain == "":
- name = "_acme-challenge"
- else:
- name = "_acme-challenge.{}".format(subdomain)
- SESSION.post(
- RECORD_ADD_EP,
- data={
- "domain": managed_domain,
- "name": name,
- "type": "TXT",
- "data": '"{}"'.format(TOKEN),
- }).raise_for_status()
-
-
-def post_hook():
- """Remove the added TXT record."""
-
- managed_domain = AUTH_OUTPUT
- records = SESSION.get(
- RECORD_LIST_EP, params={
- "domain": managed_domain,
- }).json()
- txt_records = [r for r in records if r["type"] == "TXT"]
- record = [r for r in txt_records if r["data"] == '"{}"'.format(TOKEN)][0]
- SESSION.post(
- RECORD_DEL_EP,
- data={
- "domain": managed_domain,
- "RECORDID": record["RECORDID"]
- }).raise_for_status()
-
-
-if __name__ == "__main__":
- main()