From 4732ef9b557aea7290cea0099404ea08f82785c0 Mon Sep 17 00:00:00 2001 From: Glauber Ferreira Date: Wed, 15 May 2024 00:00:10 -0300 Subject: [PATCH] primeiro commit --- .gitea/workflows/build.yaml | 31 +++++++++++++++++++++++++++++++ Dockerfile | 31 +++++++++++++++++++++++++++++++ saslauthd.conf | 5 +++++ start | 3 +++ 4 files changed, 70 insertions(+) create mode 100644 .gitea/workflows/build.yaml create mode 100644 Dockerfile create mode 100644 saslauthd.conf create mode 100644 start diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..6780590 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,31 @@ +name: Build and Push Image +on: [ push ] + +jobs: + build: + name: Build and push image + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.aehoo.net + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64 + tags: | + git.aehoo.net/alphard/znc:${{env.GITHUB_SHA}} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7dc0ab3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM alpine:3.19 AS builder +RUN apk add autoconf automake db-dev g++ gcc gzip heimdal-dev libtool make openldap-dev openssl-dev tar cyrus-sasl libldap +RUN wget -O /tmp/cyrus-sasl.tar.gz https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.28/cyrus-sasl-2.1.28.tar.gz +RUN mkdir -p /tmp/cyrus-sasl &&\ + tar -xzf /tmp/cyrus-sasl.tar.gz --strip=1 -C /tmp/cyrus-sasl &&\ + rm -f /tmp/cyrus-sasl.tar.gz +RUN cd /tmp/cyrus-sasl &&\ + ./configure \ + --prefix=/opt/cyrus-sasl \ + --disable-anon \ + --enable-cram \ + --enable-digest \ + --enable-ldapdb \ + --enable-login \ + --enable-ntlm \ + --disable-otp \ + --enable-plain \ + --with-gss_impl=heimdal \ + --with-devrandom=/dev/urandom \ + --with-ldap=/usr &&\ + make install + +FROM alpine:edge +COPY --from=builder /opt/cyrus-sasl /opt/cyrus-sasl +COPY start /usr/local/bin/start +COPY saslauthd.conf /etc/saslauthd.conf +RUN apk update &&\ + apk add libldap heimdal-libs gdbm libsasl znc tini &&\ + chmod +x /usr/local/bin/start +VOLUME ["/var/lib/znc"] +ENTRYPOINT ["/sbin/tini","--","/usr/local/bin/start"] diff --git a/saslauthd.conf b/saslauthd.conf new file mode 100644 index 0000000..976cca9 --- /dev/null +++ b/saslauthd.conf @@ -0,0 +1,5 @@ +ldap_servers:ldaps://diretorio.aehoo.net +ldap_search_base: ou=People,dc=aehoo,dc=net +ldap_timeout: 10 +ldap_filter: (uid=%u) +ldap_version: 3 diff --git a/start b/start new file mode 100644 index 0000000..955c0b9 --- /dev/null +++ b/start @@ -0,0 +1,3 @@ +#!/bin/ash +/opt/cyrus-sasl/sbin/saslauthd -m /run/saslauthd -a ldap -O /etc/saslauthd.conf +exec /usr/bin/znc -fr -d /var/lib/znc/.znc