Skip to content

Commit

Permalink
Merge bbf2de4 into 730a0ae
Browse files Browse the repository at this point in the history
  • Loading branch information
fetzerch committed Aug 3, 2022
2 parents 730a0ae + bbf2de4 commit 626fe06
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 191 deletions.
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: check
on:
push:
pull_request:

jobs:
test:
name: Test with Python ${{ matrix.py }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py:
- "3.10"
- "3.9"
- "3.8"
- "3.7"
steps:
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- uses: actions/checkout@v2
- name: Install tox-gh
run: python -m pip install tox-gh
- name: Setup test suite
run: tox
- if: ${{ matrix.py == '3.10' }}
name: Generate coverage data
run: .tox/py310/bin/coverage lcov -o coverage/lcov.info
- if: ${{ matrix.py == '3.10' }}
name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Setup python to build package
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install build
run: python -m pip install build
- uses: actions/checkout@v2
- name: Build sdist and wheel
run: python -m build -s -w . -o dist
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
user: ${{ secrets.pypi_user }}
password: ${{ secrets.pypi_password }}
39 changes: 0 additions & 39 deletions .gitlab-ci.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

97 changes: 97 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[![Build Status](https://github.com/fetzerch/kasserver/actions/workflows/check.yml/badge.svg)](https://github.com/fetzerch/kasserver/actions/workflows/check.yml)
[![Coverage Status](https://coveralls.io/repos/github/fetzerch/kasserver/badge.svg)](https://coveralls.io/github/fetzerch/kasserver)
[![PyPI Version](https://img.shields.io/pypi/v/kasserver.svg)](https://pypi.org/project/kasserver)

# kasserver - Manage domains hosted on All-Inkl.com through the KAS server API

This project consists of the Python library *kasserver* and a few command line
utilities to manage domains of the German webhoster [All-Inkl.com] through
their [KAS server API].

At the moment the main focus is managing DNS record as this allows to automate
the creation of \[Let's Encrypt\] (wildcard) certificates with the
[ACME DNS-01 challenge].

## Installation

*kasserver* (and its dependencies) can be installed from PyPI with:
`pip3 install kasserver`

## Authentication

Both library and command line utilities require access to the KAS credentials.
Username and password are read from the `KASSERVER_USER` and
`KASSERVER_PASSWORD` environment variables or from the `~/.netrc` file:

```sh
machine kasapi.kasserver.com
login USERNAME
password PASSWORD
```

The file must be accessible only by your user account: `chmod 600 ~/.netrc`.

## Scripts

### `kasserver-dns`

A generic program to manage DNS records.

DNS records can be listed with:

```sh
$ kasserver-dns list example.com
ID C Zone Name Type Data Aux
1 Y example.com A X.X.X.X 0
0 N example.com NS ns5.kasserver.com. 0
0 N example.com NS ns6.kasserver.com. 0
0 N example.com www CNAME example.com 0
```

A new DNS record is added with:

```sh
kasserver-dns add test.example.com CNAME example.com
```

An existing DNS record is removed with:

```sh
kasserver-dns remove test.example.com CNAME
```

### `kasserver-dns-*`

The following programs are designed to be used together with ACME clients to
automate DNS record creation/removal as it is required by a Let's Encryt
[ACME DNS-01 challenge] for automatic certificate renewal.

#### `kasserver-dns-certbot`

This program is designed to be used with [Certbot]:

```sh
certbot certonly -d foo.exmaple.com --preferred-challenges dns \
--manual --manual-auth-hook kasserver-dns-certbot \
--manual-cleanup-hook kasserver-dns-certbot \
-m invalid@example.com
```

#### `kasserver-dns-lego`

This program is designed to be used with [lego]:

```sh
EXEC_PATH=kasserver-dns-lego lego --dns exec \
--domains foo.example.com --email invalid@example.com run
```

## License

This projected is licensed under the terms of the MIT license.

[acme dns-01 challenge]: https://www.eff.org/de/deeplinks/2018/02/technical-deep-dive-securing-automation-acme-dns-challenge-validation
[all-inkl.com]: https://all-inkl.com/
[certbot]: https://certbot.eff.org
[kas server api]: https://kasapi.kasserver.com/
[lego]: https://github.com/xenolf/lego
117 changes: 0 additions & 117 deletions README.rst

This file was deleted.

2 changes: 1 addition & 1 deletion kasserver/kasserver_dns_certbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def cli(fqdn, value):
record = kas.get_dns_record(fqdn, "TXT")
if record:
LOGGER.info(
"Removing existing DNS TXT record for domain %s " "with value %s",
"Removing existing DNS TXT record for domain %s with value %s",
fqdn,
record["data"],
)
Expand Down
6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

[metadata]
name = kasserver
summary = Manage domains hosted on All-Inkl.com through the KAS server API
description-file = README.md
description-content-type = text/markdown
url = https://github.com/fetzerch/kasserver
author = Christian Fetzer
author-email = fetzer.ch@gmail.com
description-file = README.rst
url = https://github.com/fetzerch/kasserver
license = MIT
classifier =
Development Status :: 4 - Beta
Expand Down
7 changes: 5 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
# SOFTWARE.

[tox]
envlist = py36,py37,py38,py39
envlist = py37,py38,py39,py310

[testenv]
deps = pytest-mock
pytest-cov
pytest-black
pytest-pylint
commands = pytest {posargs} --black --pylint \
--cov-config=.coveragerc --cov=kasserver --cov-branch \
--cov=kasserver --cov-branch \
--cov-report=term-missing --cov-fail-under=100

[run]
omit = .tox/*

0 comments on commit 626fe06

Please sign in to comment.