public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/conf/rspamd/meta_exporter/pipe_rl.php
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
<?php
2
// File size is limited by Nginx site to 10M
3
// To speed things up, we do not include prerequisites
4
header('Content-Type: text/plain');
5
require_once "vars.inc.php";
6
// Do not show errors, we log to using error_log
7
ini_set('error_reporting', 0);
8
// Init Redis
9
$redis = new Redis();
10
try {
11
if (!empty(getenv('REDIS_SLAVEOF_IP'))) {
12
$redis->connect(getenv('REDIS_SLAVEOF_IP'), getenv('REDIS_SLAVEOF_PORT'));
13
}
14
else {
15
$redis->connect('redis-mailcow', 6379);
16
}
17
$redis->auth(getenv("REDISPASS"));
18
}
19
catch (Exception $e) {
20
exit;
21
}
23
$raw_data_content = file_get_contents('php://input');
24
$raw_data_decoded = json_decode($raw_data_content, true);
26
$data['time'] = time();
27
$data['rcpt'] = implode(', ', $raw_data_decoded['rcpt']);
28
$data['from'] = $raw_data_decoded['from'];
29
$data['user'] = $raw_data_decoded['user'];
30
$symbol_rl_key = array_search('RATELIMITED', array_column($raw_data_decoded['symbols'], 'name'));
31
$data['rl_info'] = implode($raw_data_decoded['symbols'][$symbol_rl_key]['options']);
32
preg_match('/(.+)\((.+)\)/i', $data['rl_info'], $rl_matches);
33
if (!empty($rl_matches[1]) && !empty($rl_matches[2])) {
34
$data['rl_name'] = $rl_matches[1];
35
$data['rl_hash'] = $rl_matches[2];
36
}
37
else {
38
$data['rl_name'] = 'err';
39
$data['rl_hash'] = 'err';
40
}
41
$data['qid'] = $raw_data_decoded['qid'];
42
$data['ip'] = $raw_data_decoded['ip'];
43
$data['message_id'] = $raw_data_decoded['message_id'];
44
$data['header_subject'] = implode(' ', $raw_data_decoded['header_subject']);
45
$data['header_from'] = implode(', ', $raw_data_decoded['header_from']);
47
$redis->lpush('RL_LOG', json_encode($data));
48
exit;