LNMP 给 namesilo 域名添加 Let’s Encrypt SSL 证书异常处理

今天要给一个 namesilo 的域名添加 ssl,结果很不顺利,以至于需要写篇文章记录以下。

Unable to find domain specified.

首先,根据 lnmp 网站上的指引——https://www.lnmp.org/faq/letsencrypt-wildcard-ssl.html,跳转到 namesilo 网站获取 key。

旧的 namesilo key 获取网址

这个页面已经过时了,获取到的 key 是无效的。所以,运行 lnmp dnsssl namesilo 之后会出现这样的错误:Unable to find domain specified.。如果打开日志文件 /usr/local/acme.sh/acme.sh.log,从后面往前看,会发现 namesilo 返回的信息:invalid api key permission denied。

key 是否有效可以先通过下面的网址验证以下。key 和 domain 就是你的 key 和域名。如果不检验,直接运行脚本多次错误的话会导致其他问题,这个后面再说。

https://www.namesilo.com/api/getDomainInfo?version=1&type=xml&key=12345&domain=namesilo.com

新的获取 key 的网页地址是这个:https://www.namesilo.com/account/api-manager

新的 key 获取网页在账户后台侧边栏底部

这个网页入口在账户后台侧边栏底部,比较深。

脚本使用的 key 还是旧的

申请到新的 key 之后,命令行 export Namesilo_key=”new key” 之后运行脚本,结果还是没有成功,提示和上面一样。再次查看日志,发现接口里用的 key 还是旧的,但如果命令行输出环境变量则会发现是新的???带着满头问号直接看脚本内容 /usr/local/acme.sh/dnsapi/dns_namesilo.sh 会发现有这么一段:

  #save the api key and email to the account conf file.
  _saveaccountconf Namesilo_Key "$Namesilo_Key"

key 被保存到了一个文件里。也对,自动续期当然需要保存 key,但这就导致了新 key 未生效的问题。话说以前给阿里的域名生成 ssl 倒是没出现这个问题,那时也是第一个 key 无效,用了新 key。

打开 /usr/local/acme.sh/account.conf 文件,将 namesilo 对应的 key 替换为新的就可以了。

too many failed authorizations recently

重新运行脚本,key 可以了,但有了新的错误:Error creating new order :: too many failed authorizations recently: see https://letsencrypt.org/docs/failed-validation-limit/

这个是 let’s encrypt 报的,因为错误次数太多。打开对应的网址,会发现,每个账户,每个域名每小时失败五次就会有这个提示。所以,只能等等再试了。

后续

namesilo dns 解析失败,并且我不知道其是否支持泛解析。所以,后来在阿里买了另一个域名。