selinux verhindert, dass PHP / Roundcube eine Verbindung zu lokalen SMTP- oder IMAP-Ports herstellt

565
Chris

EDIT : Ich habe festgestellt, dass die Ursache Selinux ist. Nach Deaktivierung der Vollstreckung setenforce 0funktionierte alles. Die neue Frage lautet also: Was ist mit Selinux los? Ich habe nur Standard-CentOS 7-Richtlinien.

Ich habe RoundCube Mail auf CentOS 7 konfiguriert

<?php $config['db_dsnw'] = 'mysql://roundcube:redacted@localhost/webmail'; $config['default_host'] = 'localhost'; $config['default_port'] = 993; $config['smtp_server'] = 'localhost'; $config['smtp_port'] = 587; $config['smtp_user'] = '%u'; $config['smtp_pass'] = '%p'; $config['support_url'] = ''; $config['des_key'] = 'redacted'; $config['plugins'] = array('archive', 'attachment_reminder', 'autologon', 'emoticons', 'filesystem_attachments', 'help', 'hide_blockquote', 'managesieve', 'markasjunk', 'newmail_notifier', 'password', 'userinfo', 'vcard_attachments', 'zipdownload'); $config['language'] = 'en_US'; $config['spellcheck_engine'] = 'pspell'; $config['htmleditor'] = 2; $config['draft_autosave'] = 60; $config['preview_pane'] = true; 

Beim Testen von SMPT erhalte ich die Fehlermeldung:

Trying to send email... SMTP send: NOT OK(Connection failed: Failed to connect socket: Permission denied) 

und mit IMAP:

Connecting to localhost... IMAP connect: NOT OK(Login failed for user from my.ip.ad.dr Could not connect to localhost:993: Permission denied) 

Aber ... die Häfen sind in Ordnung. Sie sind offen. Ich habe das bestätigt:

$ openssl s_client -connect 127.0.0.1:993 -crlf CONNECTED(00000003) depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3 verify return:1 ... $ openssl s_client -connect 127.0.0.1:587 -starttls smtp CONNECTED(00000003) depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3 verify return:1 ... $ openssl s_client -connect [::1]:993 -crlf CONNECTED(00000003) depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3 verify return:1 ... $ openssl s_client -connect [::1]:587 -starttls smtp CONNECTED(00000003) depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3 verify return:1 ... 

iptablesnicht installiert firewalldist, wird an seiner Stelle verwendet.

Ich habe firewalldzum Testen runtergenommen .

Irgendeine Idee, was hier los ist?

$ uname -a Linux gbox 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux` $ cat /etc/centos-release CentOS Linux release 7.5.1804 (Core)` $ httpd -v Server version: Apache/2.4.6 (CentOS) Server built: Jun 27 2018 13:48:59 $ php -v PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies $ postconf -d | grep mail_version mail_version = 2.10.1 $ dovecot --version 2.2.10 
0
Localhost hat zwei Adressen. Haben Sie sowohl [:: 1] als auch `127.0.0.1 'überprüft? grawity vor 5 Jahren 0
Ich hatte nicht und sie hörten nicht zu. Nach dem Hinzufügen von ipv6 in dovecot und postfix kann ich jedoch über den openssl-Client eine Verbindung herstellen, jedoch nicht über roundcube. Ich habe die Frage mit den Ergebnissen von ipv6 openssl aktualisiert Chris vor 5 Jahren 0

1 Antwort auf die Frage

0
Chris

Es war also Selinux. Nachdem ich mich eingehend mit dem Audit-Protokoll beschäftigt hatte, kam ich zu folgendem Ergebnis:

setsebool -P httpd_can_network_connect 1

Dadurch kann httpd über das Netzwerk Socket-Verbindungen initiieren (von dem, was ich verstehe).