顯示具有 proxmox mail gateway 標籤的文章。 顯示所有文章
顯示具有 proxmox mail gateway 標籤的文章。 顯示所有文章

2025/10/02

promox mail gateway 9 這次的進展真的快

Beta出來沒几天 正式版就出來了

而且之前都要等好久 才會有 LXC 的template

今天早上就已經看到了

既然看到 就升吧

一直以來都是直安裝新版再重設config

官方雖然有升版的文件

但以往的經驗是直接原几升都會有問題

https://forum.proxmox.com/threads/proxmox-mail-gateway-9-0-released.173158/

2024/09/24

昨天開始碰到有趣的狀況
說狀況是因為不確定是不是攻擊
pmg上的cpu會跑到100趴
雖然之前也偶爾會發生
但從昨天開始是大約一小時一次
觀察到是clamd這個process
所以猜測是寄了一封mail
然後導致clamd把cpu 吃滿
但pmg管理介面上無法關閉virus scan
目前只能重開

2024/05/26

近期又開始社交工程演練
使用PMG把信隔離後會放在
/var/spool/pmg/spam
這個目錄下

由於內容是base64編碼
如果要解碼
使用以下指令

base64 -d encode_file > decode_file

2024/04/29

一直有user反應收信時間會delay的問題
因為之前把greylist打開
目前的想法是分成上下班時段
上班關掉 下班再打開
試一段時間看看

指令如下

/usr/bin/pmgsh set /config/mail -greylist 0

/usr/bin/pmgsh set /config/mail -greylist 1


2023/08/05

最近把pmg 升到8

關機或重開的時候一直出現

fail to connect bus no such file or directory

查了一下 好像是原廠的lxc沒裝dbus

apt install -y dbus

裝完後就沒再出現了

另外原本在7版只給一個cpu運作都正常

可是在8版開机時cpu都會吃到滿然後持續一陣子

目前給二顆 運作正常

再觀察看看

2022/11/24

proxmox mail gateway 把信放入隔離區後預設每天會發報表通知給user











如果不想讓user收到通知

要改成以下的設定



2019/10/26

proxmox mail gateway 的 clamav-daemon
時不時就會出現fail的狀況
因為pmg本來就有自我檢查機制
所以想說不管他
可是今天看到後
手動去重啟
又馬上fail
覺得很怪
查了一下log


Oct 26 06:39:53 mg kernel: [765738.983038] Memory cgroup stats for /lxc/124/ns/system.slice/clamav-freshclam.service: cache:1696KB rss:1100KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:528KB writeback:1056KB swap:660KB inactive_anon:720KB active_anon:356KB inactive_file:4KB active_file:4KB unevictable:0KB
Oct 26 06:39:53 mg kernel: [765738.983052] Memory cgroup stats for /lxc/124/ns/system.slice/clamav-daemon.service: cache:1508KB rss:1760KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:0KB writeback:660KB swap:0KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB
Oct 26 06:39:53 mg kernel: [765738.983088] Memory cgroup stats for /lxc/124/ns/system.slice/clamav-daemon.service: cache:68KB rss:44KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:396KB writeback:0KB swap:0KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB
Oct 26 06:39:53 mg kernel: [765738.983097] Memory cgroup stats for /lxc/124/ns/system.slice/clamav-daemon.service: cache:0KB rss:92KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:396KB writeback:0KB swap:132KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB
Oct 26 06:39:53 mg kernel: [765739.020710] oom_reaper: reaped process 4167 (clamd), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Oct 26 06:39:53 mg systemd[1]: clamav-daemon.service: Main process exited, code=killed, status=9/KILL

找了相關文章
都說是ram不夠的問題
目前是2G
先加到4G看看吧

2019/10/22

使用LXC的proxmox mail gateway 發生不能logratate的解法

options features 裡的 nesting要打開

https://forum.proxmox.com/threads/logrotate-issue-in-buster-lxc.56726/

2019/10/21

proxmox mail gateway

預設不會去記錄信件主旨
因此要查找的時候有些不方便
修改方法如下

在 /etc/postfix/main.cf最後增加一行如下

header_checks = regexp:/etc/postfix/header_checks

建立 /etc/postfix/header_checks 這個檔 內容如下

/^Subject:/      WARN

接下來重啟服務
systemctl restart postfix

之後就可以在 /var/log/mail.log看到如下的log

Oct 21 06:43:49 mg postfix/cleanup[19866]: 74A29109C: warning: header Subject: Congratulate Jimmy (Gin-der) Peng for... from mailc-ab.linkedin.com[108.174.3.162]; from=<s-2f4oc1y30l5mpjzdxdjdkon8civu58akgxu9lf1h23ha66tmdhfi46d4@bounce.linkedin.com> to=<abc@de.com> proto=ESMTP helo=<mailc-ab.linkedin.com>

以上的方法在几器重開後 config就會被改回來

找到另一個方法
直接去改pmg的perl

First, add this somewhere between the 'use' statements at the beginning of the file:

use PVE::Tools;

Then search for this line:

$self->log (3, "$queue->{logid}: new mail message-id=%s", $queue->{msgid});

Add the following below that line:

$self->log (3, "$queue->{logid}: Subject: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($entity->head->get('subject'))) || 'No Subject');
my @fromarray = split('\s*,\s*', $entity->head->get('from') || $msginfo->{sender});
$self->log (3, "$queue->{logid}: From: %s", PMG::Utils::decode_rfc1522(PVE::Tools::trim($fromarray[0])) );

https://forum.proxmox.com/threads/how-to-log-subjects-of-all-incoming-email.54191/

第二種方法會把subject放在獨立行
不方便查找

官方其實有提供解法方法

You can find the default templates in /var/lib/pmg/templates/. Please do not modify them directly, because your modification would get lost on the next update. Instead, copy the template you wish to change to /etc/pmg/templates/, then apply your changes there.

Templates can access any configuration setting, and you can use the pmgconfig dump command to get a list of all variable names:

# pmgconfig dump
...
dns.domain = yourdomain.tld
dns.hostname = pmg
ipconfig.int_ip = 192.168.2.127
pmg.admin.advfilter = 1
...
The same tool is used to force regeneration of all template based configuration files. You need to run that after modifying a template, or when you directly edit configuration files

# pmgconfig sync --restart 1

https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#_service_configuration_templates

2019/10/19

proxmox mail gateway的問題

今天在使用 tracking center 找資料的時候出現


















結果找了一下問題
竟然是要把ublock關掉才會正常
XD

https://forum.proxmox.com/threads/connection-error-in-tracking-center.41293/

2019/10/18

proxmox mail gateway 今年 opensource
因為之前都是用fortiget來處理spam的問題
所以也沒想要換
不過因為保固到期 新的合約沒有買到spam這個授權
而且最近也把mail server 換到centos 8
所以就想說來試看看
如果本來就是用 proxmox ve
那就可以直接使用LXC的template
我就是直接用template
安裝很快 裝完template也就可以砍了
再來說明一下裝完後有那些要改
首先是登入的root密碼
接下來使用iptables去管制能夠連到管理介面的來源ip

mail filter

一直以來我們的處理方式都是在主旨加上tag 而不是去隔離信
所以這裡要改
至於要不要通知管理者 就自行決定了
如果需要黑白名單 也是在這裡加














configuration

管理者的mail要記得改
















mail proxy

relaying
relay domains
transports
請依自己的環境修改
如果使用greylist 白名單是加在這裡 要注意 不是在mail filter














options

紅框是我覺得一定要改的
信件大小是跟著gmail的規則
網路上看到都說不要開greylist 可是我認為要開 可以少掉很多spam
SMTPD banner 如果不改 會顯示proxmox
站在安全的角度 我不想讓人知道我用什麼產品
其他就視需要自行決定了


















未加greylist



















加上greylist



















spam跟virus的更新系統會自動做
至於其他就自己看看

文件上的這張圖怪怪的


















實体上不是直接放在mail server 前面
而是要在DNS設定MX
外面進來的信先進到PMG
處理完後再轉到mail server
所以我目前的做法是在mail server上用iptable管制特定ip才能連到25
而且出去的信我也是從mail servre直接出去
不再經過PMG
到目前大約運作十多天
看起來效果還不錯

https://www.proxmox.com/en/proxmox-mail-gateway
https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html