Commit 3fd28f32 authored by jan.koester's avatar jan.koester
Browse files

test

parent e090782e
Loading
Loading
Loading
Loading
Loading
+22 −22
Changes for .gitignore: 22 added lines, 22 removed lines.
Original line number Diff line number Diff line
@@ -6,13 +6,13 @@ build-test/cli/*
out*
tuxist.de.db
bindings/nodejs/lib/*
/bindings/nodejs/authdb-client-0.2.1.tgz
/bindings/nodejs/prebuilds/authcli.exe
/bindings/nodejs/prebuilds/authcli.lib
/bindings/nodejs/prebuilds/authdb-nds.abi-115.lib
/bindings/nodejs/prebuilds/authdb-nds.abi-115.node
/bindings/nodejs/prebuilds/authdb.exe
/bindings/nodejs/prebuilds/authdb.lib
/bindings/nodejs/fenrirds-client-0.2.1.tgz
/bindings/nodejs/prebuilds/fenrirdsctl.exe
/bindings/nodejs/prebuilds/fenrirdsctl.lib
/bindings/nodejs/prebuilds/fenrirds-nds.abi-115.lib
/bindings/nodejs/prebuilds/fenrirds-nds.abi-115.node
/bindings/nodejs/prebuilds/fenrirds.exe
/bindings/nodejs/prebuilds/fenrirds.lib
/bindings/nodejs/prebuilds/confctl.exe
/bindings/nodejs/prebuilds/htmlpp.dll
/bindings/nodejs/prebuilds/httppp.dll
@@ -22,21 +22,21 @@ bindings/nodejs/lib/*
/bindings/nodejs/prebuilds/uuid-gen.exe
/bindings/nodejs/prebuilds/uuidpd.dll
/bindings/nodejs/package-lock.json
/test/node_modules/authdb-client/authcli.exe
/test/node_modules/authdb-client/authcli.lib
/test/node_modules/authdb-client/authdb-nds.abi-115.node
/test/node_modules/authdb-client/authdb.exe
/test/node_modules/authdb-client/authdb.lib
/test/node_modules/authdb-client/confctl.exe
/test/node_modules/authdb-client/htmlpp.dll
/test/node_modules/authdb-client/httppp.dll
/test/node_modules/authdb-client/install.js
/test/node_modules/authdb-client/json-c.dll
/test/node_modules/authdb-client/netplus.dll
/test/node_modules/authdb-client/package.json
/test/node_modules/authdb-client/regedit.cfg.dll
/test/node_modules/authdb-client/uuid-gen.exe
/test/node_modules/authdb-client/uuidpd.dll
/test/node_modules/fenrirds-client/fenrirdsctl.exe
/test/node_modules/fenrirds-client/fenrirdsctl.lib
/test/node_modules/fenrirds-client/fenrirds-nds.abi-115.node
/test/node_modules/fenrirds-client/fenrirds.exe
/test/node_modules/fenrirds-client/fenrirds.lib
/test/node_modules/fenrirds-client/confctl.exe
/test/node_modules/fenrirds-client/htmlpp.dll
/test/node_modules/fenrirds-client/httppp.dll
/test/node_modules/fenrirds-client/install.js
/test/node_modules/fenrirds-client/json-c.dll
/test/node_modules/fenrirds-client/netplus.dll
/test/node_modules/fenrirds-client/package.json
/test/node_modules/fenrirds-client/regedit.cfg.dll
/test/node_modules/fenrirds-client/uuid-gen.exe
/test/node_modules/fenrirds-client/uuidpd.dll
.cache/*
/CMakeSettings.json
build-test/src/CMakeFiles/authobj.dir/compiler_depend.make
+14 −9
Changes for CMakeLists.txt: 14 added lines, 9 removed lines.
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.5)

project(authdb)
project(fenrirds)

if(POLICY CMP0144)
    cmake_policy(SET CMP0144 NEW)
@@ -12,8 +12,8 @@ set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_ENABLE_EXPORTS 1)

set(DATAPATH "${CMAKE_INSTALL_DATADIR}/authdb" CACHE FILEPATH "path where stored webinterface files are located")
set(PLUGINPATH "${CMAKE_INSTALL_LIBDIR}/authdb" CACHE FILEPATH "default plugin search path")
set(DATAPATH "${CMAKE_INSTALL_DATADIR}/fenrirds" CACHE FILEPATH "path where stored webinterface files are located")
set(PLUGINPATH "${CMAKE_INSTALL_LIBDIR}/fenrirds" CACHE FILEPATH "default plugin search path")

add_definitions(-D${CMAKE_HOST_SYSTEM_NAME} -DDATAPATH="${DATAPATH}" -DPLUGINPATH="${PLUGINPATH}")

@@ -70,32 +70,37 @@ if(BUILD_BINDINGS)
    add_subdirectory(bindings)
endif()

option(BUILD_PROTO_TESTS "Build the protocol tests (no googletest needed)" ON)
if(BUILD_PROTO_TESTS)
    add_subdirectory(tests/proto)
endif()

option(BUILD_TESTING "Build unit tests" ON)
if(BUILD_TESTING)
    add_subdirectory(tests)
endif()

install(FILES
    data/authdb.js
    data/fenrirds.js
    data/style.css
    data/wizzard.html
    data/login.html
    data/index.html
    data/authdb.png
    data/fenrirds.png
    data/admin.html
DESTINATION ${CMAKE_INSTALL_DATADIR}/authdb)
DESTINATION ${CMAKE_INSTALL_DATADIR}/fenrirds)

if(WIN32)
    set(CPACK_GENERATOR WIX)
    set(CPACK_WIX_UPGRADE_GUID "dbf5510e-d834-4ec7-94de-6c31bf29a92e")
    set(CPACK_PACKAGE_NAME "authdb")
    set(CPACK_PACKAGE_NAME "fenrirds")
    set(CPACK_PACKAGE_VENDOR "tuxist.de")
    set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "authdb - A C++ Auth Database")
    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "fenrirds - A C++ Auth Database")
    set(CPACK_PACKAGE_VERSION "1.0.0")
    set(CPACK_PACKAGE_VERSION_MAJOR "1")
    set(CPACK_PACKAGE_VERSION_MINOR "0")
    set(CPACK_PACKAGE_VERSION_PATCH "0")
    set(CPACK_PACKAGE_INSTALL_DIRECTORY "authdb")
    set(CPACK_PACKAGE_INSTALL_DIRECTORY "fenrirds")
    INCLUDE(CPack)
endif()
+21 −21
Changes for Dockerfile: 21 added lines, 21 removed lines.
Original line number Diff line number Diff line
# authdb container image
# fenrirds container image
#
#   build:    tuxist/fenriros-devel  (every FenrirOS package: clang, cmake, ninja and the
#                                     libnetplus/libhttppp/libconfplus/libuuidp/... -dev packages)
#   runtime:  tuxist/fenriros        (minimal: systempp, fresh, rpm, dnf5)
#
#   docker build -t authdb .
#   docker run -d -v authdb-etc:/etc/authdb -v authdb-data:/var/lib/authdb -p 9090:9090 -p 389:389 authdb
#   docker build -t fenrirds .
#   docker run -d -v fenrirds-etc:/etc/fenrirds -v fenrirds-data:/var/lib/fenrirds -p 9090:9090 -p 389:389 fenrirds
#
# Every library authdb needs is a FenrirOS package, so unlike blogi nothing is fetched or
# built besides authdb itself. The Alpine image is Dockerfile.alpine.
# Every library fenrirds needs is a FenrirOS package, so unlike blogi nothing is fetched or
# built besides fenrirds itself. The Alpine image is Dockerfile.alpine.
#
# Use --build-arg IMAGE_PREFIX=registry.tuxist.de/tuxist/ (and FENRIROS_TAG) to pull the base
# images from another registry/namespace -- see DOCKER_PREFIX in systempp/build-chroot.sh.
@@ -18,31 +18,31 @@ ARG FENRIROS_TAG=20261023

FROM ${IMAGE_PREFIX}fenriros-devel:${FENRIROS_TAG} AS build

WORKDIR /src/authdb
WORKDIR /src/fenrirds
COPY . .

# authdb goes to /usr/local: docker-config.yaml's plugin path points there.
# fenrirds goes to /usr/local: docker-config.yaml's plugin path points there.
RUN cmake -S . -B build -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr/local \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DDATAPATH:PATH=/usr/local/share/authdb \
        -DDATAPATH:PATH=/usr/local/share/fenrirds \
        -DBUILD_BINDINGS=OFF \
        -DBUILD_TESTING=OFF \
 && cmake --build build \
 && DESTDIR=/stage cmake --install build \
 && rm -rf /stage/usr/local/include /stage/usr/local/lib/cmake \
 && find /stage -name '*.a' -exec rm -f {} + \
 && install -Dm644 data/docker-config.yaml /stage/usr/local/share/authdb/docker-config.yaml \
 && install -Dm755 docker/entrypoint.sh /stage/usr/libexec/authdb/entrypoint.sh
 && install -Dm644 data/docker-config.yaml /stage/usr/local/share/fenrirds/docker-config.yaml \
 && install -Dm755 docker/entrypoint.sh /stage/usr/libexec/fenrirds/entrypoint.sh

# fenriros only carries the base system, so copy the shared libraries authdb needs
# fenriros only carries the base system, so copy the shared libraries fenrirds needs
# (DT_NEEDED, resolved recursively against the build image) into the stage, plus the
# confplus backends, which are dlopen()'d and so never show up as DT_NEEDED (authdb's own
# confplus backends, which are dlopen()'d and so never show up as DT_NEEDED (fenrirds's own
# plugins are already in the stage). Every stage file is scanned: fresh's find has no
# -perm -u+x, and readelf skips whatever is not ELF.
RUN set -e; \
    find_lib() { for d in /usr/lib /lib /usr/local/lib /stage/usr/local/lib /stage/usr/local/lib/authdb; do [ -e "$d/$1" ] && { echo "$d/$1"; return 0; }; done; return 1; }; \
    find_lib() { for d in /usr/lib /lib /usr/local/lib /stage/usr/local/lib /stage/usr/local/lib/fenrirds; do [ -e "$d/$1" ] && { echo "$d/$1"; return 0; }; done; return 1; }; \
    mkdir -p /stage/usr/lib; \
    [ -d /usr/lib/confplus ] && cp -a /usr/lib/confplus /stage/usr/lib/; \
    todo=$(find /stage -type f); \
@@ -63,7 +63,7 @@ RUN set -e; \
        todo=$next; \
    done

FROM ${IMAGE_PREFIX}fenriros:${FENRIROS_TAG} AS authdb
FROM ${IMAGE_PREFIX}fenriros:${FENRIROS_TAG} AS fenrirds

# Libraries the base image already ships (libc, libc++, ...) must win over the build image's
# copies of the same files, so only fill in what is missing.
@@ -77,15 +77,15 @@ RUN set -e; \
        cp -a "$f" "$t"; \
    done; \
    cd /; rm -rf /stage; \
    useradd -d /var/lib/authdb authdb; \
    mkdir -p /etc/authdb /var/lib/authdb /var/log/authdb; \
    cp /usr/local/share/authdb/docker-config.yaml /etc/authdb/config.yaml; \
    chown -R authdb:authdb /var/lib/authdb /var/log/authdb
    useradd -d /var/lib/fenrirds fenrirds; \
    mkdir -p /etc/fenrirds /var/lib/fenrirds /var/log/fenrirds; \
    cp /usr/local/share/fenrirds/docker-config.yaml /etc/fenrirds/config.yaml; \
    chown -R fenrirds:fenrirds /var/lib/fenrirds /var/log/fenrirds

VOLUME ["/etc/authdb", "/var/lib/authdb", "/var/log/authdb"]
VOLUME ["/etc/fenrirds", "/var/lib/fenrirds", "/var/log/fenrirds"]

# web interface and API; LDAP of the AD plugin
EXPOSE 9090 389

ENTRYPOINT ["/usr/libexec/authdb/entrypoint.sh"]
CMD ["/usr/local/bin/authdb", "-f", "true", "-c", "yaml://etc/authdb/config.yaml"]
ENTRYPOINT ["/usr/libexec/fenrirds/entrypoint.sh"]
CMD ["/usr/local/bin/fenrirds", "-f", "true", "-c", "yaml://etc/fenrirds/config.yaml"]
+15 −15
Changes for Dockerfile.alpine: 15 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -39,30 +39,30 @@ RUN git clone https://tuxist.de/git/tuxist/libparitypp.git && \
    mkdir libparitypp/build && \
    cd libparitypp/build && cmake ../ -G Ninja && ninja install

COPY . authdb
RUN mkdir authdb/docker-build
RUN cd authdb/docker-build && cmake ../ -G Ninja -DDATAPATH:PATH=/usr/local/share/authdb -DBUILD_BINDINGS=OFF -DBUILD_TESTING=OFF && ninja install 
RUN rm -r authdb/docker-build
COPY . fenrirds
RUN mkdir fenrirds/docker-build
RUN cd fenrirds/docker-build && cmake ../ -G Ninja -DDATAPATH:PATH=/usr/local/share/fenrirds -DBUILD_BINDINGS=OFF -DBUILD_TESTING=OFF && ninja install 
RUN rm -r fenrirds/docker-build

USER root
FROM node:alpine
RUN addgroup authdb
RUN adduser authdb -h /var/lib/authdb -S -G authdb
RUN addgroup fenrirds
RUN adduser fenrirds -h /var/lib/fenrirds -S -G fenrirds
RUN apk update && apk upgrade
RUN apk add --no-cache yaml brotli openssl json-c libuuid libstdc++
RUN mkdir /etc/authdb
RUN mkdir /usr/local/share/authdb
RUN mkdir /etc/fenrirds
RUN mkdir /usr/local/share/fenrirds

COPY data/*.html /usr/local/share/authdb
COPY data/*.js /usr/local/share/authdb
COPY data/*.css /usr/local/share/authdb
COPY data/*.html /usr/local/share/fenrirds
COPY data/*.js /usr/local/share/fenrirds
COPY data/*.css /usr/local/share/fenrirds

COPY --from=build /usr/local/bin/authdb /usr/local/bin
COPY --from=build /usr/local/bin/fenrirds /usr/local/bin
COPY --from=build /usr/local/lib /usr/local/lib

COPY data/docker-config.yaml /etc/authdb/config.yaml
COPY data/docker-config.yaml /etc/fenrirds/config.yaml

RUN chown -R authdb:authdb /var/lib/authdb
RUN chown -R fenrirds:fenrirds /var/lib/fenrirds

CMD ["authdb","-f","true","-c","yaml://etc/authdb/config.yaml"]
CMD ["fenrirds","-f","true","-c","yaml://etc/fenrirds/config.yaml"]
+16 −9
Changes for README.md: 16 added lines, 9 removed lines.
Original line number Diff line number Diff line
# authdb
Authentication Database system with json Rest/Api
# FenrirDirectoryServer
An Active Directory compatible directory server (formerly *authdb*): users,
groups, computers and domains with LDAP, Kerberos, DNS, LDIF import/export, a
web interface and a JSON REST API.

The daemon is `fenrirds`, the command line tool `fenrirdsctl`, the config root
key `FENRIRDS` (configs that still use the old `AUTHDB` root key are read too).
See [docs/ROADMAP.md](docs/ROADMAP.md) for the AD compatibility work.


HTTP is available without TLS configuration. To enable HTTPS, set both
`AUTHDB/SSL/KEY` and `AUTHDB/SSL/CERT` in the config.
`FENRIRDS/SSL/KEY` and `FENRIRDS/SSL/CERT` in the config.

## Master/slave replication
A master can feed any number of read-only slaves. Master and slave can each be
a single node (file backend) or a cluster (`AUTHDB/CLUSTER/ENABLE`).
a single node (file backend) or a cluster (`FENRIRDS/CLUSTER/ENABLE`).

Slaves poll the master over the normal authdb HTTP(S) port. The master
Slaves poll the master over the normal fenrirds HTTP(S) port. The master
publishes a content hash per domain (admin db and every domain); a slave
downloads a full snapshot of each domain whose hash differs and replaces its
local copy. Domains deleted on the master are dropped from the slave's cache.
@@ -18,7 +25,7 @@ changes have to be made on the master.
Master:

```yaml
AUTHDB:
FENRIRDS:
    REPLICATION:
        ROLE: "master"
        SLAVES:                       # name:key, one entry per slave
@@ -29,7 +36,7 @@ AUTHDB:
Slave:

```yaml
AUTHDB:
FENRIRDS:
    REPLICATION:
        ROLE: "slave"
        NAME: "slave-berlin"
@@ -39,7 +46,7 @@ AUTHDB:
            - "https://master2:9090"
        INTERVAL: 30                  # poll interval in seconds
        SSLVERIFY: false
        DOMAINPATH: "/var/lib/authdb" # single node only: where domain files go
        DOMAINPATH: "/var/lib/fenrirds" # single node only: where domain files go
                                      # (default: directory of ADMINDB/PATH)
```

@@ -50,7 +57,7 @@ AUTHDB:
  domains are stored in the cluster, on a single slave in `DOMAINPATH`,
  independent of how the master stores them.
- `GET /replication/info` shows role, last sync and last error of a node.
- Use HTTPS (`AUTHDB/SSL/*`) between master and slave: the replication key
- Use HTTPS (`FENRIRDS/SSL/*`) between master and slave: the replication key
  and the full database are sent over this connection.

## Requirements
Loading