rspamd, postfix connect to Milter service: Operation timed out

teisho

Well-Known Member
Hi

Versuche gerade Rspamd mit Postfix in einer Jail zum Laufen zu bekommern:

/var/log/maillog
Code:
postfix/cleanup[22250]: warning: connect to Milter service inet:localhost:11332: Operation timed out

ifconfig
Code:
mlxen0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=ed07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWFILTER,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        ether aa:bb:dd:cc:ff:aa
        inet6 2a03:aaaa:bbbb:cccc::23 prefixlen 64
        media: Ethernet 10Gbase-T <full-duplex,rxpause,txpause>>
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 172.16.1.1 netmask 0xffffff00
        groups: lo
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

/etc/hosts
Code:
172.16.1.1              localhost mail.domain.de

sockstat -4
Code:
nobody   rspamd-1.8 18387 8  tcp4   172.16.1.1:11332      *:*

Was übersehe ich?
Danke
 
Es ist sehr ungewöhnlich, localhost eine andere Adresse als 127.0.0.1 zu geben.
Dennoch sollte das Setup so klappen.

Versuch doch mal im Postfix, direkt die Adresse 172.16.1.1 als Milter anzugeben.
Klappt eine Verbindung via Telnet im Jail?

Code:
telnet 172.16.1.1 11332

Rob
 
Hi Rob,

danke, dass du dir die Zeit nimmst.
Nein, per telnet klappt das auch nicht. Bin inzwischen sicher, dass es an meinen Firewallregeln für die Jail liegt.
Ich habe 172.16.1.1 als localhost, da ich 127.0.0.1 in der Jail nicht nutzen konnte.
Das ist aber nicht in Stein gemeißelt. Kann das auch wieder umstellen.

Hier mal meine pf.conf
Code:
# Define the interfaces
ext_if = "vtnet0"
int_if = "lo1"
jail_net = $int_if:network

# Define Ports for Host
host_tcp_ports = "{ 22 }"
host_udp_ports = "{ 22 60001 }"

# specific ICMP for IPv4
icmp_types = "{ echoreq, unreach }"

# specific ICMP for IPv6
icmp6_types = "{ echoreq, routersol, routeradv, neighbradv, neighbrsol }"

# Define the IPs of jails as well as ports to be allowed redirected
mailjail = "172.16.1.1"
mailjail_tcp_ports = "{ 25, 456, 993, 4190 }" 

# Define the NAT for the jails
nat on $ext_if from $jail_net to any -> ($ext_if)
rdr on $ext_if inet proto tcp to port $mailjail_tcp_ports -> $mailjail

pass quick on lo0 no state
# Allow the jail traffic to be translated
pass from { lo0, $jail_net } to any keep state

# Block rules
block in all

# Pass ports to jails
pass in inet proto tcp to $mailjail port $mailjail_tcp_ports
pass in inet6 proto tcp to $ext_if port $mailjail_tcp_ports

# Allow SSH to Host
pass in inet proto tcp to $ext_if port $host_tcp_ports
pass in inet proto udp to $ext_if port $host_udp_ports
pass in inet6 proto tcp to $ext_if port $host_tcp_ports
pass in inet6 proto udp to $ext_if port $host_udp_ports

# allow only specified icmp_types (both in and out)
pass on $ext_if inet proto icmp all icmp-type $icmp_types keep state
pass on $ext_if inet6 proto icmp6 all icmp6-type $icmp6_types keep state

# Allow OB traffic
pass out all keep state

Bin für jede Hilfe dankbar. :)
 
Hi,

ist der ifconfig-Auszug vom Jail oder vom Host?

Wozu nutzt du denn die private Adresse überhaupt? Ich würde die Dienste einfach an localhost binden, dann landen sie auf der primären Adresse des Jails. Dann von Außen (über pf auf dem Host) einfach alles dicht machen. Die Konfiguration für lo1 weglassen und den localhost-Eintrag wieder auf 127.0.0.1 setzen.

Rob
 
Hi,
der ifconfig ist aus der Jail.

Hier die vom Host:
Code:
mlxen0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=6c07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        ether aa:bb:cc:cc:ee:ff
        inet 23.23.23.169 netmask 0xfffffc00 broadcast 23.23.23.255
        inet6 fe80::xxxx:xxx:xxx:xxxx%mlxen0 prefixlen 64 scopeid 0x1
        inet6 2a03:aaaa:f00:fefe::1 prefixlen 64
        inet6 2a03:aaaa:f00:fefe::23 prefixlen 64
        media: Ethernet 10Gbase-T <full-duplex,rxpause,txpause>
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 172.16.1.1 netmask 0xffffff00
        groups: lo
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Die Konfiguration ist "historisch gewachsen" und wurde so von einem Vorgänger übernommen.
Wäre da auch ganz froh die mal etwas zu vereinfachen/modernisieren.

