标签 RT 下的文章

在 debian 12 里安装 request tracker 5

假设:RT5的访问网址是 https://rt.demo.anqun.org ,“售后”队列的收件箱是 support@rt.demo.anqun.org ,搭配 apache 与 mariadb 数据库。

步骤:

  1. hostnamectl set-hostname rt.demo.anqun.org # 设置好主机名
  2. apt update # 更新软件源
  3. apt install mariadb-server # 先安装数据库
  4. systemctl start mariadb # 启动数据库
  5. apt install apache2 rt5-db-mysql rt5-apache2 rt5-fcgi request-tracker5 # 安装RT5,如果提示输入RT的实例名称,我这里是填写了完整的主机名 rt.demo.anqun.org,还会提示设置RT使用的数据库密码和默认用户root的密码
  6. a2dismod mpm_event
  7. a2enmod mpm_prefork # 切换apache的运行模块
  8. a2enmod ssl # 启用https访问
  9. /etc/request-tracker5/RT_SiteConfig.d/50-debconf.pm # 修改配置文件中的 $WebPath 为空,因为本例是访问到/路径
  10. /etc/apache2/sites-enabled/rt.conf # RT的站点设置内容,如下:

    <VirtualHost *:443>
        ### Optional apache logs for RT
        # Ensure that your log rotation scripts know about these files
        # ErrorLog /opt/rt5/var/log/apache2.error
        # TransferLog /opt/rt5/var/log/apache2.access
        # LogLevel debug
        ServerName rt.demo.anqun.org
    
    SSLEngine on
    SSLCertificateFile  /root/.acme.sh/rt.demo.anqun.org_ecc/rt.demo.anqun.org.cer
    SSLCertificateKeyFile /root/.acme.sh/rt.demo.anqun.org_ecc/rt.demo.anqun.org.key
    SSLCertificateChainFile  /root/.acme.sh/rt.demo.anqun.org_ecc/ca.cer
    
        AddDefaultCharset UTF-8
        FcgidInitialEnv RT_SITE_CONFIG /etc/request-tracker5/RT_SiteConfig.pm
    # The defaults are unlikely to be big enough for an RT site handling
    # attachments
        FcgidMaxRequestLen 1073741824
    #        ScriptAlias / /opt/rt5/sbin/rt-server.fcgi/
    # Use the handler
    # Note: If you switch the configuration to be served up from / use a
    # trailing / - ie:
    #   ScriptAlias / /usr/share/request-tracker5/libexec/rt-server.fcgi/
    ScriptAlias / /usr/share/request-tracker5/libexec/rt-server.fcgi/
    
        DocumentRoot "/usr/share/request-tracker5/html"
    
    # Alias "/static" "/usr/share/request-tracker5/static"
    <Location />
    DirectoryIndex index.html
    #            Require all granted
    #            Options +ExecCGI
    #            AddHandler fcgid-script fcgi
    </Location>
    
    # Limit mail gateway access to localhost by default
    <Location /REST/1.0/NoAuth>
    <IfVersion >= 2.3>
        Require local
    </IfVersion>
    <IfVersion < 2.3>
        Order Allow,Deny
        Allow from 127.0.0.1
    </IfVersion>
    </Location>
    </VirtualHost>
  11. systemctl restart apache2 # 重启apache服务后,看看能否访问到RT的web页面。如果root能成功登录,请创建“售后”的队列,且设置收件箱为support。简化测试,让everyone可以有创建和回复工单的权限
  12. dpkg-reconfigure exim4-config # 配置 exim4 ,关键是填写收件箱的域,如 rt.demo.anqun.org 和监听的网络接口(本例是留空,表示在所有的网络接口里监听25端口)
  13. /etc/exim4/conf.d/router/050_exim4-config_rt5support # 创建收件箱地址的router,内容如下:

    rt5support_router:
    driver = accept
    local_parts = support
    transport = rt5support_transport
    
    rt5supportcomment_router:
    driver = accept
    local_parts = support-comment
    transport = rt5supportcomment_transport
  14. /etc/exim4/conf.d/transport/50_exim4-config_rt5support_pipe # 创建收件箱的pipe,内容如下:

    rt5support_transport:
     driver = pipe
     command = "/usr/bin/rt-mailgate --queue 售后 --action correspond --url https://rt.demo.anqun.org"
    
    rt5supportcomment_transport:
     driver = pipe
     command = "/usr/bin/rt-mailgate --queue 售后 --action comment --url https://rt.demo.anqun.org"
  15. update-exim4.conf.template -r && update-exim4.conf && systemctl reload exim4 # 将exim4的配置更新
  16. 如果顺利,发往suuport@rt.demo.anqun.org的邮件,会自动出现在“售后”队列中,从web里可以查看到

参考:

在RequestTracker(RT)里用msmtp通过远程smtp服务器465端口发邮件

SoftLayer(IBM Cloud)过滤了TCP 25端口,Vultr的也可能过滤了,越来越多的云服务商主动屏蔽了25端口的通讯。

阿里云对新建的ECS实例,也过滤了25端口。

RequestTracker的工单系统,邮件通知是重要的需求之一,当阿里云ECS实例不能使用25端口发信时,可以尝试配置msmtp使用远程的smtp 465端口来发邮件。

环境:Deiban 8,RT 4.4.2, RT安装在 /opt/rt4 的路径
国内某免费的企业邮箱:smtp服务器地址,smtp.exmail.qq.com;SSL端口:465;邮箱地址:rt@anqun.org

过程:

  1. /opt/rt4/etc/msmtp_wrapper.conf # 在RT配置目录中创建 msmtp 的配置文件,文件属主是web进程用户,即www-data,权限是600,内容如下:

    defaults
    port 465
    tls on
    tls_trust_file /etc/ssl/certs/ca-certificates.crt
    # logfile ~/.msmtp.log
    
    account qmail
    host smtp.exmail.qq.com
    from rt@anqun.org
    auth on
    user rt@anqun.org
    password NiDeMiMa
    # auto_from on
    tls_starttls off
    
    # Set a default account
    account default : qmail
  2. /opt/rt4/etc/msmtp_wrapper # 在RT文件配置目录中创建Shell文件,文件属性是web进程用户,即www-data,且有执行的权限,+x,内容如下:

    /usr/bin/msmtp -t -C /opt/rt4/etc/msmtp_wrapper.conf
    /usr/bin/logger -t RTmailer -p syslog.info -- CALL /usr/bin/msmtp -nt "$@" RETURNED $?
  3. /opt/rt4/etc/RT_SiteConfig.pm # 在RT的自定义配置文件中,加入以下一行内容,让RT使用msmtp来发信:

    Set( $SendmailPath, '/opt/rt4/etc/msmtp_wrapper');

  4. 重启Web服务,以让新的设置生效,测试发信正常

参考: