DirectAdmin 2022年密钥授权系统更新导致“License has expired” 的处理方法

2022年起,DirectAdmin 更新了密钥授权系统,使用多年的 Client ID + License ID + IP 授权结构被改变。部分系统无法自动更新,授权过期后报“License has expired”错误,无法进入控制面板。本文介绍处理方法。

注:以下处理方法已在多台CentOS 7中测试。如果依然在使用CentOS 6等较陈旧的系统,可能存在更多问题,建议尽早升级。

处理步骤

1. 快照备份云服务器的数据,以防误操作。

2. 检查当前DirectAdmin版本。

根据官网的说明,DA版本1.63.4 / 1.63.5 / 1.63.6 将自动完成升级,无需特别处理。

若已经无法进入DA控制面板,可通过以下命令查看当前DA版本。
/usr/local/directadmin/directadmin v

若还可以进入DA面板,可在Support->Licesing/Updates下查看DA的version。

3. 升级DA版本

  • 若无法进入DA面板,在命令行进行版本升级,

如果DA版本较低,比如我的1.60.4版,此时先用原来的CID和LID更新一下授权文件。

/usr/local/directadmin/scripts/getDA.sh CID LID

如果忘掉了CID和LID,一方面可以进入DA的官方面板中查看,否则也可以查看这个文件

cat /usr/local/directadmin/scripts/setup.txt

然后复制以下升级脚本,以root用户运行。

CHANNEL=current                                                                                             # can be one of: alpha, beta, current, stable
OS_SLUG=linux_amd64                                                                                         # can be: linux_amd64, rhel8_amd64, rhel7_amd64, debian10_amd64, ...
COMMIT=$(dig +short -t txt "$CHANNEL-version.directadmin.com" | sed 's|.*commit=\([0-9a-f]*\).*|\1|')       # can be commit hash literal value if you want specific build to be installed
FILE="directadmin_${COMMIT}_${OS_SLUG}.tar.gz"                                                              # creates download package name from the variables above

curl --location --progress-bar --connect-timeout 30 "https://download.directadmin.com/${FILE}" --output "/root/${FILE}"   # downloads given directadmin build into /root dir
tar xzf "/root/${FILE}" -C /usr/local/directadmin                                                                         # extracts downloaded package to /usr/local/directadmin
/usr/local/directadmin/directadmin permissions || true                                                                    # runs post-upgrade permission fix step
/usr/local/directadmin/scripts/update.sh                                                                                  # runs other post upgrade fixes
service directadmin restart

该文件无需配置,复制粘贴即可。

比如命名为update-da.sh,然后chmod +x update-da.sh && ./update-da.sh

国外服务器下载速度一般很快,秒完成。

国内服务器,可能会遇到curl time out的问题,拉更新文件包超时。这时,可以通过显示的文件名,拼接到download.directadmin.com拉过来。比如我国内服务器是用下面命令,手动拉到/root/下,然后再运行更新脚本的(换成你timeout显示的那个文件名)。

wget https://download.directadmin.com/directadmin_1487dffa0a55c1685feb2ca851996f48c2faa6d5_linux_amd64.tar.gz

随后,可再次用/usr/local/directadmin/directadmin v验证升级后的DA版本。此时控制面板已经可以进入。

参见:
https://docs.directadmin.com/directadmin/general-usage/updating-da.html#manual-update-using-cli-and-helper-script

  • 若尚可进入DA面板,在面板触发升级。

官网资料

License Key hashes: New method for installs/setup.sh and getLicense.sh

Important: Upgrade your DirectAdmin to ensure compatibility with our new licensing system

其它

另发现这次升级后,原本在 /etc/cron.d/directadmin_cron 写着的几个定时任务执行脚本命令没了。之前在这里添加了异地备份的一些内容,现在需要重新添加了。

点赞