标签 iredmail 下的文章

在 iredmail 里设置一个可以代收不存在用户邮件的邮箱 - catch-all

环境:debian11,iredmail-1.5.1。例子,将@anqun.org域中,不存在的用户邮件发到存在的admin@anqun.org 收件箱。

步骤:

  1. echo 'INSERT INTO forwardings (address, forwarding, domain, dest_domain) VALUES ('anqun.org', 'admin@anqun.org', 'anqun.org', 'anqun.org');' > catch.sql # 生成一个包含sql语句的文件
  2. mysql -u root vmail < catch.sql # 将此文件导入到vmail数据库中

参考:https://docs.iredmail.org/sql.create.catch-all.html

在 debian 11 里安装 iredmail 1.5.1

概要:需要在debian 11系统里安装 iredmail 1.5.1。本例是需要设置 anqun.org 的收件域。

先要解析好域名,如设置 a 记录 mail.anqun.org 到debian 11系统的公网IP,如 47.97.19.216;设置 mx 记录到 mail.anqun.org。

步骤:

  1. echo mail > /etc/hostname # 设置主机名为 mail
  2. echo 127.0.0.1 mail.anqun.org mail localhost localhost.localdomain > /etc/hosts # 设置完整的主机名为 mail.anqun.org
  3. wget https://github.com/iredmail/iRedMail/archive/refs/tags/1.5.1.tar.gz # 下载 iredmail 1.5.1 安装包
  4. tar xzvf 1.5.1.tar.gz # 解压缩安装包
  5. cd iRedMail-1.5.1 # 转到安装包目录
  6. bash iRedMail.sh # 开始安装
  7. iRedMail 安装欢迎界面
  8. 设置邮件存储目录,可保持默认,/var/vmail
  9. 选择web服务,可保持默认,nginx
  10. 选择存储邮件用户名的数据库类别,可选择 MariaDB
  11. 填写第一个电子邮局的域名,要与主机名区别开来,如本例的 mail.anqun.org
  12. 设置邮局管理员的密码,本例默认管理员用户名是:postmaster@mail.anqun.org
  13. 选择要安装的其它组件,可保持默认,安装 iRedAdmin(类似postfixadmin,可通过web浏览器管理邮局域),Roundcubemail(邮箱用户可通过浏览器收发邮件), Fail2ban
  14. 再次确认要安装的组件或功能。请选择y
  15. 询问是否启用防火墙。请选择n
  16. 完成iRedMail安装,会有相应的登录信息提示。之后,重启系统

参考:https://docs.iredmail.org/install.iredmail.on.debian.ubuntu.html

为iredadmin添加密码保护 - Basic Authentication

现象:将nginx的Basic Authentication配置内容,添加到/etc/nginx/templates/iredadmin.tmpl页头或页尾,不起作用。

尝试:调整位置,可以Basic Authentication的配置内容添加到/etc/nginx/templates/iredadmin.tmpl文件中的python配置里。

如:

# Python scripts
location ~ ^/admin(.*) {                        # <- Changed
    rewrite ^/admin(/.*)$ $1 break;             # <- Changed

    include /etc/nginx/templates/hsts.tmpl;

    include uwsgi_params;
    uwsgi_pass unix:/run/uwsgi/iredadmin.socket;
    uwsgi_param UWSGI_CHDIR /var/www/iredadmin;
    uwsgi_param UWSGI_SCRIPT iredadmin;
    uwsgi_param SCRIPT_NAME /admin;             # <- Changed

    auth_basic           "Administrator’s Area";
    auth_basic_user_file /etc/apache2/.htpasswd; 

    # Access control
    #allow 127.0.0.1;
    #allow 192.168.1.10;
    #allow 192.168.1.0/24;
    #deny all;
}

参考:

腾讯服务器 - iredmail - 安装问题 - python web.py

环境:腾讯云香港机,iredmail 1.3.1,centos7

问题:iredmail安装完成后,在浏览器里访问 iredadmin 提示 Internal Server Error 出错。

过程:查看 /var/log/message 内容,

Jul 22 13:35:30 mail uwsgi: *** Operational MODE: preforking ***
Jul 22 13:35:30 mail uwsgi: Traceback (most recent call last):
Jul 22 13:35:30 mail uwsgi:  File "iredadmin.py", line 9, in <module>
Jul 22 13:35:30 mail uwsgi:
Jul 22 13:35:30 mail uwsgi: from libs import iredbase
Jul 22 13:35:30 mail uwsgi:  File "/opt/www/iRedAdmin-1.0/libs/iredbase.py", line 7, in <module>
Jul 22 13:35:30 mail uwsgi:
Jul 22 13:35:30 mail uwsgi: import web
Jul 22 13:35:30 mail uwsgi: ImportError
Jul 22 13:35:30 mail uwsgi: :
Jul 22 13:35:30 mail uwsgi: No module named web
Jul 22 13:35:30 mail uwsgi:
Jul 22 13:35:30 mail uwsgi: unable to load app 0 (mountpoint='') (callable not found or import error)
Jul 22 13:35:30 mail uwsgi: *** no app loaded. going in full dynamic mode ***

回查安装过程中,有相关的错误提示内容:

Complete!
[ INFO ] Installing required Python-3 modules with pip3: web.py>=0.51 web.py>=0.51
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting web.py>=0.51
  The repository located at mirrors.tencentyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host mirrors.tencentyun.com'.
  Could not find a version that satisfies the requirement web.py>=0.51 (from versions: )
No matching distribution found for web.py>=0.51
[ INFO ] Installing required Python-2 modules with pip2: web.py>=0.51 more-itertools==5.0.0 web.py>=0.51 more-itertools==5.0.0
Collecting web.py>=0.51
  The repository located at mirrors.tencentyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host mirrors.tencentyun.com'.
  Could not find a version that satisfies the requirement web.py>=0.51 (from versions: )
No matching distribution found for web.py>=0.51
You are using pip version 8.1.2, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

那么可尝试手工安装python的相关包,
pip3 install web.py>=0.51
pip2 install web.py>=0.51 more-itertools==5.0.0

然后再重启相应服务(iredamin和iredpad等),或重启系统后测试,可以正常登录到iredadmin进行管理了。

参考:https://forum.iredmail.org/topic17082-internal-server-error-iredadmin.html

修改 iredmail 套件中 roundcube web邮箱登录界面的logo

环境:CentOS7 里安装了 iredmail-1.1。

过程:

  1. /opt/www/roundcubemail/skins/elastic/images/logo.svg # 替换默认 roundcube 的logo
  2. /opt/www/roundcubemail/skins/elastic/images/favicon.ico # 替换默认 roundcube 的站标
  3. 在 /opt/www/roundcubemail/config/config.inc.php 配置文件里,增加一行,修改登录界面的文字说明,默认是“Roundcube Webmail”,如 $rcmail_config['product_name'] = 'AnQun Webmail';

参考: