Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
* update links to this project on GitHub to current namespace (`1and1` => `ionos-cloud`)
* dimclient: reference public OBS and PyPI
* ndcli: reference public OBS and PyPI
* fix according to markdown linting complaints
* .gitignore: add pyproject.toml build dirs
  • Loading branch information
zeromind authored and miesi-ionos committed Jan 10, 2025
1 parent c775fa9 commit bcafc51
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 116 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ dim-testsuite/out
dim-testsuite/log
dim-testsuite/virtual_env
__pycache__
dim-testsuite/dim.cfg
dim-testsuite/dim.cfg
*/*.egg-info
dim/dist
dimclient/dist
ndcli/dist
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Contributing to DIM
------------------------
# Contributing to DIM

Thank you for you interest to contribute to the DIM project. This document
will explain some of the things you need to keep in mind when contributing to
ease the workflow of this.

## Filing an Issue or Bug

When filing an issue or bug report, make the title of the issue a very short
summary (e.g. "Allow setting IPblock status"). In the
content of the issue, be as detailed as possible. Supply at least the following
Expand All @@ -23,6 +24,7 @@ Code contributions are sent as a pull request on GitHub. By submitting a
Pull Request you agree to your code becoming MIT licensed.

## Pull Request Guidelines

A pull request, at the least, should have:

* A clear and concise title (not e.g. 'Issue #1234')
Expand All @@ -37,4 +39,4 @@ And must:
* have one or more testcases in dim-testsuite/t

Information on testsuite can be found in the repository at
[/dim-testsuite/README.md](https://github.com/1and1/dim/blob/master/dim-testsuite/README.md)
[/dim-testsuite/README.md](https://github.com/ionos-cloud/dim/blob/master/dim-testsuite/README.md)
68 changes: 42 additions & 26 deletions VM-SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

The following steps assume that you have a minimal EL8 installed.

### Disable SELINUX
## Disable SELINUX

```
# setenforce 0
# echo -e "SELINUX=disabled\nSELINUXTYPE=targeted" >/etc/sysconfig/selinux
# systemctl stop firewalld
# systemctl disable firewalld
```

This is not a tutorial on Linux Security Technologies, so just disable it.

# Networking
## Networking

Setup additional IPs:

```
Expand All @@ -29,7 +31,7 @@ ONBOOT=yes
NAME=loopback1
NM_CONTROLLED=no
EOF
# cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-lo-pdns-pub
DEVICE=lo
IPADDR=127.2.0.1
Expand All @@ -40,7 +42,7 @@ ONBOOT=yes
NAME=loopback2
NM_CONTROLLED=no
EOF
# cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-lo-pdns-rec-int
DEVICE=lo
IPADDR=127.3.0.1
Expand All @@ -51,7 +53,7 @@ ONBOOT=yes
NAME=loopback3
NM_CONTROLLED=no
EOF
# cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-lo-bind-int
DEVICE=lo
IPADDR=127.4.0.1
Expand All @@ -64,16 +66,15 @@ NM_CONTROLLED=no
EOF
```


# Install EPEL
## Install EPEL

`# dnf install epel-release`

Install necessary tools

`# dnf install wget bind-utils`

# MariaDB
## MariaDB

### Setup repository

Expand Down Expand Up @@ -109,30 +110,34 @@ grant select on pdns_int.* to pdns_int_user@localhost identified by 'SuperSecret
```

### create tables for pdns

```
# wget -O - https://raw.githubusercontent.com/1and1/dim/master/dim/pdns.sql | mysql -u root pdns_int
# wget -O - https://raw.githubusercontent.com/1and1/dim/master/dim/pdns.sql | mysql -u root pdns_pub
# wget -O - https://raw.githubusercontent.com/ionos-cloud/dim/master/dim/pdns.sql | mysql -u root pdns_int
# wget -O - https://raw.githubusercontent.com/ionos-cloud/dim/master/dim/pdns.sql | mysql -u root pdns_pub
```

# PowerDNS
## PowerDNS

Install repo file and install software

```
# curl -o /etc/yum.repos.d/powerdns-auth-44.repo https://repo.powerdns.com/repo-files/el-auth-44.repo
# dnf install pdns-tools pdns-backend-mysql
```

Fix config

```
# rm -f /etc/pdns/pdns.conf
```

### Setup two PowerDNS instances

internal pdns

```
# mkdir -p /etc/pdns/{int,pub}
# cat <<EOF >/etc/pdns/pdns-int.conf
setgid=pdns
setuid=pdns
Expand Down Expand Up @@ -175,6 +180,7 @@ EOF
```

public pdns

```
# cat <<EOF >/etc/pdns/pdns-pub.conf
setgid=pdns
Expand Down Expand Up @@ -229,7 +235,7 @@ use systemctl status to verify that startup worked.
# systemctl enable pdns@pub
```

# PowerDNS Recursor
## PowerDNS Recursor

Install pdns-recursor software

Expand All @@ -238,15 +244,18 @@ Install pdns-recursor software
# dnf install pdns-recursor
```

remove default config

```
# rm -f /etc/pdns-recursor/recursor.conf
```

Setup instance

```
# mkdir -p /etc/pdns-recursor/int
$ cat <<EOF >/etc/pdns-recursor/recursor-int.conf
allow-from=0.0.0.0/0, ::/0
any-to-tcp=yes
Expand Down Expand Up @@ -303,36 +312,37 @@ EOF
+example.com=127.1.0.1
+internal.local=127.1.0.1
EOF
# cat <<EOF >/etc/pdns-recursor/int/nta.lua
addNTA('internal.local')
addNTA('example.com')
EOF
```

Enable and start the service, please verify service health using `journalctl`

```
# systemctl enable pdns-recursor@int
# systemctl start pdns-recursor@int
```

# DIM
## DIM

Install rpms of dim, dimclient, ndcli and jdk::

```
# mkdir -p /etc/dim /srv/http/dim.example.com
# dnf install https://github.com/1and1/dim/releases/download/dim-4.0.9/dim-4.0.9-1.el8.x86_64.rpm
# dnf install https://github.com/1and1/dim/releases/download/dimclient-0.4.5/python3-dimclient-0.4.5-1.el8.x86_64.rpm
# dnf install https://github.com/1and1/dim/releases/download/ndcli-4.0.3/python3-ndcli-4.0.3-1.el8.x86_64.rpm
# dnf install https://github.com/1and1/dim/releases/download/dim-web-0.1/python3-dim-web-0.1-1.el8.x86_64.rpm
# dnf install https://github.com/ionos-cloud/dim/releases/download/dim-4.0.9/dim-4.0.9-1.el8.x86_64.rpm
# dnf install https://github.com/ionos-cloud/dim/releases/download/dimclient-0.4.5/python3-dimclient-0.4.5-1.el8.x86_64.rpm
# dnf install https://github.com/ionos-cloud/dim/releases/download/ndcli-4.0.3/python3-ndcli-4.0.3-1.el8.x86_64.rpm
# dnf install https://github.com/ionos-cloud/dim/releases/download/dim-web-0.1/python3-dim-web-0.1-1.el8.x86_64.rpm
```

pdns-output needs to be build manually at the moment (any volunteers?)

```
# dnf install git java-1.8.0-openjdk-devel
# git clone https://github.com/1and1/dim
# git clone https://github.com/ionos-cloud/dim
# cd dim/pdns-output
# cd jdnssec-dnsjava && ../../gradlew build -x test && ../../gradlew publishToMavenLocal; cd ..
# cd jdnssec-tools && ../../gradlew build -x test && ../../gradlew publishToMavenLocal; cd ..
Expand All @@ -350,7 +360,7 @@ systemd unit file
[Unit]
Description=DIM to PowerDNS DB
After=network.target mysql.target
[Service]
Type=simple
ExecStart=/bin/java -jar /opt/dim/pdns-output.jar
Expand All @@ -364,7 +374,7 @@ ProtectSystem=full
ProtectHome=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
LimitNOFILE=40000
[Install]
WantedBy=multi-user.target
EOF
Expand All @@ -380,7 +390,7 @@ DB_HOST = 'localhost'
SQLALCHEMY_DATABASE_URI = 'mysql://%s:%s@%s/dim' % (DB_USERNAME, DB_PASSWORD, DB_HOST)
DB_LOCK_TIMEOUT = 120
SECRET_KEY = 'SuperSecretTtestkey'
### Authentication
# 'ldap' or None
AUTHENTICATION_METHOD = None
Expand Down Expand Up @@ -420,12 +430,14 @@ EOF
```

Install apache httpd and mod_wsgi

```
# dnf install python3-mod_wsgi mod_ssl
# echo "" > /etc/httpd/conf.d/welcome.conf
```

setup /opt/dim/dim.wsgi

```
# cat <<EOF >/opt/dim/dim.wsgi
from dim import create_app
Expand All @@ -434,6 +446,7 @@ EOF
```

setup wsgi.conf

```
# cat <<EOF >/etc/httpd/conf.d/dim.example.com.conf
<VirtualHost *:80>
Expand All @@ -451,7 +464,7 @@ setup wsgi.conf
<Directory /srv/http/dim.example.com>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^ index.html [L]
Require all granted
Expand Down Expand Up @@ -480,6 +493,7 @@ start apache `systemctl enable httpd; systemctl start httpd`
Run `/opt/dim/bin/manage_db init` to create tables

create a ``.ndclirc`` in your home:

```
cat <<EOF >~/.ndclirc
server=http://localhost/dim
Expand All @@ -495,9 +509,10 @@ make sure that ``bash-completion`` is installed (to enable ``ndcli`` completion)

run ``ndcli show server-info`` to test connection to DIM. Just hit enter if a password is asked. Should output information about python and db used.

# DIM output
## DIM output

config file

```
# cat <<EOF >/etc/dim/pdns-output.properties
# dim database connection parameters
Expand Down Expand Up @@ -528,6 +543,7 @@ EOF
```

Enable and start service pdns-output

```
# systemctl enable pdns-output
# systemctl start pdns-output
Expand Down
2 changes: 1 addition & 1 deletion dim-testsuite/t/rr-create-mx-3.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://github.com/1and1/dim/issues/128
# https://github.com/ionos-cloud/dim/issues/128
#
# RFC7505
# " ... To indicate that a domain does not accept email, it advertises a single
Expand Down
2 changes: 1 addition & 1 deletion dim-testsuite/t/todo/pool-list-3.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://github.com/1and1/dim/issues/86
# https://github.com/ionos-cloud/dim/issues/86
#
# calcuate correct number of free ips/delegations
# when assignmentsize is in effect
Expand Down
2 changes: 1 addition & 1 deletion dim-testsuite/tests/allocator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_priorities(self):
self.r.subnet_set_priority('192.168.1.0/24', 1)
assert self.r.ippool_get_ip('testpool')['ip'] == '192.168.1.1'

@pytest.mark.xfail(raises=IntegrityError, reason='https://github.com/1and1/dim/issues/205')
@pytest.mark.xfail(raises=IntegrityError, reason='https://github.com/ionos-cloud/dim/issues/205')
def test_delegation_not_subnet(self):
self.r.ipblock_create('10::/32', status='Container')
self.r.ippool_create('pool')
Expand Down
32 changes: 12 additions & 20 deletions dimclient/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
dimclient
=========
# dimclient

`dimclient` is a python client library to talk to dim. It provides a method
method interface to all DIM functions.
`dimclient` is a Python client library to talk to DIM. It provides a method
interface to all DIM functions.

usage
-----
## usage

To use dimclient, install dimclient in your python environment.
To use `dimclient`, install it in your Python environment.

There are two options to do that:

1. *Distribution packages:* Download and install a distribution-packaged package. There are
packages for Debian- and Redhat-based distributions
in dimclient specific [releases](https://github.com/1and1/dim/releases).
1. *Distribution packages:* Download and install a distribution-packaged package. There are packages for Linux distributions available at [openSUSE Build Service - home:zeromind:dim/dimclient](https://build.opensuse.org/package/show/home:zeromind:dim/dimclient).
Note that distribution packages install the dimclient globally.
2. *Python PIP:* There's no PyPI repo yet, but you can add a specific git tag from
the github repo towards your requirements.txt file so PIP can download and
install dimclient, i.e. in a virtual environment.
A sample requirements.txt snippet is given in the following example:
2. *Python PIP:* [PyPI dimclient](https://pypi.org/project/dimclient/)

```sh
pip install dimclient
```
git+https://github.com/1and1/[email protected]#egg=dimclient&subdirectory=dimclient
```


In your script, create a new dim client and log into the instance. After that,
you can make any request.
In your script, create a new DIM client and log into the instance.
After that, you can make any request.

```
```python
import dimclient

client = dimclient.DimClient("http://localhost:8080")
Expand Down
Loading

0 comments on commit bcafc51

Please sign in to comment.