[Rspamd] Place socket in _rspamd home and fix permissions
[Compose] Remove volume for Rspamd socket [Web] Do not exit loop on fuzzy errors when learning a message as spam
This commit is contained in:
@@ -1409,7 +1409,7 @@ function get_logs($container, $lines = false) {
|
||||
}
|
||||
if ($container == "rspamd-history") {
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/rspamd-sock/rspamd.sock');
|
||||
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/var/lib/rspamd/rspamd.sock');
|
||||
if (!is_numeric($lines)) {
|
||||
list ($from, $to) = explode('-', $lines);
|
||||
curl_setopt($curl, CURLOPT_URL,"http://rspamd/history?from=" . intval($from) . "&to=" . intval($to));
|
||||
|
@@ -221,13 +221,13 @@ function quarantine($_action, $_data = null) {
|
||||
continue;
|
||||
}
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/rspamd-sock/rspamd.sock');
|
||||
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/var/lib/rspamd/rspamd.sock');
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
|
||||
curl_setopt($curl, CURLOPT_URL,"http://rspamd/learnspam");
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $row['msg']);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $row['msg']);
|
||||
$response = curl_exec($curl);
|
||||
if (!curl_errno($curl)) {
|
||||
$response = json_decode($response, true);
|
||||
@@ -243,23 +243,22 @@ function quarantine($_action, $_data = null) {
|
||||
}
|
||||
curl_close($curl);
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/rspamd-sock/rspamd.sock');
|
||||
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/var/lib/rspamd/rspamd.sock');
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: text/plain', 'Flag: 11'));
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: text/plain', 'Flag: 11'));
|
||||
curl_setopt($curl, CURLOPT_URL,"http://rspamd/fuzzyadd");
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $row['msg']);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $row['msg']);
|
||||
$response = curl_exec($curl);
|
||||
if (!curl_errno($curl)) {
|
||||
$response = json_decode($response, true);
|
||||
if (isset($response['error'])) {
|
||||
$_SESSION['return'][] = array(
|
||||
'type' => 'danger',
|
||||
'type' => 'warning',
|
||||
'log' => array(__FUNCTION__),
|
||||
'msg' => array('fuzzy_learn_error', $response['error'])
|
||||
);
|
||||
continue;
|
||||
}
|
||||
curl_close($curl);
|
||||
try {
|
||||
@@ -279,7 +278,7 @@ function quarantine($_action, $_data = null) {
|
||||
$_SESSION['return'][] = array(
|
||||
'type' => 'success',
|
||||
'log' => array(__FUNCTION__),
|
||||
'msg' => 'qlearn_spam'
|
||||
'msg' => array('qlearn_spam', $id)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -288,7 +287,7 @@ function quarantine($_action, $_data = null) {
|
||||
$_SESSION['return'][] = array(
|
||||
'type' => 'danger',
|
||||
'log' => array(__FUNCTION__),
|
||||
'msg' => array('spam_learn_error', 'curl error ' . curl_errno($curl))
|
||||
'msg' => array('spam_learn_error', 'Curl: ' . curl_strerror(curl_errno($curl)))
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -301,12 +300,12 @@ function quarantine($_action, $_data = null) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
curl_close($curl);
|
||||
$_SESSION['return'][] = array(
|
||||
'type' => 'danger',
|
||||
'log' => array(__FUNCTION__),
|
||||
'msg' => array('spam_learn_error', 'curl error ' . curl_errno($curl))
|
||||
'msg' => array('spam_learn_error', 'Curl: ' . curl_strerror(curl_errno($curl)))
|
||||
);
|
||||
curl_close($curl);
|
||||
continue;
|
||||
}
|
||||
curl_close($curl);
|
||||
|
@@ -164,7 +164,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||
switch ($object) {
|
||||
case "actions":
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/rspamd-sock/rspamd.sock');
|
||||
curl_setopt($curl, CURLOPT_UNIX_SOCKET_PATH, '/var/lib/rspamd/rspamd.sock');
|
||||
curl_setopt($curl, CURLOPT_URL,"http://rspamd/stat");
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
$data = curl_exec($curl);
|
||||
|
@@ -618,7 +618,7 @@ $lang['quarantine']['subj'] = "Betreff";
|
||||
$lang['quarantine']['text_plain_content'] = "Inhalt (text/plain)";
|
||||
$lang['quarantine']['text_from_html_content'] = "Inhalt (html, konvertiert)";
|
||||
$lang['quarantine']['atts'] = "Anhänge";
|
||||
$lang['danger']['fuzzy_learn_error'] = "Fuzzy Lernfehler: %s";
|
||||
$lang['warning']['fuzzy_learn_error'] = "Fuzzy Lernfehler: %s";
|
||||
$lang['danger']['spam_learn_error'] = "Spam Lernfehler: %s";
|
||||
$lang['success']['qlearn_spam'] = "Nachricht ID %s wurde als Spam gelernt und gelöscht";
|
||||
|
||||
|
@@ -631,7 +631,7 @@ $lang['quarantine']['subj'] = "Subject";
|
||||
$lang['quarantine']['text_plain_content'] = "Content (text/plain)";
|
||||
$lang['quarantine']['text_from_html_content'] = "Content (converted html)";
|
||||
$lang['quarantine']['atts'] = "Attachments";
|
||||
$lang['danger']['fuzzy_learn_error'] = "Fuzzy hash learn error: %s";
|
||||
$lang['warning']['fuzzy_learn_error'] = "Fuzzy hash learn error: %s";
|
||||
$lang['danger']['spam_learn_error'] = "Spam learn error: %s";
|
||||
$lang['success']['qlearn_spam'] = "Message ID %s was learned as spam and deleted";
|
||||
|
||||
|
@@ -592,7 +592,7 @@ $lang['quarantine']['subj'] = "Onderwerp";
|
||||
$lang['quarantine']['text_plain_content'] = "Inhoud (tekst)";
|
||||
$lang['quarantine']['text_from_html_content'] = "Inhoud (geconverteerde html)";
|
||||
$lang['quarantine']['atts'] = "Bijlagen";
|
||||
$lang['danger']['fuzzy_learn_error'] = "Fuzzy hash training-fout: %s";
|
||||
$lang['warning']['fuzzy_learn_error'] = "Fuzzy hash training-fout: %s";
|
||||
$lang['danger']['spam_learn_error'] = "Spamtraining-fout: %s";
|
||||
$lang['success']['qlearn_spam'] = "Bericht %s werd als spam geclassificeerd en is verwijderd";
|
||||
|
||||
|
Reference in New Issue
Block a user