Apache james安装配置笔记(一)
Apache james安装配置笔记
公司要求使用开源的邮件服务系统,架构组的同事推荐了james这个项目,记录一下安装配置的过程
james项目地址
下载安装
james提供spring和guice两种注入方式,目前仅guice方式支持restful接口,为了方便开发管理工具下载的james包为guice+jpa,包下载路径为
https://archive.apache.org/dist/james/server/3.3.0/,下载
james-server-jpa-guice-3.3.0.zip
基本配置
配置keystore
解压压缩包,进入james的目录,生成keystore
cd ${james-path}
keytool -genkey -alias james -keyalg RSA -keystore conf/keystore
需要记住输入的密码,然后进入conf目录,修改
smtpserver.xm
l文件,将secret里改为自己创建keystore时输入的密码
<smtpserver enabled="true">
<jmxName>smtpserver-TLS</jmxName>
<bind>0.0.0.0:465</bind>
<connectionBacklog>200</connectionBacklog>
<tls socketTLS="true" startTLS="false">
<keystore>file://conf/keystore</keystore>
<secret>yourkey</secret>
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
<algorithm>SunX509</algorithm>
</tls>
<connectiontimeout>360</connectiontimeout>
<connectionLimit>0</connectionLimit>
<connectionLimitPerIP>0</connectionLimitPerIP>
<!--
Authorize only local users
-->
<authRequired>true</authRequired>
<authorizedAddresses>127.0.0.0/8</authorizedAddresses>
<!-- Trust authenticated users -->
<verifyIdentity>false</verifyIdentity>
<maxmessagesize>0</maxmessagesize>
<addressBracketsEnforcement>true</addressBracketsEnforcement>
<smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
<handlerchain>
<handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
<handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
</handlerchain>
</smtpserver>
注意文件中存在多个smtpserver节点,全都需要修改,然后依次修改以下文件
imapserver.xml
pop3server.xml
配置webAdmin
创建文件conf/webadmin.properties,写入以下内容
# This template file can be used as example for James Server configuration
# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
# Read https://james.apache.org/server/config-webadmin.html for further details
enabled=true
port=8000
host=localhost
# Defaults to false
https.enabled=false
# Compulsory when enabling HTTPS
#https.keystore=/path/to/keystore
#https.password=password
# Optional when enabling HTTPS (self signed)
#https.trust.keystore
#https.trust.password
# Defaults to false
#jwt.enabled=true
# Defaults to false
#cors.enable=true
#cors.origin
# List of fully qualified class names that should be exposed over webadmin
# in addition to your product default routes. Routes needs to be located
# within the classpath or in the ./extensions-jars folder.
#extensions.routes=
各项配置含义可参考
http://james.apache.org/server/config-webadmin.html
启动james
在james根目录下执行一下脚本(需提前配置好jdk)
java -classpath 'james-server-jpa-guice.jar:james-server-jpa-guice.lib/*' \
-javaagent:james-server-jpa-guice.lib/openjpa-3.0.0.jar \
-Dlogback.configurationFile=conf/logback.xml \
-Dworking.directory=. \
org.apache.james.JPAJamesServerMain
验证webAdmin
curl -XGET http://localhost:8000/healthcheck
得到以下返回表明james启动成功
{"status":"healthy","checks":[{"componentName":"Guice application lifecycle","escapedComponentName":"Guice%20application%20lifecycle","status":"healthy","cause":null}]}
以上为简单的james安装配置,其他模块后续慢慢更新