commit 5d4f21db8ef42dc4b4c1f48a1864f6ffc81415a7 Author: sebastianserfling Date: Thu Aug 1 14:59:01 2024 +0200 1 diff --git a/.env b/.env new file mode 100644 index 0000000..1358985 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +MAILARCHIVA_HOST_DATA_FOLDER=./data/ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2ea0f5a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,166 @@ +# This file is auto-generated by the Mailu configuration wizard. +# Please read the documentation before attempting any change. +# Generated for compose flavor + +services: + + # External dependencies + redis: + image: redis:alpine + restart: always + volumes: + - "/mailu/redis:/data" + depends_on: + - resolver + dns: + - 192.168.203.254 + + # Core services + front: + image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-2024.06} + restart: always + env_file: mailu.env + logging: + driver: journald + options: + tag: mailu-front + ports: + - "80:80" + - "443:443" + - "25:25" + - "465:465" + - "587:587" + - "110:110" + - "995:995" + - "143:143" + - "993:993" + - "4190:4190" + networks: + - default + - webmail + volumes: + - "/mailu/certs:/certs" + - "/mailu/overrides/nginx:/overrides:ro" + depends_on: + - resolver + dns: + - 192.168.203.254 + + resolver: + image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}unbound:${MAILU_VERSION:-2024.06} + env_file: mailu.env + logging: + driver: journald + options: + tag: mailu-resolver + restart: always + networks: + default: + ipv4_address: 192.168.203.254 + + admin: + image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}admin:${MAILU_VERSION:-2024.06} + restart: always + env_file: mailu.env + logging: + driver: journald + options: + tag: mailu-admin + volumes: + - "/mailu/data:/data" + - "/mailu/dkim:/dkim" + depends_on: + - redis + - resolver + dns: + - 192.168.203.254 + + imap: + image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}dovecot:${MAILU_VERSION:-2024.06} + restart: always + env_file: mailu.env + logging: + driver: journald + options: + tag: mailu-imap + volumes: + - "/mailu/mail:/mail" + - "/mailu/overrides/dovecot:/overrides:ro" + networks: + - default + depends_on: + - front + - resolver + dns: + - 192.168.203.254 + + smtp: + image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}postfix:${MAILU_VERSION:-2024.06} + restart: always + env_file: mailu.env + logging: + driver: journald + options: + tag: mailu-smtp + volumes: + - "/mailu/mailqueue:/queue" + - "/mailu/overrides/postfix:/overrides:ro" + depends_on: + - front + - resolver + dns: + - 192.168.203.254 + + + + antispam: + image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}rspamd:${MAILU_VERSION:-2024.06} + hostname: antispam + restart: always + env_file: mailu.env + logging: + driver: journald + options: + tag: mailu-antispam + networks: + - default + volumes: + - "/mailu/filter:/var/lib/rspamd" + - "/mailu/overrides/rspamd:/overrides:ro" + depends_on: + - front + - redis + - resolver + dns: + - 192.168.203.254 + + # Optional services + + + + # Webmail + webmail: + image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}webmail:${MAILU_VERSION:-2024.06} + restart: always + env_file: mailu.env + logging: + driver: journald + options: + tag: mailu-webmail + volumes: + - "/mailu/webmail:/data" + - "/mailu/overrides/roundcube:/overrides:ro" + networks: + - webmail + depends_on: + - front + +networks: + default: + driver: bridge + ipam: + driver: default + config: + - subnet: 192.168.203.0/24 + webmail: + driver: bridge diff --git a/imapsync-dockerfile b/imapsync-dockerfile new file mode 100644 index 0000000..55796a7 --- /dev/null +++ b/imapsync-dockerfile @@ -0,0 +1,14 @@ +FROM debian:latest + +RUN apt update +RUN apt upgrade -y +RUN apt install -y git make gcc +RUN apt install -y apt-file cpanminus libc6-dev libssl-dev python3 python3-pip python3-csv +RUN apt install -y libperl-dev zlib1g-dev libnet-ssleay-perl +RUN cpanm App::cpanminus Authen::NTLM CGI Compress::Zlib Crypt::OpenSSL::RSA Data::Dumper Data::Uniqid Dist::CheckConflicts Encode Encode::IMAPUTF7 File::Copy::Recursive File::Tail IO::Socket::INET IO::Socket::INET6 IO::Socket::SSL IO::Tee JSON JSON::WebToken LWP::UserAgent Mail::IMAPClient Module::ScanDeps PAR::Packer Pod::Usage Readonly Regexp::Common Sys::MemInfo Term::ReadKey Test::MockObject Test::More Test::Pod Unicode::String +RUN cd /usr/local/src +RUN git clone https://github.com/imapsync/imapsync.git +RUN cd imapsync +RUN make install + +#RUN impasync-script \ No newline at end of file diff --git a/imapsync.py b/imapsync.py new file mode 100644 index 0000000..2eebac9 --- /dev/null +++ b/imapsync.py @@ -0,0 +1,52 @@ +import sys +import csv +import os +import requests +import socket +from pathlib import Path + + +csvfile = Path("user.csv") +host = "127.0.0.1" +port = 993 + + +# Mail Server aktiv ? +try: + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.settimeout(1) + result = sock.connect_ex((host, port)) + if result != 0: + print(f"Fehler beim Verbinden zu {host} auf Port {port}") ## --- E-Mail senden +except: + print(f"Fehler beim Verbinden zu {host} auf Port {port}") ## --- E-Mail senden +finally: + sock.close() + + +# CSV vorhanden +try: + csvfile_path = csvfile.resolve(strict=True) +except FileNotFoundError: + print("not Found") + + +#CSV erste Zeile auslesen (domain;domain) +rows = [] +with open(csvfile, mode='r', newline='') as file: + reader = csv.reader(file, delimiter=";") + for row in reader: + rows.append(row) + for row in rows: + print(len(rows)) + print(row[0]) + print(row[1]) + + + +# CSV laden +# User in CSV kontrollieren ob vorhanden -> User anlegen +# impasync für jeden User durchführen -> Doamin aus CSV laden domain1.de;domain2.de +# Wenn Anmeldung am User failed -> Email mit User an -> impasync@domain1.de +# Abschluss Ergbniss in SQLLite Datenbank schreiben +# Daily Report an -> impasync@domain1.de \ No newline at end of file diff --git a/mailu.env b/mailu.env new file mode 100644 index 0000000..2704991 --- /dev/null +++ b/mailu.env @@ -0,0 +1,166 @@ +# Mailu main configuration file +# +# This file is autogenerated by the configuration management wizard for compose flavor. +# For a detailed list of configuration variables, see the documentation at +# https://mailu.io + +################################### +# Common configuration variables +################################### + +# Set to a randomly generated 16 bytes string +SECRET_KEY=YZ6BKHDTZRSIZ4HT + +# Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!) +SUBNET=192.168.203.0/24 + +# Main mail domain +DOMAIN=test.de + +# Hostnames for this server, separated with commas +HOSTNAMES=mail.test.de + +# Postmaster local part (will append the main mail domain) +POSTMASTER=admin + +# Choose how secure connections will behave (value: letsencrypt, cert, notls, mail, mail-letsencrypt) +TLS_FLAVOR=notls + +# Authentication rate limit per IP (per /24 on ipv4 and /48 on ipv6) +AUTH_RATELIMIT_IP=5/hour + +# Authentication rate limit per user (regardless of the source-IP) +AUTH_RATELIMIT_USER=50/day + +# Opt-out of statistics, replace with "True" to opt out +DISABLE_STATISTICS=True + +################################### +# Optional features +################################### + +# Expose the admin interface (value: true, false) +ADMIN=true + +# Choose which webmail to run if any (values: roundcube, snappymail, none). To enable this feature, recreate the docker-compose.yml file via setup. +WEBMAIL=roundcube + +# Expose the API interface (value: true, false) +API=true + +# Dav server implementation (value: radicale, none). To enable this feature, recreate the docker-compose.yml file via setup. +WEBDAV=none + +# Antivirus solution (value: clamav, none). To enable this feature, recreate the docker-compose.yml file via setup. +ANTIVIRUS=none + +# Scan Macros solution (value: true, false). To enable this feature, recreate the docker-compose.yml file via setup. +SCAN_MACROS=false + +################################### +# Mail settings +################################### + +# Message size limit in bytes +# Default: accept messages up to 50MB +# Max attachment size will be 33% smaller +MESSAGE_SIZE_LIMIT=50000000 + +# Message rate limit (per user) +MESSAGE_RATELIMIT=200/day + +# Networks granted relay permissions +# Use this with care, all hosts in this networks will be able to send mail without authentication! +RELAYNETS= + +# Will relay all outgoing mails if configured +RELAYHOST= + +# Enable fetchmail +FETCHMAIL_ENABLED=False + +# Fetchmail delay +FETCHMAIL_DELAY=600 + +# Recipient delimiter, character used to delimiter localpart from custom address part +RECIPIENT_DELIMITER=+ + +# DMARC rua and ruf email +DMARC_RUA=admin +DMARC_RUF=admin + +# Welcome email, enable and set a topic and body if you wish to send welcome +# emails to all users. +WELCOME=false +WELCOME_SUBJECT=Welcome to your new email account +WELCOME_BODY=Welcome to your new email account, if you can read this, then it is configured properly! + +# Maildir Compression +# choose compression-method, default: none (value: gz, bz2, zstd) +COMPRESSION= +# change compression-level, default: 6 (value: 1-9) +COMPRESSION_LEVEL= + +# IMAP full-text search is enabled by default. +# Set the following variable to off in order to disable the feature +# or a comma separated list of language codes to support +FULL_TEXT_SEARCH=en + +################################### +# Web settings +################################### + +# Path to redirect / to +WEBROOT_REDIRECT=/webmail + +# Path to the admin interface if enabled +WEB_ADMIN=/admin + +# Path to the webmail if enabled +WEB_WEBMAIL=/webmail + +# Path to the API interface if enabled +WEB_API=/api + +# Website name +SITENAME=Mailu + +# Linked Website URL +WEBSITE=https://mailu.io + + + +################################### +# Advanced settings +################################### + +# Docker-compose project name, this will prepended to containers names. +COMPOSE_PROJECT_NAME=mailu + +# Number of rounds used by the password hashing scheme +CREDENTIAL_ROUNDS=12 + +# Header to take the real ip from +REAL_IP_HEADER= + +# IPs for nginx set_real_ip_from (CIDR list separated by commas) +REAL_IP_FROM= + +# choose wether mailu bounces (no) or rejects (yes) mail when recipient is unknown (value: yes, no) +REJECT_UNLISTED_RECIPIENT= + +# Log level threshold in start.py (value: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET) +LOG_LEVEL=INFO + +# Timezone for the Mailu containers. See this link for all possible values https://en.wikipedia.org/wiki/List_of_tz_database_time_zones +TZ=Etc/UTC + +# Default spam threshold used for new users +DEFAULT_SPAM_THRESHOLD=80 + +# API token required for authenticating to the RESTful API. +# This is a mandatory setting for using the RESTful API. +API_TOKEN=ID0UTNZ5L6JOYRUN2WRJL4VXLAJ97JKH + +# Whether tika should be enabled (scan/OCR email attachements). To enable this feature, recreate the docker-compose.yml file via setup. +FULL_TEXT_SEARCH_ATTACHMENTS= diff --git a/user.csv b/user.csv new file mode 100644 index 0000000..f65585c --- /dev/null +++ b/user.csv @@ -0,0 +1 @@ +user1;aljksndnlajksnj \ No newline at end of file