Giter Club home page Giter Club logo

Comments (11)

erichk4 avatar erichk4 commented on September 25, 2024 3

We are using the syslog logging driver provided by docker directly,
https://docs.docker.com/config/containers/logging/configure/#supported-logging-drivers

Below example will produce log files in /var/log/docker/postal-smtp.log

docker-compose.yml

smtp:
    image: ghcr.io/postalserver/postal:3.1.1
    command: postal smtp-server
    network_mode: host
    cap_add:
      - NET_BIND_SERVICE
    volumes:
      - /opt/postal/config:/config
    restart: always
    logging:
      driver: syslog
      options:
        tag: "postal-smtp"   

and fail2ban:

jail.local:

[POSTAL]
enabled  = true
port     = 25
filter   = postal
maxretry = 3
findtime = 3600
logpath  = /var/log/docker/postal-smtp.log

filter.d > postal.conf

[Definition]
failregex = (.*)WARN   Authentication failure for <HOST>

ignoreregex =

from postal.

adamcooke avatar adamcooke commented on September 25, 2024 2

Do feel free to start a discussion under Feature Requests to add support for brute force protection directly in the SMTP server.

This is functionality I would like to see without needing to use fail2ban.

from postal.

adamcooke avatar adamcooke commented on September 25, 2024 2

correct way would be a docker-compose.override.yml

This works well. I don't know why I haven't thought about this before. I will update the docs to include this for those who might find it useful.

Edit: added to the docs: https://docs.postalserver.io/features/logging#redirecting-logs-to-the-host-syslog

from postal.

McPizza0 avatar McPizza0 commented on September 25, 2024 2

DELETED

my bad
works well

from postal.

erichk4 avatar erichk4 commented on September 25, 2024 1

@McPizza0
try: postal stop and then postal start (postal restart does not work)

from postal.

McPizza0 avatar McPizza0 commented on September 25, 2024 1

correct way would be a docker-compose.override.yml with the following contents:

version: "3.9"
services:
  smtp:
    logging:
      driver: syslog
      options:
        tag: "postal-smtp"

can also be done via the docker daemon /etc/docker/daemon.json but this would change logging for all containers on the server, which may not be desirable.

from postal.

adamcooke avatar adamcooke commented on September 25, 2024

Logging to files within containers is not a good practice and not supported in v3 - as you have found.

Docker itself will store these logs to a file on the host machine with appropriate rotation. You should look at ingesting these logs. You can find the path to a container's log file using something like this.

docker inspect --format='{{.LogPath}}' name-of-container

from postal.

McPizza0 avatar McPizza0 commented on September 25, 2024

@erichk4 tried this, didnt output any logs
will try doing a fresh install

from postal.

adamcooke avatar adamcooke commented on September 25, 2024

If you can avoid making changes to your docker-compose.yml it will make upgrades easier. These configuration options should be able to be made globally which may be sufficient to redirect the logs. I haven't tried though.

(If you do apply it globally then you'll need to restart Docker itself.)

from postal.

McPizza0 avatar McPizza0 commented on September 25, 2024

@adamcooke you want this in the guide (fail2ban) ?

from postal.

ossplus avatar ossplus commented on September 25, 2024

We are using the syslog logging driver provided by docker directly, https://docs.docker.com/config/containers/logging/configure/#supported-logging-drivers

Below example will produce log files in /var/log/docker/postal-smtp.log

docker-compose.yml

smtp:
    image: ghcr.io/postalserver/postal:3.1.1
    command: postal smtp-server
    network_mode: host
    cap_add:
      - NET_BIND_SERVICE
    volumes:
      - /opt/postal/config:/config
    restart: always
    logging:
      driver: syslog
      options:
        tag: "postal-smtp"   

and fail2ban:

jail.local:

[POSTAL]
enabled  = true
port     = 25
filter   = postal
maxretry = 3
findtime = 3600
logpath  = /var/log/docker/postal-smtp.log

filter.d > postal.conf

[Definition]
failregex = (.*)WARN   Authentication failure for <HOST>

ignoreregex =

Don't work in Debian 12. Debian 12 don't have syslog. It use journalctl to manage log.

from postal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.