版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

...

所有的安全防护都做得很好,但却中了勒索病毒,怎么都想不通,唯一可能的解释就是confluence有漏洞,查看了相关的资料,也说 Confluence 存在权限绕过漏洞 (CVE-2023-22518)。

停服了一段时间后,趁着五一更新到最新版。

1、下载软件

1.1 下载 atlassian confluence 8.9.

...

4

https://www.atlassian.com/software/confluence/download-archives

...

https://confluence.atlassian.com/doc/supported-platforms-207488198.html

1.2 下载 TencentKona 11

https://cloud.tencent.com/document/product/1149/38537

1.3 下载 MySQL 8.0

https://dev.mysql.com/downloads/repo/yum/

1.4 下载 MySQL 连接驱动

https://dev.mysql.com/downloads/connector/j/

2、安装Java

需要注意的是:Confluence 8.9 .1 不支持TencentKona 17,在输入激活码的时候会提示:该激活码无效,是Java版本的问题。

...

代码块
source /etc/profile

查看Java版本

代码块
java -version

3、安装MySQL

代码块
yum localinstall mysql80mysql84-community-release-el8-91.noarch.rpm

检查数据源

代码块
yum repolist enabled | grep "mysql.*-community.*"

...

WITH GRANT OPTION的作用可以参考这里:https://blog.csdn.net/chenghuikai/article/details/52219491

4.安装 Confluence

4.1 创建所需目录

代码块
mkdir -pv /data/{confluence,confluence-home}

...

代码块
tar xvf atlassian-confluence-8.9.1.4 tar.gz -C /data/confluence/

...

代码块
vim /data/confluence/atlassian-confluence-8.9.14/confluence/WEB-INF/classes/confluence-init.properties

...

代码块
confluence.home=/data/confluence-home

4.2 激活工具 agent.jar

将下载好的jar包上传到 /opt/目录

代码块
/opt/agent.jar

4.3 MySQL驱动

在启动之前,先把MySQL驱动拷贝到安装目录,避免后面还需要再重启一次

代码块
tar -zxvf mysql-connector-j-8.34.0.tar.gz
cd mysql-connector-j-8.34.0/
mv mysql-connector-j-8.34.0.jar /data/confluence/atlassian-confluence-8.9.14/confluence/WEB-INF/lib/

4.4 启动 Confluence

代码块
JAVA_OPTS="-javaagent:/opt/agent.jar" /data/confluence/atlassian-confluence-8.9.14/bin/start-confluence.sh

查看启动是否成功

...

代码块
vim /data/confluence/atlassian-confluence-8.9.14/bin/setenv.sh

export JAVA_OPTS="-javaagent:/opt/agent.jar ${JAVA_OPTS}"

...

需要注意的是:Confluence 从8.6开始只支持 Data Center 许可证,所以激活码生成的命令需要加-d

5.其他

5.1 从备份还原

如果导出文件很大,则需要从主目录导入。 将文件复制到/data/confluence-home/restore,然后从下方将其导入。

代码块
cp /data/backups/backup-2023_11_03.zip /data/confluence-home/restore

5.2 自定义备份路径

代码块
vim /data/confluence-home/confluence.cfg.xml

...

代码块
sh /data/confluence/atlassian-confluence-8.9.14/bin/stop-confluence.sh
sh /data/confluence/atlassian-confluence-8.9.14/bin/start-confluence.sh

5.3 定时任务

Confluence 配置cron表达式:

代码块
0 0 3 1,3,6,9,12,15,18,21,24,27,29 * ? 

...

代码块
0 5 * * * /bin/sh /opt/cos_migrate_tool_v5-1.4.12/start_migrate.sh

5.4 PDF导出语言支持

代码块
msyh.ttc 

5.5 配置Nginx反向代理

(1)安装NGINX

安装 Nginx

代码块
yum install -y nginx

...

代码块
 # ps -ef | grep nginx

root       20218       1  0 01:28 ?        00:00:00 nginx: master process nginx -c /etc/nginx/nginx.conf
nginx      20219   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20220   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20221   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20222   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20223   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20224   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20225   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20226   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20227   20218  0 01:28 ?        00:00:00 nginx: worker process
nginx      20228   20218  0 01:28 ?        00:00:00 nginx: worker process
root       22886   20001  0 01:36 pts/0    00:00:00 grep --color=auto nginx

5.6  配置Tomcat连接器,改成https协议

编辑 /data/confluence/atlassian-confluence-8.9.14/conf/server.xml

代码块
vim /data/confluence/atlassian-confluence-8.9.14/conf/server.xml

添加https配置

代码块
scheme="https" secure="true" proxyName="liangfu.wang" proxyPort="443"

效果如下:

5.7 JVM内存优化

默认安装时JVM内存设置为1024M,当同时访问用户数较多时,服务卡死,日志报JVM OutOfMemoryError

代码块
vim /data/confluence/atlassian-confluence-8.9.14/bin/setenv.sh


代码块
# Set the Java heap size
CATALINA_OPTS="-Xms2048m -Xmx2048m ${CATALINA_OPTS}"

...

代码块
sh /data/confluence/atlassian-confluence-8.9.14/bin/stop-confluence.sh
sh /data/confluence/atlassian-confluence-8.9.14/bin/start-confluence.sh


检查confluence进程

...

代码块
# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name             
tcp6       0      0 :::8090                 :::*                    LISTEN      54786/java          
tcp6       0      0 :::8091                 :::*                    LISTEN      55500/java          

5.8 修改备案信息

代码块
vim /data/confluence/atlassian-confluence-8.9.14/confluence/decorators/includes/footer-content.vm

5.9 修改访问URL

登录confluence 管理页面,修改默认的URL地址为https://liangfu.wang


参考链接:

https://mp.weixin.qq.com/s/qcHe781i-sqkdgRC6FECtg

...