Ich verstehe aber nicht genau was du meinst. Kein NAT und die Jail-IP die selbe wie die vom Host?
Aktuell ist es auf den Servern mit mehrenen Jails so, dass jede Jail eine lokale Adresse bekommt.

Danke für deine Hilfe.
 
Ich verstehe aber nicht genau was du meinst. Kein NAT und die Jail-IP die selbe wie die vom Host?
Aktuell ist es auf den Servern mit mehrenen Jails so, dass jede Jail eine lokale Adresse bekommt.

Dann delegiere die lokale Adresse auf ein normales Interface (nicht lo), in deinem Fall mlxen0.
Du brauchst kein separates Interface für die Jails und damit auch keine Trennung ext_if/int_if in der pf-Konfiguration.

Rob
 
Ok, ich glaube ich habe dich richtig verstanden.

Host rc.conf
Code:
# IPv4 #
ifconfig_mlxen0="inet xx.xx.xx.169 netmask 255.255.252.0"
ifconfig_mlxen0_alias0="inet 172.16.1.1 netmask 255.255.252.0"
defaultrouter="xx.xx.xx.1"

# IPv6 #
ifconfig_mlxen0_ipv6="inet6 2a03:xxxx:xx:162::1 prefixlen 64"
ifconfig_mlxen0_alias0="inet6 2a03:xxxx:xxx:162::23 prefixlen 64"
ipv6_defaultrouter="fe80::1%mlxen0"

pf.conf
Code:
# Define the interfaces
ext_if = "mlxen0"

# Define Ports for Host
host_tcp_ports = "{ 22 }"
host_udp_ports = "{ 22 60001 }"
mailjail_tcp_ports = "{ 25, 993, 465, 4190 }"

# specific ICMP for IPv4
icmp_types = "{ echoreq, unreach }"
# specific ICMP for IPv6
icmp6_types = "{ echoreq, routersol, routeradv, neighbradv, neighbrsol }"

# Block rules
block in all

# Pass ports to jails
pass in inet proto tcp to $ext_if port $mailjail_tcp_ports
pass in inet6 proto tcp to $ext_if port $mailjail_tcp_ports

# Allow SSH to Host
pass in inet proto tcp to $ext_if port $host_tcp_ports
pass in inet proto udp to $ext_if port $host_udp_ports
pass in inet6 proto tcp to $ext_if port $host_tcp_ports
pass in inet6 proto udp to $ext_if port $host_udp_ports

# allow only specified icmp_types (both in and out)
pass on $ext_if inet proto icmp all icmp-type $icmp_types keep state
pass on $ext_if inet6 proto icmp6 all icmp6-type $icmp6_types keep state

# Allow OB traffic
pass out all keep state
 
Man setzt die Aliase nicht (mehr) statisch in der rc.conf. Das Startskript für jails legt die Aliase automatisch an, wie sie in der jail.conf definiert sind.
Der Alias ist außerdem falsch definiert, für Aliase nutzt man immer /32 als Netzmaske.

Bitte Konfiguration anpassen, Jail starten und dann prüfen, ob die Dienste nun laufen.

Rob
 
Blöderweise werden die Jails noch mit ezjail bei dieser Maschine gemanaged. Ich weiß, dass das nicht mehr gut ist, steht auch auf meiner Todo-Liste weit oben. Hätte ich das früher sagen sollen. Sorry.

Jedenfalls wird der Alias nicht angelegt. Komischerweise auch nicht wenn ich ihn selbst definiere.
ifconfig_vtnet0_alias0="inet 172.16.1.1 netmask 255.255.255.255"
 
Manuell geht es.
vtnet0 weil ich das gerade auf einer VM ausprobiere damit ich die produktive Kiste nicht kaputt mache.

Code:
vtnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=6c07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        ether xx:xx:xx:xx:xx:e4
        inet 10.0.0.169 netmask 0xfffffc00 broadcast 10.0.0.255
        inet 172.16.1.1 netmask 0xffffffff broadcast 172.16.1.1
        inet6 fe80::a875:11ff:fecc:9fe4%vtnet0 prefixlen 64 scopeid 0x1
        inet6 xxx:xxx:xx:162::1 prefixlen 64
        inet6 xxx:xxx:xx:162::23 prefixlen 64
        media: Ethernet 10Gbase-T <full-duplex>
        status: active
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
 
Hm, die Jail hat jetzt kein Netz über IPv4.
Vielleicht ist es doch besser wenn ich erst mal die Migration von ezjail zu jail.conf angehe und schaue, dass die Konfiguration so problemlos läuft.
 
Zurück
Oben