Compare commits

...

967 Commits

Author SHA1 Message Date
xiaojunnuo
5668a3e222 v1.25.6 2024-09-29 10:10:49 +08:00
xiaojunnuo
47fa419803 chore: 2024-09-29 10:05:22 +08:00
xiaojunnuo
4fcaab5feb chore: 禁止普通用户使用不安全插件,比如复制到本机、自定义js脚本等 2024-09-29 01:14:21 +08:00
xiaojunnuo
5aa06f5b07 chore: 2024-09-29 00:50:32 +08:00
xiaojunnuo
9d9c021819 perf: 增加使用教程 2024-09-29 00:38:17 +08:00
xiaojunnuo
21c09c93b3 docs: 2024-09-28 19:41:54 +08:00
xiaojunnuo
3dc2750d64 docs: 宝塔容器编排部署教程 2024-09-27 17:59:36 +08:00
xiaojunnuo
76e86ea283 fix: 修复中间证书复制错误的bug 2024-09-27 16:25:18 +08:00
xiaojunnuo
a00e96b63b chore: 2024-09-27 14:46:38 +08:00
xiaojunnuo
d047234d98 perf: 部署支持1Panel 2024-09-27 02:15:41 +08:00
xiaojunnuo
3f21a49988 chore: 2024-09-26 15:15:17 +08:00
xiaojunnuo
6a02de35ce chore: 2024-09-26 14:53:00 +08:00
xiaojunnuo
65363b2713 chore: 2024-09-26 14:35:10 +08:00
xiaojunnuo
ec8c06da9b chore: 2024-09-26 14:27:32 +08:00
xiaojunnuo
d0cb0e324e build: trigger build image 2024-09-26 14:27:23 +08:00
xiaojunnuo
be13390b3a v1.25.5 2024-09-26 14:27:04 +08:00
xiaojunnuo
e9fda44bf0 chore: 2024-09-26 14:26:04 +08:00
xiaojunnuo
27f6cf24dd chore: 2024-09-26 14:20:32 +08:00
xiaojunnuo
6ab627ed5a chore: 2024-09-26 13:20:10 +08:00
xiaojunnuo
a350b51cf8 chore: 2024-09-26 10:40:22 +08:00
xiaojunnuo
bbb032344b chore: 2024-09-26 10:24:25 +08:00
xiaojunnuo
3220b87457 chore: 2024-09-25 10:40:57 +08:00
xiaojunnuo
ec1015295e chore: 优化build 2024-09-25 10:35:30 +08:00
xiaojunnuo
a943a41d2e chore: 1 2024-09-25 10:18:43 +08:00
xiaojunnuo
2d86fa254c build: trigger build image 2024-09-25 09:53:14 +08:00
xiaojunnuo
03ce69dbfb v1.25.4 2024-09-25 09:52:23 +08:00
xiaojunnuo
653d8d43a8 chore: 1 2024-09-25 09:49:34 +08:00
xiaojunnuo
ae816e614c chore: 2024-09-25 09:46:13 +08:00
xiaojunnuo
3460d3ddca fix: 修复启动报授权验证失败的bug 2024-09-25 09:41:05 +08:00
xiaojunnuo
f5b423c351 chore: 1 2024-09-25 03:34:56 +08:00
xiaojunnuo
a4652ce7ba build: trigger build image 2024-09-25 03:33:28 +08:00
xiaojunnuo
7417188d36 chore: 1 2024-09-25 03:33:25 +08:00
xiaojunnuo
c2650d308c v1.25.3 2024-09-25 03:32:30 +08:00
xiaojunnuo
a616101ad0 chore: 1 2024-09-25 03:30:50 +08:00
xiaojunnuo
9fdb560528 chore: 1 2024-09-25 03:22:14 +08:00
xiaojunnuo
0f0ddb9c59 fix: 修复upload to host trim错误 2024-09-25 03:20:21 +08:00
xiaojunnuo
50e027ca80 chore: 1 2024-09-25 03:02:37 +08:00
xiaojunnuo
37aa7f5dfc chore: 1 2024-09-25 03:00:07 +08:00
xiaojunnuo
9c3709106b build: trigger build image 2024-09-25 02:56:59 +08:00
xiaojunnuo
66fb689ac5 v1.25.2 2024-09-25 02:56:09 +08:00
xiaojunnuo
8e01360a22 chore: 1 2024-09-25 02:54:30 +08:00
xiaojunnuo
3bbf8f4a03 build: trigger build image 2024-09-25 02:43:14 +08:00
xiaojunnuo
c7f7910fa9 v1.25.1 2024-09-25 02:42:21 +08:00
xiaojunnuo
211548fd53 build: prepare to build 2024-09-25 02:40:51 +08:00
xiaojunnuo
4d4c77129f chore: 1 2024-09-25 02:40:45 +08:00
xiaojunnuo
7500fb3b1c build: prepare to build 2024-09-25 02:39:27 +08:00
xiaojunnuo
1906c310f5 v1.25.0 2024-09-25 02:37:15 +08:00
xiaojunnuo
59695cee88 build: prepare to build 2024-09-25 02:35:57 +08:00
xiaojunnuo
36975b37e3 Merge branch 'v2-dev' into v2
# Conflicts:
#	packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/index.vue
2024-09-25 02:35:26 +08:00
xiaojunnuo
5724c04bc3 Merge remote-tracking branch 'origin/v2' into v2
# Conflicts:
#	packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/index.vue
#	packages/ui/certd-server/src/plugins/plugin-other/plugins/plugin-restart.ts
2024-09-25 02:34:56 +08:00
xiaojunnuo
2e22f69bde build: prepare to build 2024-09-25 02:32:59 +08:00
xiaojunnuo
298c2c8bc7 chore: 1 2024-09-25 02:32:14 +08:00
xiaojunnuo
86e291c5a3 chore: 支持dynadot,会覆盖原有的dns解析,京东云也有问题,没有测试通过,这两个目前都有缺陷 2024-09-25 02:31:45 +08:00
xiaojunnuo
f9a3ac2cb1 chore: 2024-09-24 23:25:39 +08:00
xiaojunnuo
8ecc2f9446 perf: 支持七牛云 2024-09-24 13:50:06 +08:00
xiaojunnuo
8de56feeb7 chore: 优化性能 2024-09-24 11:11:08 +08:00
xiaojunnuo
10ff783982 chore: 1 2024-09-24 10:44:20 +08:00
xiaojunnuo
c46b2c3cb7 chore: 宝塔面板一键部署说明 2024-09-24 10:43:24 +08:00
xiaojunnuo
9a3ff8ad1a chore: 2024-09-24 03:08:24 +08:00
xiaojunnuo
92aa4a6d63 chore: 2024-09-24 02:42:08 +08:00
xiaojunnuo
154f627f2a Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-09-24 01:31:40 +08:00
xiaojunnuo
a624a3f065 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-09-23 17:39:53 +08:00
xiaojunnuo
361e8fe7ae feat: 支持vip转移 2024-09-23 17:39:18 +08:00
xiaojunnuo
3d9c3ecb3e perf: 证书支持旧版RSA,pkcs1 2024-09-23 14:32:57 +08:00
xiaojunnuo
f9ff9191a1 chore: env 2024-09-23 14:04:33 +08:00
xiaojunnuo
e85b4da2e3 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-09-23 13:34:36 +08:00
xiaojunnuo
ab53c601bf chore: 2024-09-23 13:33:46 +08:00
xiaojunnuo
8e03e8463f chore: 2024-09-23 13:23:49 +08:00
xiaojunnuo
81d6c0ebdf chore: env 2024-09-23 11:27:53 +08:00
xiaojunnuo
e0466409d0 feat: 账号绑定 2024-09-23 01:52:42 +08:00
xiaojunnuo
e86756e4c6 feat: 支持中间证书 2024-09-22 23:19:10 +08:00
xiaojunnuo
bdc0227c08 chore: account 2024-09-22 02:06:34 +08:00
xiaojunnuo
0451fa7573 chore: 2024-09-22 00:33:09 +08:00
xiaojunnuo
8b8039f42b perf: 群晖支持OTP双重验证登录 2024-09-20 19:29:16 +08:00
xiaojunnuo
df55299e6f Merge branch 'v2' into v2-dev
# Conflicts:
#	packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/index.vue
#	packages/ui/certd-server/src/plugins/plugin-other/plugins/plugin-restart.ts
2024-09-20 15:19:22 +08:00
xiaojunnuo
9c773aaa05 chore: 2024-09-20 15:15:24 +08:00
xiaojunnuo
4e4bbee8c2 chore: 1 2024-09-20 13:27:07 +08:00
xiaojunnuo
d331fea477 perf: 支持阿里云ACK证书部署 2024-09-20 12:34:41 +08:00
xiaojunnuo
9de77b327d perf: 优化主机登录失败提示 2024-09-20 11:11:25 +08:00
xiaojunnuo
ab41eea7a9 chore: 2024-09-20 10:26:48 +08:00
xiaojunnuo
22ef28f633 perf: 优化收件邮箱输入 2024-09-20 10:23:20 +08:00
xiaojunnuo
a8da658a97 perf: plugins增加图标 2024-09-19 17:38:51 +08:00
xiaojunnuo
e5a5d0a607 perf: 支持k8s ingress secret 2024-09-19 14:23:15 +08:00
xiaojunnuo
60ea9106f1 chore: 1 2024-09-19 10:17:31 +08:00
xiaojunnuo
7549b9443f Merge remote-tracking branch 'origin/v2' into v2 2024-09-18 18:17:49 +08:00
xiaojunnuo
5021a2081e chore: 1 2024-09-18 17:22:08 +08:00
xiaojunnuo
ce3426368b chore: 定时任务提示优化 2024-09-18 17:04:16 +08:00
xiaojunnuo
7aa3d8e5d9 chore: 证书输出选择器优化 2024-09-18 14:58:59 +08:00
xiaojunnuo
4c37ec3222 Merge remote-tracking branch 'origin/v2' into v2
# Conflicts:
#	packages/ui/certd-server/src/plugins/plugin-other/plugins/index.ts
2024-09-16 15:52:35 +08:00
xiaojunnuo
830de90317 chore: 代理初步 2024-09-14 10:29:47 +08:00
xiaojunnuo
d5956072f0 chore: 代理初步 2024-09-14 10:28:06 +08:00
xiaojunnuo
2309b07d85 chore: 2024-09-14 09:19:10 +08:00
xiaojunnuo
3a6e067ea3 chore: 2024-09-12 09:26:00 +08:00
xiaojunnuo
bb8f0bed6d chore: 2024-09-12 09:16:43 +08:00
xiaojunnuo
6fee28c9e9 chore: 2024-09-12 09:14:10 +08:00
xiaojunnuo
b6e3b96d56 chore: 2024-09-11 18:04:19 +08:00
xiaojunnuo
ecd83ee136 fix: 修复首次创建任务运行时不自动设置当前运行情况的bug 2024-09-11 18:01:46 +08:00
xiaojunnuo
8ed16b3ea2 perf: 任务支持禁用 2024-09-11 16:49:50 +08:00
xiaojunnuo
5b0f5f75d0 chore: 2024-09-11 11:16:22 +08:00
xiaojunnuo
a89fe4702d chore: 2024-09-10 17:39:41 +08:00
xiaojunnuo
664bd863e5 perf: http请求增加默认超时时间 2024-09-10 11:58:58 +08:00
xiaojunnuo
e0241686dc chore: 2024-09-09 17:36:09 +08:00
xiaojunnuo
9092f05985 chore: 2024-09-09 17:35:10 +08:00
xiaojunnuo
eb1ab0992f chore: 2024-09-09 17:31:15 +08:00
xiaojunnuo
f22ff2296c build: trigger build image 2024-09-09 17:30:22 +08:00
xiaojunnuo
6fe2d2c328 v1.24.4 2024-09-09 17:30:04 +08:00
xiaojunnuo
20f5865bb9 build: prepare to build 2024-09-09 17:29:13 +08:00
xiaojunnuo
2b224c712f chore: 2024-09-09 17:29:09 +08:00
xiaojunnuo
c446e24f1a build: prepare to build 2024-09-09 17:27:50 +08:00
xiaojunnuo
2623f45a3b chore: 2024-09-09 17:03:46 +08:00
xiaojunnuo
52e7208e8f chore: 2024-09-09 17:01:00 +08:00
xiaojunnuo
d1498a7160 perf: 插件选择支持搜索 2024-09-09 16:55:14 +08:00
xiaojunnuo
5c270b6b9d perf: 支持群晖 2024-09-09 16:01:42 +08:00
xiaojunnuo
18718f6a25 chore: 2024-09-09 10:39:29 +08:00
xiaojunnuo
653f409d91 fix: 修复腾讯云tke证书部署报错的bug
https://github.com/certd/certd/issues/162
2024-09-09 10:24:20 +08:00
xiaojunnuo
0f0af2f309 perf: 群晖部署教程 2024-09-09 10:17:40 +08:00
xiaojunnuo
7908ab79da fix: 修复腾讯云cdn证书部署后会自动关闭hsts,http2.0等配置的bug
https://github.com/certd/certd/issues/161
2024-09-09 10:17:25 +08:00
xiaojunnuo
ae3daa9bcf perf: 前置任务步骤增加错误提示 2024-09-09 09:27:38 +08:00
xiaojunnuo
48238d929e perf: 增加重启certd插件 2024-09-07 11:55:23 +08:00
xiaojunnuo
01df4d0f1d chore: 1 2024-09-07 11:45:46 +08:00
xiaojunnuo
25ff6906c6 chore: 1 2024-09-07 11:44:52 +08:00
xiaojunnuo
695548eade chore: 支持armv7 2024-09-07 11:43:21 +08:00
xiaojunnuo
6221a4e464 chore: node版本设置为18 2024-09-07 11:40:45 +08:00
xiaojunnuo
115b819c66 chore: 测试armv7 2024-09-07 11:35:02 +08:00
xiaojunnuo
bceb8cce0d chore: 测试armv7 2024-09-07 11:34:10 +08:00
xiaojunnuo
8d2cf2095c chore: 测试armv7 2024-09-07 11:30:28 +08:00
xiaojunnuo
1b1a1a5bc2 chore: 测试armv7 2024-09-07 11:21:10 +08:00
xiaojunnuo
935ebe022a chore: 测试armv7 2024-09-06 23:48:40 +08:00
xiaojunnuo
ff356571c8 chore: 测试armv7 2024-09-06 23:48:01 +08:00
xiaojunnuo
76fb2141e4 chore: 测试armv7 2024-09-06 23:44:43 +08:00
xiaojunnuo
b220500f40 chore: 测试armv7 2024-09-06 23:39:37 +08:00
xiaojunnuo
1cbf70fb6a chore: 测试armv7 2024-09-06 23:39:22 +08:00
xiaojunnuo
52ec48656d chore: 测试armv7 2024-09-06 23:33:29 +08:00
xiaojunnuo
fddf3a0f68 chore: 2024-09-06 23:31:47 +08:00
xiaojunnuo
98520a1213 build: trigger build image 2024-09-06 23:21:50 +08:00
xiaojunnuo
d65d94b784 v1.24.3 2024-09-06 23:21:11 +08:00
xiaojunnuo
00f1e0da59 build: prepare to build 2024-09-06 23:19:58 +08:00
xiaojunnuo
65ef685729 perf: 支持多吉云cdn证书部署 2024-09-06 23:19:34 +08:00
xiaojunnuo
6e344140c6 chore: 1 2024-09-06 22:45:08 +08:00
xiaojunnuo
97a01b6f6d build: trigger build image 2024-09-06 22:35:27 +08:00
xiaojunnuo
c49ccbde93 v1.24.2 2024-09-06 22:34:49 +08:00
xiaojunnuo
fc73d9d615 build: prepare to build 2024-09-06 22:33:30 +08:00
xiaojunnuo
1133d6b0f7 chore: 2024-09-06 22:32:29 +08:00
xiaojunnuo
b80210f24b perf: 优化跳过处理逻辑 2024-09-06 10:19:03 +08:00
xiaojunnuo
3bad0b2685 chore: 1 2024-09-06 00:13:21 +08:00
xiaojunnuo
af388ec39f Merge remote-tracking branch 'origin/v2' into v2 2024-09-05 18:01:04 +08:00
xiaojunnuo
8d7c2c8e29 Merge branch 'v2' of https://github.com/certd/certd into v2 2024-09-05 18:01:05 +08:00
xiaojunnuo
8088cd6d58 1 2024-09-05 18:00:51 +08:00
xiaojunnuo
590ce9642e 1 2024-09-05 18:00:45 +08:00
xiaojunnuo
99302b8ff2 chore: 2024-09-05 16:19:00 +08:00
xiaojunnuo
14b108f09e chore: 2024-09-05 16:18:42 +08:00
xiaojunnuo
0669835d4e chore: 2024-09-05 16:11:03 +08:00
xiaojunnuo
fbeaed2035 perf: 支持pfx、der 2024-09-05 15:36:35 +08:00
xiaojunnuo
ecad7f58c1 chore: 2024-09-05 14:33:45 +08:00
xiaojunnuo
1dd9a8d4d3 docs: 2024-09-05 11:00:21 +08:00
xiaojunnuo
bd73a163cd perf: 阶段、任务、步骤全面支持拖动排序 2024-09-05 10:47:03 +08:00
xiaojunnuo
1e9b5638aa perf: 任务支持拖动排序 2024-09-05 01:39:46 +08:00
xiaojunnuo
71ac8aae4a fix: 修复windows下无法执行第二条命令的bug 2024-09-05 00:04:31 +08:00
xiaojunnuo
d5bfcdb6de perf: 修复windows下无法执行第二条命令的bug 2024-09-04 18:29:39 +08:00
xiaojunnuo
1480efb43d pref: 支持https启动 2024-09-04 16:15:42 +08:00
xiaojunnuo
1c17b41e16 perf: 西部数据支持用户级的apikey 2024-09-04 15:49:15 +08:00
xiaojunnuo
192d9dc7e3 perf: 任务配置不需要的字段可以自动隐藏 2024-09-04 15:49:00 +08:00
xiaojunnuo
d0d3c2b588 Merge remote-tracking branch 'origin/v2' into v2 2024-09-04 11:28:22 +08:00
Greper
b8a8f20448 perf: 支持西部数码DNS
perf: 支持西部数码DNS
2024-09-04 11:28:07 +08:00
xiaojunnuo
28a32aed7d chore: 2024-09-04 11:26:56 +08:00
xiaojunnuo
ff46771d8d perf: client 请求超时时间延长为10s 2024-09-03 22:09:48 +08:00
xiaojunnuo
87a2673e8c perf: 支持阿里云oss 2024-09-03 18:21:02 +08:00
Moeyuuko
c59cab1aae perf: 支持西部数码DNS 2024-09-03 15:40:45 +08:00
xiaojunnuo
6314e8d7eb fix: 修复复制流水线出现的各种问题 2024-09-03 11:42:05 +08:00
xiaojunnuo
5ade12d700 chore: 2024-09-03 00:26:35 +08:00
xiaojunnuo
ceb210b1b7 chore: 2024-09-03 00:06:13 +08:00
xiaojunnuo
5e084db038 build: trigger build image 2024-09-02 23:58:23 +08:00
xiaojunnuo
bef6b981e2 v1.24.1 2024-09-02 23:57:42 +08:00
xiaojunnuo
a77cd65789 build: prepare to build 2024-09-02 23:56:04 +08:00
xiaojunnuo
415b731d9a chore: 2024-09-02 23:55:38 +08:00
xiaojunnuo
6c0099d600 chore: 2024-09-02 23:47:15 +08:00
xiaojunnuo
98b77f8084 perf: 支持阿里云 DCDN 2024-09-02 23:46:28 +08:00
Greper
2f47ffb76b Merge pull request #148 from wujingke/v2
pref: 添加阿里云DCDN 废弃SetDomainServerCertificate接口 改为SetCdnDomainSSLCertificate
2024-09-02 22:00:36 +08:00
w
35a3603c41 添加阿里云DCDN 废弃SetDomainServerCertificate接口 改为SetCdnDomainSSLCertificate 2024-09-02 19:33:17 +08:00
xiaojunnuo
ea775adae1 perf: 支持已跳过的步骤重新运行 2024-09-02 18:36:12 +08:00
xiaojunnuo
724a85028b perf: 支持cdnfly 2024-09-02 16:59:49 +08:00
xiaojunnuo
b2d595e85c Merge remote-tracking branch 'origin/v2' into v2 2024-09-02 15:50:43 +08:00
xiaojunnuo
d9b1ff8c5c chore: 2024-09-02 15:49:56 +08:00
xiaojunnuo
1c17970b98 fix: 激活仅限管理员 2024-09-02 01:02:41 +08:00
xiaojunnuo
b9bddbfabb perf: 支持ftp上传 2024-09-01 04:49:26 +08:00
xiaojunnuo
ee617095ef perf: 部署插件支持宝塔、易盾云等 2024-08-30 18:52:31 +08:00
xiaojunnuo
bee20c7f51 chore: 1 2024-08-29 11:15:45 +08:00
xiaojunnuo
b8e05e9b44 chore: 2024-08-29 10:09:22 +08:00
xiaojunnuo
869e14bad9 pref: 自动优化数据库,释放被删除空间 2024-08-29 09:57:27 +08:00
xiaojunnuo
952e01ab7d chore: 2024-08-28 14:45:57 +08:00
xiaojunnuo
db61033633 perf: 优化内存占用 2024-08-28 14:40:50 +08:00
xiaojunnuo
42a56b581d perf: 授权配置支持加密
原本已经添加的授权配置,再次编辑保存即变成加密配置
2024-08-27 13:46:19 +08:00
xiaojunnuo
d6bb9f6af4 chore: 2024-08-26 12:37:42 +08:00
xiaojunnuo
a430b27034 chore: 2024-08-26 12:32:36 +08:00
xiaojunnuo
0f6679425f fix: 修复在没有勾选使用代理的情况下,仍然会使用代理的bug 2024-08-26 11:34:01 +08:00
xiaojunnuo
4b9d1eb4b5 chore: 2024-08-26 11:06:46 +08:00
xiaojunnuo
ca4a1b8d92 chore: 2024-08-26 11:06:28 +08:00
xiaojunnuo
08a702a758 chore: 2024-08-26 10:19:06 +08:00
xiaojunnuo
589191244f chore: 2024-08-26 10:09:53 +08:00
xiaojunnuo
f3ddcd3054 Merge remote-tracking branch 'origin/v2' into v2 2024-08-26 09:59:10 +08:00
xiaojunnuo
f923655d91 chore: 2024-08-26 09:58:51 +08:00
xiaojunnuo
879e2609ca chore: 2024-08-25 15:35:04 +08:00
xiaojunnuo
d227dd64e3 chore: 2024-08-25 15:34:00 +08:00
xiaojunnuo
d2997624b0 build: trigger build image 2024-08-25 14:28:10 +08:00
xiaojunnuo
f17b08ddab v1.24.0 2024-08-25 14:27:41 +08:00
xiaojunnuo
893b853fd4 build: prepare to build 2024-08-25 14:26:34 +08:00
xiaojunnuo
15846eda85 chore: 2024-08-25 12:07:47 +08:00
xiaojunnuo
19ddf61127 chore: 2024-08-25 11:57:07 +08:00
xiaojunnuo
a7424e02f5 feat: 支持ECC类型 2024-08-25 11:56:15 +08:00
xiaojunnuo
d4092e4929 chore: 1 2024-08-25 03:27:38 +08:00
xiaojunnuo
62ef54c7c3 chore: 1 2024-08-25 03:14:07 +08:00
xiaojunnuo
85ae80c882 Merge remote-tracking branch 'origin/acme_sync' into v2
# Conflicts:
#	packages/core/acme-client/package.json
2024-08-25 03:01:13 +08:00
xiaojunnuo
a593056e79 feat: 支持google证书申请(需要使用代理) 2024-08-25 02:59:49 +08:00
xiaojunnuo
22a336370a fix: 修复执行日志没有清理的bug 2024-08-25 01:55:34 +08:00
xiaojunnuo
86ebbcb9bb chore: 1 2024-08-24 23:48:26 +08:00
xiaojunnuo
c28f3cdcf7 chore: 1 2024-08-24 01:05:06 +08:00
xiaojunnuo
41b9837582 fix: 修复ssh无法连接成功,无法执行命令的bug 2024-08-24 00:00:27 +08:00
xiaojunnuo
37eb762afe fix: 修复成功后跳过之后丢失腾讯云证书id的bug 2024-08-23 23:26:31 +08:00
xiaojunnuo
3345c145b8 fix: 部署到腾讯云cdn选择证书任务步骤限制只能选证书 2024-08-23 18:02:14 +08:00
xiaojunnuo
17ead547aa fix: 修复创建流水线后立即运行时报no id错误的bug
Closes https://github.com/certd/certd/issues/135
2024-08-23 17:41:02 +08:00
xiaojunnuo
e358a88696 fix: 修复重置密码参数配置后无效的bug 2024-08-23 17:16:52 +08:00
xiaojunnuo
968c4690a0 perf: 优化证书申请成功率 2024-08-23 13:15:06 +08:00
xiaojunnuo
453f1baa0b perf: email proxy 2024-08-23 11:35:34 +08:00
xiaojunnuo
14ab93dc2f chore: 1 2024-08-21 12:38:09 +08:00
xiaojunnuo
790bf11af0 perf: 优化dnspod的token id 说明 2024-08-21 10:36:10 +08:00
xiaojunnuo
95122e2860 fix: 修复使用代理的情况下申请证书失败的bug 2024-08-21 10:34:50 +08:00
xiaojunnuo
ab7a1673ff chore: plus 2024-08-21 08:36:03 +08:00
xiaojunnuo
db9d27468e chore: license说明 2024-08-14 21:24:12 +08:00
xiaojunnuo
746bb9d385 perf: 更新k8s底层api库 2024-08-14 15:10:55 +08:00
xiaojunnuo
7b451bbf6e perf: 优化成功后跳过的提示 2024-08-13 20:30:42 +08:00
xiaojunnuo
ffc4e71783 build: trigger build image 2024-08-06 11:39:34 +08:00
xiaojunnuo
7eb6d7d053 v1.23.1 2024-08-06 11:39:21 +08:00
xiaojunnuo
93b6431369 build: prepare to build 2024-08-06 11:38:30 +08:00
xiaojunnuo
d301ac6832 chore: 2024-08-06 11:37:46 +08:00
xiaojunnuo
1af19f0ac0 perf: 优化默认值设置 2024-08-06 11:32:25 +08:00
xiaojunnuo
24c7be2c9c perf: 优化插件字段的default value 2024-08-06 11:23:23 +08:00
xiaojunnuo
c3f04a80fd chore: pg 改成bigint 2024-08-06 11:10:33 +08:00
xiaojunnuo
bf6c5d690e chore: 权益 2024-08-06 10:32:07 +08:00
xiaojunnuo
7c92762f48 chore: k8s logger 2024-08-06 10:23:09 +08:00
xiaojunnuo
efacfd6b2c chore: k8s logger 2024-08-06 10:22:28 +08:00
xiaojunnuo
93559174c7 fix: 修复模糊查询无效的bug 2024-08-06 10:12:02 +08:00
xiaojunnuo
1b0ae8654f chore: 2024-08-06 09:12:25 +08:00
xiaojunnuo
d11a19ce59 chore: 2024-08-06 09:12:14 +08:00
xiaojunnuo
9a68b0fb61 chore: 2024-08-06 09:11:31 +08:00
xiaojunnuo
79bbdce1e1 chore: 2024-08-06 09:04:38 +08:00
xiaojunnuo
916ee4a089 chore: 2024-08-06 09:00:45 +08:00
xiaojunnuo
ac9313da38 build: trigger build image 2024-08-05 18:08:50 +08:00
xiaojunnuo
ed01ef1eb7 v1.23.0 2024-08-05 18:08:44 +08:00
xiaojunnuo
7ec2218c9f fix: 修复环境变量多个下划线不生效的bug 2024-08-05 17:47:56 +08:00
xiaojunnuo
e8ed97206b feat: use node 20 2024-08-05 16:27:01 +08:00
xiaojunnuo
c45d85e612 chore: 2024-08-05 16:24:16 +08:00
xiaojunnuo
b3ff0fd880 chore: 2024-08-05 16:19:28 +08:00
xiaojunnuo
2fbc7459e2 build: trigger build image 2024-08-05 16:10:45 +08:00
xiaojunnuo
fbf4959463 v1.22.9 2024-08-05 16:10:39 +08:00
xiaojunnuo
02bb0be06a chore: 2024-08-05 16:07:28 +08:00
xiaojunnuo
87e440ee2a perf: 优化定时任务 2024-08-05 16:00:04 +08:00
xiaojunnuo
2182dce07c chore: 修复pipelineid为空被注册任务 2024-08-05 15:08:24 +08:00
xiaojunnuo
3f0a10007c build: trigger build image 2024-08-05 13:20:09 +08:00
xiaojunnuo
67934cdebd v1.22.8 2024-08-05 13:19:57 +08:00
xiaojunnuo
6765a48706 chore: 2024-08-05 13:04:36 +08:00
xiaojunnuo
b4252033d5 perf: 优化pipeline删除时,删除其他history 2024-08-05 12:57:13 +08:00
xiaojunnuo
f78ae93eed perf: 修复删除历史记录没有删除log的bug,新增history管理页面,演示站点启动时不自动启动非管理员用户的定时任务 2024-08-05 12:49:44 +08:00
xiaojunnuo
0227155ab4 chore: 2024-08-04 22:46:08 +08:00
xiaojunnuo
330b84de33 build: trigger build image 2024-08-04 22:33:08 +08:00
xiaojunnuo
f47f86b669 v1.22.7 2024-08-04 22:32:13 +08:00
xiaojunnuo
95eeb93822 build: prepare to build 2024-08-04 22:30:36 +08:00
xiaojunnuo
367f807313 fix: 修复保存配置报id不能为空的bug 2024-08-04 22:25:51 +08:00
xiaojunnuo
a954629ff9 build: trigger build image 2024-08-04 02:55:27 +08:00
xiaojunnuo
3bbbc41062 v1.22.6 2024-08-04 02:53:50 +08:00
xiaojunnuo
bf63b0d73f build: prepare to build 2024-08-04 02:51:30 +08:00
xiaojunnuo
5362df55f4 chore: 1 2024-08-04 02:49:40 +08:00
xiaojunnuo
59897c4cea perf: 流水线支持名称模糊查询 2024-08-04 02:35:45 +08:00
xiaojunnuo
a9717b9a0d fix: 修复pg下pipeline title 类型问题 2024-08-04 00:04:55 +08:00
xiaojunnuo
680941af11 fix: 修复在相同的cron时偶尔无法触发定时任务的bug 2024-08-03 23:32:50 +08:00
xiaojunnuo
1cf8d4e5e7 chore: 2024-08-02 23:59:08 +08:00
xiaojunnuo
70ce6be0bf chore: 单元测试 2024-08-02 22:58:29 +08:00
xiaojunnuo
9187e87419 chore: 2024-08-02 09:29:26 +08:00
xiaojunnuo
6ed1e18c7d perf: 优化前置任务输出为空的提示 2024-08-02 09:26:54 +08:00
xiaojunnuo
8d27f07213 Merge remote-tracking branch 'origin/v2' into v2 2024-07-31 14:01:30 +08:00
xiaojunnuo
e4f4570b29 perf: 腾讯云clb支持更多大区选择 2024-07-31 14:01:06 +08:00
xiaojunnuo
d86fc9569a chore: 增加dns地址配置 2024-07-31 13:46:48 +08:00
xiaojunnuo
fa7a983bcb chore: 2024-07-26 23:48:15 +08:00
xiaojunnuo
9ac908ebee chore: 2024-07-26 23:44:57 +08:00
xiaojunnuo
6e594ee66e chore: 2024-07-26 23:43:41 +08:00
xiaojunnuo
c26d3e9c38 chore: 2024-07-26 23:38:51 +08:00
xiaojunnuo
5db5607faa chore: 2024-07-26 23:36:33 +08:00
xiaojunnuo
728f27e0a0 build: trigger build image 2024-07-26 23:16:17 +08:00
xiaojunnuo
3d8f329e2d v1.22.5 2024-07-26 23:15:20 +08:00
xiaojunnuo
351fb70d5d build: prepare to build 2024-07-26 23:14:05 +08:00
xiaojunnuo
b5cbeb9bde chore: 2024-07-26 23:13:50 +08:00
xiaojunnuo
e7e89b8de7 fix: 修复用户管理无法添加用户的bug 2024-07-26 23:07:01 +08:00
xiaojunnuo
225894d15c chore: 2024-07-26 22:48:18 +08:00
xiaojunnuo
64ba485b0f chore: 2024-07-26 22:46:05 +08:00
xiaojunnuo
3a666db36c chore: 2024-07-26 22:16:24 +08:00
xiaojunnuo
ce7e5a2461 chore: 2024-07-26 22:13:49 +08:00
xiaojunnuo
b22f94b079 chore: 2024-07-26 22:11:41 +08:00
xiaojunnuo
3408465df6 chore: 2024-07-26 22:01:42 +08:00
xiaojunnuo
e97dfb456b chore: 2024-07-26 21:42:52 +08:00
xiaojunnuo
439c6c8b6c chore: 2024-07-26 21:42:25 +08:00
xiaojunnuo
afa2b0307a chore: 2024-07-26 21:40:32 +08:00
xiaojunnuo
56867fa777 chore: 2024-07-26 21:37:34 +08:00
xiaojunnuo
9c2e33fa39 chore: 2024-07-26 21:36:25 +08:00
xiaojunnuo
2ca72f838b chore: 2024-07-26 20:56:48 +08:00
xiaojunnuo
37a9e6aae0 v1.22.4 2024-07-26 20:56:06 +08:00
xiaojunnuo
6a8a02dae5 build: prepare to build 2024-07-26 20:55:02 +08:00
xiaojunnuo
eaee5db69e Merge remote-tracking branch 'origin/v2' into v2 2024-07-26 20:54:24 +08:00
xiaojunnuo
25d06904c6 build: prepare to build 2024-07-26 20:54:11 +08:00
xiaojunnuo
fa14f87a80 perf: 支持arm64 2024-07-26 20:53:59 +08:00
xiaojunnuo
4404f99642 Merge remote-tracking branch 'origin/v2' into v2 2024-07-26 09:47:38 +08:00
xiaojunnuo
bafab905b4 chore: 2024-07-25 23:53:00 +08:00
xiaojunnuo
44d5e54550 chore: 2024-07-25 23:42:25 +08:00
xiaojunnuo
a23c13d7d9 chore: 2024-07-25 23:41:19 +08:00
xiaojunnuo
17a7a1432f chore: 2024-07-25 23:38:51 +08:00
xiaojunnuo
26e8932b85 chore: 2024-07-25 23:37:49 +08:00
xiaojunnuo
32beb02d40 chore: 2024-07-25 23:35:34 +08:00
xiaojunnuo
af7177e6bb chore: 2024-07-25 23:29:17 +08:00
xiaojunnuo
69ac0fd0a8 chore: 1.22.3 2024-07-25 23:17:51 +08:00
xiaojunnuo
e0998f35e8 chore: 1.22.3 2024-07-25 23:09:13 +08:00
xiaojunnuo
6d371b38c3 chore: 1.22.3 2024-07-25 23:01:20 +08:00
xiaojunnuo
587f11138a chore: 1.22.3 2024-07-25 22:38:01 +08:00
xiaojunnuo
aa936c279e v1.22.3 2024-07-25 22:34:00 +08:00
xiaojunnuo
5b11d351b2 build: prepare to build 2024-07-25 22:32:48 +08:00
xiaojunnuo
b45b97d3c6 chore: 2024-07-25 22:32:15 +08:00
xiaojunnuo
338eb3bdfe fix: lege 无执行权限问题 2024-07-25 22:25:34 +08:00
Greper
f059e91efc fix: 修复可选链问题导致的响应错误输出报错
修复可选链问题导致的响应错误输出报错
2024-07-25 18:52:17 +08:00
ltxhhz
1cdf1c433f 7.25 patch 2024-07-25 18:13:17 +08:00
xiaojunnuo
a7b8bac4c8 chore: 2024-07-25 11:17:44 +08:00
xiaojunnuo
b7b5df0587 perf: 证书申请支持反向代理,letsencrypt无法访问时的备用方案 2024-07-25 10:38:45 +08:00
xiaojunnuo
4060f6ecbc Merge remote-tracking branch 'origin/v2' into v2
# Conflicts:
#	.github/workflows/build-image.yml
#	build.trigger
2024-07-24 10:55:21 +08:00
xiaojunnuo
7cb5f21444 chore: 2024-07-24 02:29:53 +08:00
xiaojunnuo
e5da46cfc3 v1.22.2 2024-07-24 02:25:12 +08:00
xiaojunnuo
eabb3e38b5 chore: 2024-07-24 02:24:37 +08:00
xiaojunnuo
46140c8efa build: prepare to build 2024-07-24 02:24:04 +08:00
xiaojunnuo
95d071ba56 chore: 2024-07-24 02:23:09 +08:00
xiaojunnuo
3c9c3ca3b0 build: prepare to build 2024-07-24 02:19:05 +08:00
xiaojunnuo
e7c4ade57d build: prepare to build 2024-07-24 02:18:13 +08:00
xiaojunnuo
ca524657b6 build: prepare to build 2024-07-24 02:17:12 +08:00
xiaojunnuo
bc02559bc7 chore: 2024-07-24 02:17:06 +08:00
xiaojunnuo
741172fd98 chore: 2024-07-24 02:16:12 +08:00
xiaojunnuo
83d0209775 chore: 2024-07-24 02:11:38 +08:00
xiaojunnuo
6693d1acfb chore: 2024-07-24 00:42:50 +08:00
xiaojunnuo
a2c43b50a6 fix: 修复创建流水线时,无法根据dns类型默认正确的dns授权的bug
Closes https://github.com/certd/certd/issues/97
2024-07-24 00:42:33 +08:00
xiaojunnuo
f7fc06e657 chore: 2024-07-23 23:39:13 +08:00
xiaojunnuo
b9fe3b9c87 chore: github action build image 2024-07-23 23:23:45 +08:00
xiaojunnuo
06be993afc chore: github action build image 2024-07-23 23:16:55 +08:00
xiaojunnuo
b6ef39fb30 chore: github action build image 2024-07-23 23:12:50 +08:00
xiaojunnuo
0b131c00ed chore: github action build image 2024-07-23 23:06:11 +08:00
xiaojunnuo
b6b8661c36 chore: github action build image 2024-07-23 23:03:15 +08:00
xiaojunnuo
7bf19f8f6f chore: github action build image 2024-07-23 23:00:56 +08:00
xiaojunnuo
c9d9c6513b chore: github action build image 2024-07-23 22:59:23 +08:00
xiaojunnuo
4e7b7ae974 chore: github action build image 2024-07-23 22:57:55 +08:00
xiaojunnuo
dfcabc02a4 chore: github action build image 2024-07-23 22:56:16 +08:00
xiaojunnuo
6f2c5674c9 chore: github action build image 2024-07-23 22:54:23 +08:00
xiaojunnuo
2877b9b505 chore: github action build image 2024-07-23 22:52:56 +08:00
xiaojunnuo
e40bb9e14d chore: github action build image 2024-07-23 22:50:15 +08:00
xiaojunnuo
d456ff9830 chore: github action build image 2024-07-23 22:48:30 +08:00
xiaojunnuo
ffddb3b4ac chore: github action build image 2024-07-23 22:40:05 +08:00
xiaojunnuo
a6113f237b chore: 2024-07-23 22:38:38 +08:00
xiaojunnuo
093520b686 chore: 2024-07-23 22:37:32 +08:00
xiaojunnuo
3a8d44b8e9 chore: github action build 2024-07-23 13:38:52 +08:00
xiaojunnuo
72bff652f7 chore: github action build 2024-07-23 13:30:36 +08:00
xiaojunnuo
9559bdf817 chore: github action build 2024-07-23 13:27:17 +08:00
xiaojunnuo
5a88b8c24e chore: github action build 2024-07-23 12:44:42 +08:00
xiaojunnuo
a9ebac82c7 chore: github action build 2024-07-23 12:43:10 +08:00
xiaojunnuo
cfd8836083 chore: github action build 2024-07-23 12:42:48 +08:00
xiaojunnuo
e01e59b188 chore: github action build 2024-07-23 12:41:36 +08:00
xiaojunnuo
d2fd729961 chore: github action build 2024-07-23 12:40:36 +08:00
xiaojunnuo
5d4ff2e3b7 chore: github action build 2024-07-23 12:39:03 +08:00
xiaojunnuo
6e5133f6b8 chore: github action build 2024-07-23 12:37:21 +08:00
xiaojunnuo
a96d5839b2 chore: github action build 2024-07-23 12:35:24 +08:00
xiaojunnuo
a827bc306a chore: 2024-07-21 03:21:51 +08:00
xiaojunnuo
d8b3d7a6e0 v1.22.1 2024-07-21 03:11:54 +08:00
xiaojunnuo
b8f072909b build: prepare to build 2024-07-21 03:10:14 +08:00
xiaojunnuo
fa48f2b2f0 build: prepare to build 2024-07-21 03:07:32 +08:00
xiaojunnuo
019a1fe24e chore: 2024-07-21 03:02:13 +08:00
xiaojunnuo
427620d34f perf: 创建证书任务增加定时任务和邮件通知输入 2024-07-21 02:59:02 +08:00
xiaojunnuo
a5a0c1f6e7 perf: 支持配置启动后自动触发一次任务 2024-07-21 02:32:03 +08:00
xiaojunnuo
affef13037 perf: 创建证书任务可以选择lege插件 2024-07-21 02:26:03 +08:00
xiaojunnuo
4afbf20c1a chore: 重构image build 2024-07-20 19:38:15 +08:00
xiaojunnuo
0ef7b036dd chore: 1 2024-07-20 19:27:07 +08:00
xiaojunnuo
17ef7b8b9e chore: 1 2024-07-20 19:25:54 +08:00
xiaojunnuo
15eba52fad chore: 1 2024-07-20 19:25:45 +08:00
xiaojunnuo
f2d894b036 chore: 1 2024-07-20 18:39:51 +08:00
xiaojunnuo
d9da27710e chore: 1 2024-07-20 18:33:11 +08:00
xiaojunnuo
981bff70c3 chore: 1 2024-07-20 18:28:19 +08:00
xiaojunnuo
bb30d6e02f chore: 1 2024-07-20 18:18:34 +08:00
xiaojunnuo
b09ccda54d chore: 1 2024-07-20 18:17:48 +08:00
xiaojunnuo
a5de8d79ec chore: 1 2024-07-20 18:11:56 +08:00
xiaojunnuo
a092a1e843 chore: 1 2024-07-20 18:11:38 +08:00
xiaojunnuo
1c6740feff chore: sqlite换成better-sqlite 2024-07-20 18:07:32 +08:00
xiaojunnuo
79c6e05e02 chore: sqlite换成better-sqlite 2024-07-20 18:04:07 +08:00
xiaojunnuo
31e2085c16 chore: 1 2024-07-20 17:53:19 +08:00
xiaojunnuo
64fda2f1a0 chore: 1 2024-07-20 17:35:07 +08:00
xiaojunnuo
a674719a8b chore: 1 2024-07-20 17:27:12 +08:00
xiaojunnuo
2f7ef0620b chore: 1 2024-07-20 14:27:41 +08:00
xiaojunnuo
153e98b593 chore: 1 2024-07-20 14:26:01 +08:00
xiaojunnuo
d62ea41671 chore: 1 2024-07-20 10:17:38 +08:00
xiaojunnuo
8fcd9813d3 chore: 1 2024-07-20 10:11:05 +08:00
xiaojunnuo
dcbf8c85dd chore: 1 2024-07-20 10:09:18 +08:00
xiaojunnuo
ea0eafdb16 chore: 1 2024-07-20 10:05:39 +08:00
xiaojunnuo
eda89a057a chore: 1 2024-07-20 09:22:20 +08:00
xiaojunnuo
21e6eef1d3 chore: mv libs 2024-07-19 18:08:51 +08:00
xiaojunnuo
54a27c1840 chore: mv libs 2024-07-19 17:22:54 +08:00
xiaojunnuo
a3be0a1618 chore: 1 2024-07-19 16:01:55 +08:00
xiaojunnuo
8e19e44f4c chore: 1 2024-07-19 15:44:10 +08:00
xiaojunnuo
e5d93bd114 chore: 1 2024-07-19 15:41:36 +08:00
xiaojunnuo
47fe3d5826 v1.22.0 2024-07-19 15:28:41 +08:00
xiaojunnuo
8409f5fd4a build: prepare to build 2024-07-19 15:27:50 +08:00
xiaojunnuo
634a468ec4 build: prepare to build 2024-07-19 15:26:29 +08:00
xiaojunnuo
7ed0544664 build: prepare to build 2024-07-19 15:23:59 +08:00
xiaojunnuo
3d4a046634 build: prepare to build 2024-07-19 15:20:13 +08:00
xiaojunnuo
96954b4aaa chore: 1 2024-07-19 15:15:35 +08:00
xiaojunnuo
d77fc11552 chore: 1 2024-07-19 15:14:03 +08:00
xiaojunnuo
5bad0bbde8 build: prepare to build 2024-07-19 15:13:46 +08:00
xiaojunnuo
cd85ac611b build: prepare to build 2024-07-19 15:03:40 +08:00
xiaojunnuo
0bc6d0a211 feat: 支持lego,海量DNS提供商 2024-07-18 21:10:13 +08:00
xiaojunnuo
b1cd055342 chore: lfs 2024-07-18 21:09:22 +08:00
xiaojunnuo
303097b835 chore: 1 2024-07-18 11:17:13 +08:00
xiaojunnuo
a438028002 chore: 1 2024-07-17 13:14:49 +08:00
GitHub Actions Bot
e5edfbfa6d 🔱: [acme] sync upgrade with 6 commits [trident-sync]
Bump v5.4.0
Bump dependencies
Retry HTTP requests on server errors or when rate limited
Forgot to refresh directory timestamp after successful get
Add utility method tests
2024-07-16 19:24:08 +00:00
xiaojunnuo
4813872bcc chore: 1 2024-07-17 01:33:55 +08:00
xiaojunnuo
3b19bfb429 feat: 支持postgresql 2024-07-17 01:30:00 +08:00
Greper
a917a7bca6 Merge pull request #93 from certd/acme_sync
[acme] sync upgrade [trident-sync]
2024-07-16 03:24:25 +08:00
GitHub Actions Bot
86e64af35c 🔱: [acme] sync upgrade with 5 commits [trident-sync]
Temp remove Node v22 from matrix, broke CNAME tests
Invalidate ACME directory cache after 24 hours
Directory URLs for Google ACME provider
Bump Pebble v2.6.0
2024-07-15 19:24:17 +00:00
xiaojunnuo
bf6f1d8137 chore: 2024-07-15 02:13:53 +08:00
xiaojunnuo
b1688525db perf: 优化一些小细节 2024-07-15 02:05:26 +08:00
xiaojunnuo
2fd14430a2 Merge remote-tracking branch 'origin/v2' into v2
# Conflicts:
#	package.json
#	packages/core/pipeline/package.json
#	packages/libs/k8s/package.json
#	packages/plugins/plugin-cert/package.json
#	packages/ui/certd-server/package.json
#	packages/ui/certd-server/src/plugins/plugin-host/lib/ssh.ts
#	packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts
2024-07-15 01:33:04 +08:00
xiaojunnuo
bd3d959944 perf: 增加备案号设置 2024-07-15 01:29:35 +08:00
xiaojunnuo
390e4853a5 perf: 自动生成jwtkey,无需手动配置 2024-07-15 01:29:19 +08:00
xiaojunnuo
485e603b51 feat: 升级midway,支持esm 2024-07-15 00:30:33 +08:00
Greper
3ccd7ad95d Merge pull request #89 from certd/client_sync
[client] sync upgrade [trident-sync]
2024-07-13 03:23:54 +08:00
GitHub Actions Bot
54d9050483 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 优化editorwang示例
2024-07-12 19:23:47 +00:00
Greper
6d58c68e9b Merge pull request #87 from certd/client_sync
[client] sync upgrade [trident-sync]
2024-07-12 03:23:58 +08:00
GitHub Actions Bot
80019d4dc1 🔱: [client] sync upgrade with 3 commits [trident-sync]
docs: 1
docs: 1
2024-07-11 19:23:48 +00:00
xiaojunnuo
031df8fc35 v1.21.2 2024-07-08 15:58:51 +08:00
xiaojunnuo
62419a8212 build: prepare to build 2024-07-08 15:57:13 +08:00
xiaojunnuo
09d93af853 build: prepare to build 2024-07-08 15:47:51 +08:00
xiaojunnuo
b6ab178de9 chore: 1 2024-07-08 15:47:36 +08:00
xiaojunnuo
5a08f27d2c build: prepare to build 2024-07-08 15:36:18 +08:00
xiaojunnuo
fe91d94090 perf: 申请证书时可以选择跳过本地dns校验 2024-07-08 15:35:58 +08:00
xiaojunnuo
56ab3269d2 chore: 1 2024-07-08 12:05:56 +08:00
xiaojunnuo
c8243c573f chore: 1 2024-07-08 12:04:59 +08:00
xiaojunnuo
0b769a1c86 v1.21.1 2024-07-08 11:58:09 +08:00
xiaojunnuo
a8189a974d build: prepare to build 2024-07-08 11:46:13 +08:00
xiaojunnuo
322875d241 chore: 1 2024-07-08 11:45:31 +08:00
xiaojunnuo
ed8a54a2bc chore: 1 2024-07-08 11:29:11 +08:00
xiaojunnuo
5ba9831ed1 perf: 上传到主机,支持设置不mkdirs 2024-07-08 11:19:02 +08:00
xiaojunnuo
f9c9fce581 docs: 1 2024-07-08 11:10:08 +08:00
xiaojunnuo
bc650a32cd docs: 1 2024-07-08 10:59:19 +08:00
xiaojunnuo
c6d3e3fe5b docs: 1 2024-07-08 10:57:42 +08:00
xiaojunnuo
73acc62af1 docs: 1 2024-07-08 10:56:19 +08:00
xiaojunnuo
0d4491f3a0 docs: 1 2024-07-08 10:55:55 +08:00
xiaojunnuo
85248044ab docs: 1 2024-07-08 10:53:55 +08:00
xiaojunnuo
c532449102 docs: 1 2024-07-05 10:56:29 +08:00
xiaojunnuo
970c7fd8a0 perf: 说明优化,默认值优化 2024-07-04 02:22:52 +08:00
xiaojunnuo
4656019898 v1.21.0 2024-07-04 01:15:51 +08:00
xiaojunnuo
7eceabb2d8 build: prepare to build 2024-07-04 01:14:33 +08:00
xiaojunnuo
eade2c2b68 feat: 支持zero ssl 2024-07-04 01:14:09 +08:00
xiaojunnuo
6ec950818c v1.20.17 2024-07-03 23:45:57 +08:00
xiaojunnuo
7058b20df4 build: prepare to build 2024-07-03 23:43:55 +08:00
xiaojunnuo
a09b0e48c1 perf: 文件上传提示由cert.crt改为cert.pem 2024-07-03 23:39:12 +08:00
xiaojunnuo
664bb66a91 Merge branch 'client_sync' into v2
# Conflicts:
#	packages/ui/certd-client/CHANGELOG.md
#	packages/ui/certd-client/package.json
2024-07-03 23:37:08 +08:00
xiaojunnuo
eba333de7a perf: 优化cname verify 2024-07-03 23:36:06 +08:00
xiaojunnuo
f47b35f6d5 perf: 创建dns解析后,强制等待60s 2024-07-03 23:27:35 +08:00
Greper
c04707c0f7 fix: 修复对Windows powershell 的支持
修复对Windows powershell 的支持 #73
2024-07-03 23:22:29 +08:00
ltxhhz
22ebcd4dd1 fixed #73 2024-07-03 18:30:38 +08:00
xiaojunnuo
d46dab4fdd v1.20.16 2024-07-02 00:36:55 +08:00
xiaojunnuo
d44849c53c build: prepare to build 2024-07-02 00:35:41 +08:00
xiaojunnuo
dbc5a3c6b3 docs: 1 2024-07-02 00:33:21 +08:00
xiaojunnuo
4a5fa767ed fix: 修复配置了cdn cname后申请失败的bug 2024-07-02 00:18:28 +08:00
xiaojunnuo
1b7debc6a4 Merge remote-tracking branch 'origin/acme_sync' into v2
# Conflicts:
#	packages/core/acme-client/package.json
#	packages/core/acme-client/src/auto.js
#	packages/core/acme-client/src/axios.js
#	packages/core/acme-client/src/http.js
2024-07-01 23:09:57 +08:00
xiaojunnuo
19a6b94680 v1.20.15 2024-06-28 16:06:55 +08:00
xiaojunnuo
65a72b8d60 build: prepare to build 2024-06-28 14:27:19 +08:00
xiaojunnuo
7f61cab101 perf: 支持windows文件上传 2024-06-27 16:38:43 +08:00
GitHub Actions Bot
692e2b5b96 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 增加示例,FsInDrawer
2024-06-26 19:24:03 +00:00
xiaojunnuo
37caef38ad chore: 1 2024-06-26 19:07:37 +08:00
xiaojunnuo
9cc01db1d5 fix: 修复无法强制取消任务的bug 2024-06-26 19:05:35 +08:00
xiaojunnuo
9172440f79 chore: 1 2024-06-26 18:37:36 +08:00
xiaojunnuo
e0eb3a4413 perf: 腾讯云dns provider 支持腾讯云的accessId 2024-06-26 18:36:11 +08:00
xiaojunnuo
ae0f16bf35 chore: doc 2024-06-26 13:58:17 +08:00
xiaojunnuo
6c9ed162e3 chore: doc 2024-06-26 13:48:22 +08:00
xiaojunnuo
3849b52cdf chore: ssh优化 2024-06-25 12:28:37 +08:00
xiaojunnuo
9ecfcb5814 chore: ssh优化 2024-06-25 12:25:57 +08:00
xiaojunnuo
54ad09f755 chore: 1 2024-06-25 11:27:13 +08:00
xiaojunnuo
6ee4dc165b chore: 1 2024-06-25 11:22:11 +08:00
xiaojunnuo
8e2eb89696 chore: 1 2024-06-25 11:22:02 +08:00
xiaojunnuo
9d397cc8be chore: 1 2024-06-25 11:02:29 +08:00
xiaojunnuo
cbfb0755b3 chore: 1 2024-06-25 10:52:58 +08:00
xiaojunnuo
d8d127ee9d chore: 1 2024-06-24 09:59:14 +08:00
xiaojunnuo
0ed5430e80 chore: 1 2024-06-24 09:54:41 +08:00
xiaojunnuo
878c1f52fa chore: 1 2024-06-24 09:53:21 +08:00
GitHub Actions Bot
586d23fc55 🔱: [client] sync upgrade with 6 commits [trident-sync]
build: publish success
fix: 修复多级表头时列设置的问题

https://github.com/fast-crud/fast-crud/issues/175
chore: 1
fix: 修复element示例中远程搜索下拉框label不显示的bug

https://github.com/fast-crud/fast-crud/issues/422
fix: 修复独立使用对话框 openDialog方法await无返回值的bug
2024-06-23 19:23:47 +00:00
xiaojunnuo
6900452b49 v1.20.14 2024-06-24 01:05:48 +08:00
xiaojunnuo
b97e0e512d build: prepare to build 2024-06-24 01:04:25 +08:00
xiaojunnuo
f740ff517f fix: 修复修改密码功能异常问题 2024-06-24 01:04:03 +08:00
xiaojunnuo
e5989fe023 v1.20.13 2024-06-19 00:56:42 +08:00
xiaojunnuo
4323156fbe build: prepare to build 2024-06-19 00:54:13 +08:00
xiaojunnuo
3c721901c5 chore: 1 2024-06-19 00:53:53 +08:00
xiaojunnuo
5c2c50839a perf: ssh登录支持openssh格式私钥、支持私钥密码 2024-06-19 00:21:13 +08:00
xiaojunnuo
fd54c2ffac perf: 增加警告,修复一些样式错乱问题 2024-06-19 00:20:35 +08:00
xiaojunnuo
7e483e6091 fix: 修复logo问题 2024-06-19 00:19:48 +08:00
xiaojunnuo
80c48e9acd Merge remote-tracking branch 'origin/v2' into v2 2024-06-18 23:50:04 +08:00
xiaojunnuo
b98f1c0dd0 fix: 修复邮箱设置页面SMTP拼写错误的问题
https://github.com/certd/certd/issues/69
2024-06-18 23:09:32 +08:00
Greper
b53874a0b8 fix: 日志高度越界
fix: 日志高度越界
2024-06-18 23:07:55 +08:00
shenan
c4c9adb8bf fix: 日志高度越界 2024-06-18 11:46:54 +08:00
xiaojunnuo
eed265faf1 v1.20.12 2024-06-17 23:10:07 +08:00
xiaojunnuo
3dc6dd403d build: prepare to build 2024-06-17 23:08:33 +08:00
xiaojunnuo
deb9ba0c43 chore: 1 2024-06-16 02:56:49 +08:00
xiaojunnuo
fa33ff499d Merge branch 'client_sync' into v2
# Conflicts:
#	packages/ui/certd-client/.env
#	packages/ui/certd-client/CHANGELOG.md
#	packages/ui/certd-client/index.html
#	packages/ui/certd-client/package.json
#	packages/ui/certd-client/public/images/logo/rect-black.svg
#	packages/ui/certd-client/public/images/logo/square.svg
#	packages/ui/certd-client/src/layout/components/theme/index.vue
#	packages/ui/certd-client/src/layout/layout-framework.vue
#	packages/ui/certd-client/src/layout/layout-outside.vue
#	packages/ui/certd-client/src/main.ts
#	packages/ui/certd-client/src/plugin/fast-crud/index.tsx
#	packages/ui/certd-client/src/router/source/header.ts
#	packages/ui/certd-client/src/store/modules/settings.ts
#	packages/ui/certd-client/src/style/common.less
#	packages/ui/certd-client/src/views/crud/form/independent/index.vue
#	packages/ui/certd-client/src/views/framework/login/index.vue
#	packages/ui/certd-client/src/views/framework/register/index.vue
#	packages/ui/certd-client/vite.config.ts
2024-06-16 02:47:41 +08:00
xiaojunnuo
2ed4967744 chore: 1 2024-06-16 02:36:22 +08:00
GitHub Actions Bot
ad360e81cb 🔱: [client] sync upgrade with 21 commits [trident-sync]
perf: 优化antdv4 示例授权页面tree的样式
build: publish success
chore: 1
chore: 1
chore: 1
fix: getFileName支持item参数

https://github.com/fast-crud/fast-crud/issues/385
fix: fs-form独立使用支持插槽

https://github.com/fast-crud/fast-crud/issues/389
fix: 修复三级以上路由页面无法缓存的问题

https://github.com/fast-crud/fast-crud/issues/394
perf: form.wrapper.buttons支持compute动态计算
feat: 表单支持变更关闭前提醒保存,form.wrapper支持beforeClose事件
fix: 修复图片裁剪按钮上下和左右相反的bug

https://github.com/fast-crud/fast-crud/issues/402
perf: alioss getAuthorization接口支持后台返回key

https://github.com/fast-crud/fast-crud/issues/405
perf: alioss getAuthorization接口支持后台返回key

https://github.com/fast-crud/fast-crud/issues/405
perf: fs-dict-tree支持插槽

https://github.com/fast-crud/fast-crud/issues/407
perf: 单选、多选、select、tree-select、table-select 都提供selected-change事件,可以获取选中的dict选项
feat: table-select 支持查看模式

https://github.com/fast-crud/fast-crud/issues/413
perf: 优化fs-admin可以在手机上操作
chore: pnpm workspace问题优化
docs: 1
chore: antdv4 支持主题色选择
...
2024-06-15 18:32:36 +00:00
xiaojunnuo
f95f5188b4 Merge remote-tracking branch 'origin/client_sync' into v2
# Conflicts:
#	packages/ui/certd-client/CHANGELOG.md
#	packages/ui/certd-client/package.json
2024-06-16 02:15:46 +08:00
xiaojunnuo
17d1efa395 chore: 1 2024-06-16 02:12:02 +08:00
xiaojunnuo
732cbc5e92 perf: 支持重置管理员密码,忘记密码的补救方案 2024-06-16 02:06:44 +08:00
xiaojunnuo
5d2d0955b1 docs: 1 2024-06-16 00:42:17 +08:00
xiaojunnuo
20feacea12 perf: 增加系统设置,可以关闭自助注册功能 2024-06-16 00:20:02 +08:00
xiaojunnuo
575bf2b73b docs: 1 2024-06-15 02:22:29 +08:00
xiaojunnuo
934e6e2bd0 perf: 增加cloudflare access token说明 2024-06-15 02:20:46 +08:00
xiaojunnuo
fbb9a47e8f perf: 支持cloudflare域名 2024-06-15 02:17:34 +08:00
xiaojunnuo
368132daae chore: 1 2024-06-14 01:26:50 +08:00
xiaojunnuo
3d54d04017 chore: 1 2024-06-14 01:25:30 +08:00
xiaojunnuo
5b1494b3ce fix: 修复aliyun域名超过100个找不到域名的bug 2024-06-14 01:22:07 +08:00
xiaojunnuo
ebf2a820cc chore: CF准备开始 2024-06-11 01:55:29 +08:00
GitHub Actions Bot
9caa4cd1d4 🔱: [client] sync upgrade with 3 commits [trident-sync]
build: publish success
fix: 修复三级以上路由页面无法缓存的问题

https://github.com/fast-crud/fast-crud/issues/394
2024-06-09 19:23:54 +00:00
GitHub Actions Bot
91fd80d44f 🔱: [client] sync upgrade with 3 commits [trident-sync]
perf: alioss getAuthorization接口支持后台返回key

https://github.com/fast-crud/fast-crud/issues/405
fix: edit-wang 改成edit-wang5

https://github.com/fast-crud/fast-crud/issues/409
2024-06-08 19:24:01 +00:00
GitHub Actions Bot
f932e553b0 🔱: [client] sync upgrade with 2 commits [trident-sync]
chore: pnpm workspace问题优化
2024-05-30 19:23:48 +00:00
xiaojunnuo
0dd4953197 chore: 1.20.11 2024-05-30 14:55:31 +08:00
xiaojunnuo
aaea6aa1f3 chore: 1.20.11 2024-05-30 14:41:29 +08:00
xiaojunnuo
ab4a0aea70 chore: 1.20.11 2024-05-30 14:27:43 +08:00
xiaojunnuo
29f923537e chore: 1.20.10 2024-05-30 14:26:44 +08:00
xiaojunnuo
24aa416740 chore: 1.20.10 2024-05-30 14:17:43 +08:00
xiaojunnuo
08e517ff00 chore: 1.20.10 2024-05-30 13:59:27 +08:00
xiaojunnuo
29f65389bd chore: 1.20.10 2024-05-30 13:59:05 +08:00
xiaojunnuo
960a1964c7 chore: 1.20.10 2024-05-30 13:52:24 +08:00
xiaojunnuo
760d54ba85 chore: 1.20.10 2024-05-30 12:23:36 +08:00
xiaojunnuo
b1b21d3efc chore: 1.20.10 2024-05-30 12:23:09 +08:00
xiaojunnuo
5acd7f6fb6 chore: 1.20.10 2024-05-30 12:03:59 +08:00
xiaojunnuo
a31f1c7f5e v1.20.10 2024-05-30 11:39:05 +08:00
xiaojunnuo
660ae7333b build: prepare to build 2024-05-30 11:37:51 +08:00
xiaojunnuo
6cf699b25f chore: 1 2024-05-30 11:37:45 +08:00
xiaojunnuo
7e5dea51a5 build: prepare to build 2024-05-30 11:36:26 +08:00
xiaojunnuo
92446c3399 perf: 上传到主机插件支持复制到本机路径 2024-05-30 10:54:18 +08:00
xiaojunnuo
d9eb927b0a perf: 优化文件下载包名 2024-05-30 10:12:48 +08:00
xiaojunnuo
39ad7597fa perf: 增加任务复制功能 2024-05-28 17:07:20 +08:00
xiaojunnuo
83d1bda56a pref: 调整插件目录,增加一些帮助说明 2024-05-27 18:39:47 +08:00
xiaojunnuo
20bc5aa6c7 pref: 调整插件目录,增加一些帮助说明 2024-05-27 18:38:41 +08:00
GitHub Actions Bot
162e10909b 🔱: [acme] sync upgrade with 7 commits [trident-sync]
Small crypto docs fix 2
Small crypto docs fix
Bump v5.3.1
Discourage use of cert subject common name, examples and docs
Style refactor docs and examples
Bump dependencies
2024-05-23 19:24:12 +00:00
GitHub Actions Bot
0f1ae6ccd9 🔱: [acme] sync upgrade with 3 commits [trident-sync]
Clean up eslintrc, style refactor and formatting fixes
Update auto.js

see https://github.com/publishlab/node-acme-client/issues/88#issuecomment-2105255828
2024-05-22 19:24:07 +00:00
Greper
dd730f6beb Merge pull request #51 from certd/acme_sync
[acme] sync upgrade [trident-sync]
2024-05-22 03:24:13 +08:00
GitHub Actions Bot
c9d5cda953 🔱: [acme] sync upgrade with 7 commits [trident-sync]
Add Node v22 to test matrix
Postpone Pebble bump, v2.5.1 broke EAB tests
Bump Pebble v2.5.1
Allow client.auto() being called with an empty CSR common name
Carry EAB over to new HttpClient when updating account key
Ignore actrc
2024-05-21 19:24:05 +00:00
GitHub Actions Bot
33fb1a6bf3 🔱: [client] sync upgrade with 2 commits [trident-sync]
docs: 修改依赖增加workspace:
2024-05-10 19:23:53 +00:00
xiaojunnuo
a1344245cd chore: 2024-04-15 13:53:05 +08:00
xiaojunnuo
fe2ca6bed3 chore: 2024-04-08 10:13:34 +08:00
xiaojunnuo
19a3c7874a Merge remote-tracking branch 'origin/v2' into v2 2024-04-08 10:09:04 +08:00
xiaojunnuo
83e40836eb fix: 增加权限相关helper说明 2024-04-08 10:07:36 +08:00
xiaojunnuo
4304c9443a fix: 增加权限相关helper说明 2024-04-08 10:05:11 +08:00
xiaojunnuo
b72f8e796c chore: 2024-03-22 13:14:29 +08:00
xiaojunnuo
7c15f52368 chore: 2024-03-22 12:00:51 +08:00
xiaojunnuo
adf569eb62 v1.20.9 2024-03-22 11:29:56 +08:00
xiaojunnuo
340801e743 build: prepare to build 2024-03-22 11:26:51 +08:00
xiaojunnuo
80f96b5b26 v1.20.8 2024-03-22 11:22:58 +08:00
xiaojunnuo
6646ec888f build: prepare to build 2024-03-22 11:19:03 +08:00
xiaojunnuo
e6cab51031 chore: 2024-03-22 11:18:51 +08:00
xiaojunnuo
3449a4d6af v1.20.7 2024-03-22 10:35:05 +08:00
xiaojunnuo
588de02be6 build: prepare to build 2024-03-22 10:30:53 +08:00
xiaojunnuo
422e011d31 chore: 2024-03-22 10:30:37 +08:00
GitHub Actions Bot
56a1f8158a 🔱: [client] sync upgrade with 3 commits [trident-sync]
build: publish success
chore:
2024-03-21 19:24:00 +00:00
xiaojunnuo
a3c375ede5 chore: 2024-03-22 02:18:47 +08:00
xiaojunnuo
754e76d9b9 chore: 2024-03-22 01:47:29 +08:00
xiaojunnuo
feb7bfc724 v1.20.6 2024-03-22 01:26:41 +08:00
xiaojunnuo
f84dc771c4 build: prepare to build 2024-03-22 01:23:32 +08:00
xiaojunnuo
d8a52c0be3 chore: 2024-03-22 01:21:42 +08:00
xiaojunnuo
b50739e064 build: prepare to build 2024-03-22 01:10:17 +08:00
xiaojunnuo
f8e320e2bd chore: 2024-03-22 01:09:27 +08:00
xiaojunnuo
bac74dc650 build: prepare to build 2024-03-22 01:05:52 +08:00
xiaojunnuo
103f28f6ba chore: 2024-03-22 01:04:45 +08:00
xiaojunnuo
72fb20abf3 perf: 插件贡献文档及示例 2024-03-22 00:50:02 +08:00
xiaojunnuo
d9efc3d4d8 chore: 2024-03-21 22:33:11 +08:00
xiaojunnuo
836d18f07e fix: 调整按钮图标到居中位置 2024-03-12 10:22:27 +08:00
xiaojunnuo
485ae3514c v1.20.5 2024-03-12 00:35:03 +08:00
xiaojunnuo
2fa6489153 build: prepare to build 2024-03-12 00:33:46 +08:00
xiaojunnuo
e02d9716f5 chore: 2024-03-12 00:33:30 +08:00
xiaojunnuo
154409b1df fix: 修复腾讯云cdn部署无法选择端点的bug
Closes https://github.com/certd/certd/issues/34
2024-03-12 00:31:16 +08:00
xiaojunnuo
98177a5b1e chore: 2024-03-08 17:44:03 +08:00
xiaojunnuo
8d44171875 chore: axios proxy问题修复 2024-03-08 17:42:47 +08:00
xiaojunnuo
5b576112d1 chore: 升级到antdv4 2024-03-08 17:07:53 +08:00
xiaojunnuo
e1b372c33b chore: 2024-03-08 16:41:15 +08:00
xiaojunnuo
ce49dce8c6 chore: 升级acme 2024-03-06 18:36:10 +08:00
xiaojunnuo
09c9b42cab Merge remote-tracking branch 'origin/acme_sync' into v2
# Conflicts:
#	packages/core/acme-client/CHANGELOG.md
#	packages/core/acme-client/package.json
#	packages/core/acme-client/src/auto.js
2024-03-06 18:35:44 +08:00
xiaojunnuo
370a12e88a chore: 1.20.4 2024-03-06 16:27:12 +08:00
xiaojunnuo
c2f1f5c549 chore: 2024-03-06 16:14:32 +08:00
xiaojunnuo
090e03fac1 chore: 2024-02-28 11:25:19 +08:00
xiaojunnuo
b745712791 v1.20.2 2024-02-28 11:17:55 +08:00
xiaojunnuo
7ee753ac85 build: prepare to build 2024-02-28 11:14:08 +08:00
xiaojunnuo
eea6b8ab5d chore: 2024-02-28 10:36:44 +08:00
xiaojunnuo
a135f5742c Merge remote-tracking branch 'origin/client_sync' into v2
# Conflicts:
#	packages/ui/certd-client/CHANGELOG.md
#	packages/ui/certd-client/package.json
2024-02-28 10:29:12 +08:00
xiaojunnuo
04adbb45d8 build: prepare to build 2024-02-28 10:25:07 +08:00
xiaojunnuo
62efb22f37 chore: 2024-02-28 10:24:37 +08:00
xiaojunnuo
5e98f05036 build: prepare to build 2024-02-28 10:23:15 +08:00
xiaojunnuo
292a7ecbe3 chore: 2024-02-28 10:23:15 +08:00
xiaojunnuo
4cea45bd87 build: prepare to build 2024-02-28 10:11:16 +08:00
xiaojunnuo
7f0b075529 chore: 2024-02-28 10:10:47 +08:00
xiaojunnuo
8c7ff5e0e8 chore: 2024-02-28 10:06:43 +08:00
xiaojunnuo
afea5a1623 build: prepare to build 2024-02-28 10:02:13 +08:00
xiaojunnuo
c60dd7f151 build: prepare to build 2024-02-28 09:49:29 +08:00
GitHub Actions Bot
92f9371156 🔱: [client] sync upgrade with 3 commits [trident-sync]
build: publish success
fix: 修复1.20.0版本子表行編輯情況下,删除无效的bug

Closes https://github.com/fast-crud/fast-crud/issues/362
2024-02-27 19:24:07 +00:00
xiaojunnuo
c5714ec6d9 chore: 2024-02-27 21:37:42 +08:00
xiaojunnuo
dd16386317 chore: 2024-02-27 21:35:22 +08:00
xiaojunnuo
7cf1f75eb9 Merge remote-tracking branch 'origin/v2' into v2 2024-02-27 21:33:58 +08:00
xiaojunnuo
cf28a00ccd Merge remote-tracking branch 'origin/v2' into v2 2024-02-27 21:32:39 +08:00
xiaojunnuo
9e48474f11 Merge remote-tracking branch 'origin/v2' into v2 2024-02-27 21:32:38 +08:00
xiaojunnuo
c327c0c995 chore: 2024-02-27 21:31:18 +08:00
xiaojunnuo
bb567da8c6 chore: 2024-02-27 21:31:17 +08:00
GitHub Actions Bot
960f61d158 🔱: [acme] sync upgrade with 3 commits [trident-sync]
Bump v5.3.0
Example for dns-01
2024-02-05 19:24:09 +00:00
GitHub Actions Bot
80cd1bfc8e 🔱: [acme] sync upgrade with 5 commits [trident-sync]
Update IETF links
Fix misc typos
Forgot SAN extension for self-signed ALPN certs
Replace jsrsasign dep with @peculiar/x509
2024-02-03 19:24:11 +00:00
GitHub Actions Bot
a6bf198604 🔱: [acme] sync upgrade with 2 commits [trident-sync]
Example for on-demand http-01
2024-02-02 19:24:16 +00:00
GitHub Actions Bot
7e8842b452 🔱: [acme] sync upgrade with 4 commits [trident-sync]
Example for on-demand tls-alpn-01
Example disclaimer, fallback cert
Replace CircleCI with GitHub Actions
2024-02-01 19:24:13 +00:00
GitHub Actions Bot
fc9e71bed2 🔱: [acme] sync upgrade with 7 commits [trident-sync]
CHANGELOG
Fix tls-alpn-01 pebble test on Node v18+
Return correct tls-alpn-01 key authorization, tests
Support tls-alpn-01 internal challenge verification
Add tls-alpn-01 challenge test server support
Add ALPN crypto utility methods
2024-01-30 19:24:20 +00:00
GitHub Actions Bot
3e3373b8c7 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2024-01-28 19:24:14 +00:00
GitHub Actions Bot
7d45db89bf 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 行编辑也支持排他式激活

Closes https://github.com/fast-crud/fast-crud/issues/332
2024-01-25 19:23:52 +00:00
GitHub Actions Bot
08c1f338d5 🔱: [acme] sync upgrade with 10 commits [trident-sync]
Bump v5.2.0 - package.json
Bump v5.2.0
yarn -> npm
CHANGELOG and tests for #76
Fix tests
Update auto.js: wait for all challenge promises before exit

Fixes #75
CHANGELOG and tests for #66
Fix lint errors
Allow self-signed or invalid certificate when evaluating verifyHttpChallenge
2024-01-22 19:24:37 +00:00
GitHub Actions Bot
18865f0931 🔱: [acme] sync upgrade with 3 commits [trident-sync]
Add https-01 challenge test server support
Inject CoreDNS into resolv.conf while testing, remove interceptor hack
2024-01-21 19:24:13 +00:00
GitHub Actions Bot
d22a25d260 🔱: [acme] sync upgrade with 10 commits [trident-sync]
Bump v5.1.0
Bump dep axios@1.6.5
Bump dep jsrsasign@11.0.0
Bump dev deps, typo in editorconfig
Replace uuid devdep with crypto.randomUUID
LICENSE, docs formatting, remove upgrade notice
Fix package.json typo
Replace deprecated dtslint with tsd, bump types
Add Node v20 to matrix, bump misc CI stuff
2024-01-20 19:24:14 +00:00
xiaojunnuo
849c145926 fix: 临时修复阿里云domainlist接口返回域名列表不全的问题,后续还需要增加翻页查询 2024-01-03 14:11:21 +08:00
xiaojunnuo
36a773df0b chore: dns 域名查询输出域名列表 2024-01-03 11:45:58 +08:00
GitHub Actions Bot
b2abf1490b 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-12-15 19:24:10 +00:00
xiaojunnuo
fd5aa63ef3 v1.2.1 2023-12-12 23:43:08 +08:00
xiaojunnuo
7e024cbcf7 build: prepare to build 2023-12-12 23:41:55 +08:00
xiaojunnuo
7050ee2354 chore: 2023-12-12 23:41:41 +08:00
xiaojunnuo
024e97d632 v1.2.0 2023-12-12 23:40:11 +08:00
xiaojunnuo
61479cd5fb build: prepare to build 2023-12-12 23:37:51 +08:00
xiaojunnuo
aaa322464d fix: 修复邮箱设置无效的bug 2023-12-12 23:35:41 +08:00
GitHub Actions Bot
02bfbd5019 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 增加formWatch示例
2023-12-06 19:24:02 +00:00
GitHub Actions Bot
282f8b4e02 🔱: [client] sync upgrade with 5 commits [trident-sync]
chore:
chore:
chore: editRequest 判断form.id不为空
chore:
2023-11-23 19:24:19 +00:00
GitHub Actions Bot
3393bde820 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-11-22 19:24:09 +00:00
GitHub Actions Bot
2277c87908 🔱: [client] sync upgrade with 2 commits [trident-sync]
chore:
2023-11-21 19:24:11 +00:00
GitHub Actions Bot
2ea0c48853 🔱: [client] sync upgrade with 8 commits [trident-sync]
build: publish success
chore:
chore:
chore:
chore:
build: publish success
chore:
2023-11-20 19:24:12 +00:00
GitHub Actions Bot
28cbefde04 🔱: [client] sync upgrade with 2 commits [trident-sync]
feat(editable): editable优化重构,分三种模式:free、row、cell
2023-11-19 19:24:08 +00:00
GitHub Actions Bot
4e13843c78 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-11-08 19:24:13 +00:00
GitHub Actions Bot
a929f8429d 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-11-07 19:24:00 +00:00
xiaojunnuo
40f3f06ed3 chore: 2023-11-07 17:46:18 +08:00
xiaojunnuo
0a79c4c717 chore: 2023-11-07 16:17:46 +08:00
xiaojunnuo
712d789992 Merge remote-tracking branch 'origin/v2' into v2 2023-11-07 14:23:08 +08:00
xiaojunnuo
8de8b1a32e chore: 2023-11-07 14:22:17 +08:00
Greper
c2f565c73a Merge pull request #25 from certd/client_sync
[client] sync upgrade [trident-sync]
2023-11-01 03:24:17 +08:00
GitHub Actions Bot
1df036a811 🔱: [client] sync upgrade with 2 commits [trident-sync]
chore:
2023-10-31 19:24:08 +00:00
xiaojunnuo
9910a4fc7b chore: 2023-10-27 12:53:07 +08:00
xiaojunnuo
9933afc8b7 v1.2.0 2023-10-27 12:39:19 +08:00
xiaojunnuo
1d89d4b0bc build: prepare to build 2023-10-27 12:37:53 +08:00
xiaojunnuo
a8a84d58d9 chore: 2023-10-27 12:37:42 +08:00
xiaojunnuo
80fee524a8 build: prepare to build 2023-10-27 12:36:01 +08:00
xiaojunnuo
4ca2ee52b7 build: prepare to build 2023-10-27 12:28:39 +08:00
xiaojunnuo
6638be81a0 chore: 2023-10-27 12:28:30 +08:00
xiaojunnuo
6ced0e5e43 chore: 2023-10-27 12:26:33 +08:00
xiaojunnuo
e36518dbe5 build: prepare to build 2023-10-27 12:26:15 +08:00
xiaojunnuo
70d8bb60e7 build: prepare to build 2023-10-27 12:21:59 +08:00
xiaojunnuo
3c919f6b23 build: prepare to build 2023-10-27 12:16:38 +08:00
xiaojunnuo
0cb566d2f3 chore: 2023-10-27 12:16:20 +08:00
xiaojunnuo
e137b6baaa chore: 2023-10-27 12:14:18 +08:00
xiaojunnuo
58faeea838 build: prepare to build 2023-10-27 12:13:47 +08:00
xiaojunnuo
47200e9f35 build: prepare to build 2023-10-27 12:10:46 +08:00
xiaojunnuo
5ad8cc668f chore: 2023-10-27 12:08:53 +08:00
xiaojunnuo
e7704171f7 Merge branch 'client_sync' into v2
# Conflicts:
#	packages/ui/certd-client/CHANGELOG.md
#	packages/ui/certd-client/package.json
#	packages/ui/certd-client/src/api/tools.ts
#	packages/ui/certd-client/src/components/index.ts
#	packages/ui/certd-client/src/main.ts
#	packages/ui/certd-client/src/plugin/fast-crud/index.tsx
#	packages/ui/certd-client/src/plugin/index.ts
#	packages/ui/certd-client/src/router/source/framework.ts
#	packages/ui/certd-client/src/store/modules/page.ts
#	packages/ui/certd-client/src/style/common.less
#	packages/ui/certd-client/src/utils/util.env.ts
#	packages/ui/certd-client/src/views/crud/form/independent/index.vue
#	packages/ui/certd-client/src/views/framework/register/index.vue
#	packages/ui/certd-client/vite.config.ts
2023-10-27 11:54:38 +08:00
xiaojunnuo
c43718652a build: prepare to build 2023-10-27 11:01:02 +08:00
GitHub Actions Bot
461a12e909 🔱: [client] sync upgrade with 5 commits [trident-sync]
build: publish success
perf: component.name局部引用无需shallowRef包裹
build: publish success
build: publish success
2023-10-26 19:24:28 +00:00
GitHub Actions Bot
afb682e3eb 🔱: [client] sync upgrade with 3 commits [trident-sync]
build: publish success
feat: 新特性,CrudOptionsPlugin
2023-10-25 19:24:07 +00:00
GitHub Actions Bot
31384fbce5 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 优化文档搜索
2023-10-24 19:24:06 +00:00
Greper
c7cfd7a8a0 Merge pull request #23 from Jijun/Jijun-patch-1
bugfix: domain match
2023-10-09 16:58:36 +08:00
Ranger
717e50fd5c bugfix: domain match
if you have more domain like below :
aeqxiu.cn
beqxiu.cn
eqxiu.cn
then endwith will match the random domain
2023-10-09 16:50:02 +08:00
GitHub Actions Bot
2ffc7d19f1 🔱: [client] sync upgrade with 3 commits [trident-sync]
build: publish success
chore:
2023-09-26 19:24:11 +00:00
GitHub Actions Bot
d857021df5 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-09-23 19:24:21 +00:00
GitHub Actions Bot
2ee864ccaf 🔱: [client] sync upgrade with 3 commits [trident-sync]
chore:
build: publish success
2023-09-16 19:24:09 +00:00
GitHub Actions Bot
018dfed128 🔱: [client] sync upgrade with 4 commits [trident-sync]
build: publish success
chore:  keepName: true,
perf: table select 支持返回object对象

https://github.com/fast-crud/fast-crud/issues/241
2023-09-13 19:24:15 +00:00
GitHub Actions Bot
90e4545210 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-09-12 19:23:50 +00:00
GitHub Actions Bot
4a4b16b010 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: table-select支持跨页选择
2023-09-11 19:24:00 +00:00
GitHub Actions Bot
8701303012 🔱: [client] sync upgrade with 3 commits [trident-sync]
perf: dict.getNodesByValues 修改为单例模式也可以运行,无需配置prototype,优化性能
chore: 各ui支持table-select
2023-09-09 19:24:09 +00:00
GitHub Actions Bot
9788aefcc1 🔱: [client] sync upgrade with 12 commits [trident-sync]
chore: 1.16.11
chore: 1.16.10
chore:
chore:
chore:
build: publish success
perf: 组件独立使用示例

https://github.com/fast-crud/fast-crud/issues/226
perf: 导出增加 onlyShow 和 columnFilter配置

https://github.com/fast-crud/fast-crud/issues/229
Merge remote-tracking branch 'origin/main'
perf: 表单labelWidth演示

https://github.com/fast-crud/fast-crud/issues/230
perf: 翻页后自动滚动到顶部

https://github.com/fast-crud/fast-crud/issues/232
2023-09-03 19:24:05 +00:00
GitHub Actions Bot
ed08ef1604 🔱: [client] sync upgrade with 6 commits [trident-sync]
chore:
chore:
fix: 修复无法嵌套路由的bug
build: publish success
build: publish success
2023-08-21 19:24:03 +00:00
GitHub Actions Bot
adce70a5e5 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-08-20 19:24:13 +00:00
GitHub Actions Bot
d5978f64e1 🔱: [client] sync upgrade with 2 commits [trident-sync]
chore:
2023-08-19 19:23:55 +00:00
GitHub Actions Bot
45215debcc 🔱: [client] sync upgrade with 4 commits [trident-sync]
build: publish success
chore:
perf: 增加查看表单使用单元格组件示例

https://github.com/fast-crud/fast-crud/issues/219
2023-08-18 19:24:07 +00:00
GitHub Actions Bot
919eef55a1 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-08-10 19:24:03 +00:00
GitHub Actions Bot
8c529eed46 🔱: [client] sync upgrade with 2 commits [trident-sync]
chore:
2023-08-09 19:24:03 +00:00
GitHub Actions Bot
7909c2cd46 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-08-07 19:24:11 +00:00
GitHub Actions Bot
b1ac396bf1 🔱: [client] sync upgrade with 4 commits [trident-sync]
build: publish success
chore:
chore:
2023-08-05 19:24:03 +00:00
GitHub Actions Bot
d5eb4a1900 🔱: [client] sync upgrade with 6 commits [trident-sync]
chore:
feat: antdv4 支持
perf: 升级依赖版本
Merge remote-tracking branch 'origin/main'
chore: antdv4 start
2023-08-04 19:23:57 +00:00
GitHub Actions Bot
b8eb27441c 🔱: [client] sync upgrade with 3 commits [trident-sync]
Merge remote-tracking branch 'origin/main'
feat: 重构search,支持search.validatedForm直接修改查询表单数据,修复tab变化后清空查询表单的bug

https://github.com/fast-crud/fast-crud/issues/215
2023-08-03 19:24:08 +00:00
GitHub Actions Bot
de1494710a 🔱: [client] sync upgrade with 2 commits [trident-sync]
build: publish success
2023-07-24 19:24:03 +00:00
GitHub Actions Bot
e3b05ac77f 🔱: [client] sync upgrade with 3 commits [trident-sync]
build: publish success
refactor: fs-images-format images prop define
2023-07-23 19:24:04 +00:00
GitHub Actions Bot
32c8e9482c 🔱: [client] sync upgrade with 2 commits [trident-sync]
fix: 修复hello world 返回数据格式错误
2023-07-10 19:24:06 +00:00
xiaojunnuo
4d3c86dba1 chore: 2023-07-10 13:57:26 +08:00
xiaojunnuo
28449c348e v1.1.6 2023-07-10 13:00:22 +08:00
xiaojunnuo
bb9cf7b93c build: prepare to build 2023-07-10 12:58:33 +08:00
xiaojunnuo
eb861083ad build: prepare to build 2023-07-10 11:56:18 +08:00
xiaojunnuo
b133505086 chore: 2023-07-10 11:56:04 +08:00
xiaojunnuo
0f0cae713a chore: 2023-07-10 11:55:47 +08:00
xiaojunnuo
56cfce86e4 chore: 2023-07-10 11:55:28 +08:00
xiaojunnuo
e950322232 fix: 修复上传证书到腾讯云失败的bug 2023-07-10 11:52:38 +08:00
xiaojunnuo
14de21ee64 refactor: doc 2023-07-06 15:18:41 +08:00
xiaojunnuo
22712eae96 refactor: doc 2023-07-06 15:14:56 +08:00
xiaojunnuo
86d1033324 refactor: doc 2023-07-06 15:13:20 +08:00
GitHub Actions Bot
b4c4dc2c2e 🔱: [client] sync upgrade with 5 commits [trident-sync]
build: publish success
chore:
chore:
perf: 优化export,支持查询导出
2023-07-04 19:24:06 +00:00
xiaojunnuo
671f0142bc refactor: doc 2023-07-04 15:03:34 +08:00
xiaojunnuo
ab4bdc7be6 refactor: doc 2023-07-04 14:56:40 +08:00
xiaojunnuo
0859e60b23 refactor: doc 2023-07-04 14:38:41 +08:00
xiaojunnuo
e69c2d8b0c refactor: doc 2023-07-04 14:38:31 +08:00
xiaojunnuo
186e058f3d refactor: doc 2023-07-04 14:37:13 +08:00
xiaojunnuo
ed5af59040 refactor: doc 2023-07-04 14:29:18 +08:00
xiaojunnuo
0da312f755 refactor: doc 2023-07-04 14:28:27 +08:00
xiaojunnuo
dc646d9a45 refactor: doc 2023-07-04 14:21:14 +08:00
xiaojunnuo
109e01bb60 refactor: doc 2023-07-04 14:19:55 +08:00
xiaojunnuo
657fad06fb refactor: doc 2023-07-04 14:14:31 +08:00
xiaojunnuo
3e014c876d refactor: doc 2023-07-04 14:12:19 +08:00
xiaojunnuo
d14dd51359 refactor: doc 2023-07-04 14:11:43 +08:00
xiaojunnuo
70f876c445 refactor: doc 2023-07-04 14:00:40 +08:00
xiaojunnuo
9d8d51d88d refactor: doc 2023-07-04 13:57:31 +08:00
xiaojunnuo
57037f20cc refactor: doc 2023-07-04 13:46:57 +08:00
xiaojunnuo
4f2f509819 refactor: doc 2023-07-04 13:06:37 +08:00
GitHub Actions Bot
474fd77970 🔱: [client] sync upgrade with 3 commits [trident-sync]
fix: 修复search.value第一次查询无效的bug

https://github.com/fast-crud/fast-crud/issues/208
build: publish success
2023-07-03 19:24:01 +00:00
xiaojunnuo
d2fad719fa refactor: cancel tip 2023-07-03 22:24:16 +08:00
xiaojunnuo
6a3955a1d6 refactor: cancel tip 2023-07-03 22:09:47 +08:00
xiaojunnuo
dceb33006a refactor: cacheControl 2023-07-03 18:19:00 +08:00
xiaojunnuo
a096a43c56 v1.1.5 2023-07-03 17:59:34 +08:00
xiaojunnuo
8114a33d20 build: prepare to build 2023-07-03 17:57:54 +08:00
xiaojunnuo
9f3adddd41 refactor: cacheControl 2023-07-03 17:57:26 +08:00
xiaojunnuo
05f74ab654 refactor: cacheControl 2023-07-03 17:43:21 +08:00
xiaojunnuo
0317118cd9 refactor: 1.1.4 2023-07-03 13:42:48 +08:00
xiaojunnuo
461de8d269 refactor: 1.1.4 2023-07-03 12:39:03 +08:00
xiaojunnuo
b258e92620 v1.1.4 2023-07-03 12:30:41 +08:00
xiaojunnuo
f6148ef1fb build: prepare to build 2023-07-03 12:25:26 +08:00
xiaojunnuo
457da594be build: prepare to build 2023-07-03 11:53:44 +08:00
xiaojunnuo
891a43ae67 perf: flush log 2023-07-03 11:53:11 +08:00
xiaojunnuo
bc65c0a786 perf: cancel task 2023-07-03 11:45:32 +08:00
xiaojunnuo
3eeb1f77aa perf: timeout 2023-07-03 11:16:46 +08:00
xiaojunnuo
91be6826b9 perf: flush logger 2023-07-03 10:54:03 +08:00
xiaojunnuo
f87eee3b9f fix: 成功图标转动的问题 2023-07-03 10:31:25 +08:00
xiaojunnuo
b4e17691c4 chore: index update fast 2023-07-03 10:29:06 +08:00
xiaojunnuo
cce372aeba chore: env config 2023-07-03 10:14:22 +08:00
xiaojunnuo
b5a8a9e08a chore: deploy 2023-07-03 10:05:50 +08:00
xiaojunnuo
35632da284 chore: deploy 2023-07-03 09:33:18 +08:00
xiaojunnuo
02a9b0d16c chore: 1.1.3 2023-07-03 09:25:52 +08:00
xiaojunnuo
d1809e0f7d v1.1.3 2023-07-03 09:22:33 +08:00
xiaojunnuo
abb4a7c0f9 build: prepare to build 2023-07-03 09:21:35 +08:00
xiaojunnuo
cd6fa8b15c chore: 1.1.2 2023-07-03 09:20:10 +08:00
xiaojunnuo
ecfcada802 v1.1.2 2023-07-03 09:18:03 +08:00
xiaojunnuo
f8ec5ae253 build: prepare to build 2023-07-03 09:16:50 +08:00
xiaojunnuo
832ba5c8fb chore: static cache 2023-07-03 09:15:52 +08:00
GitHub Actions Bot
6fda0d6896 🔱: [client] sync upgrade with 8 commits [trident-sync]
chore: 1.14.4
chore: 1.14.3
fix: export lib
chore: 1.14.2
refactor: import
refactor: import
perf: 导入支持
2023-07-02 19:23:56 +00:00
GitHub Actions Bot
a8edaf4dfa 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 导出重构
2023-07-01 19:23:57 +00:00
GitHub Actions Bot
e11b7802c2 🔱: [client] sync upgrade with 8 commits [trident-sync]
perf: export 功能
perf: export 功能
chore: 自定义组件onChange
perf: naiveui 自定义组件支持change validation
chore:
perf: 自定义组件支持触发validation
chore:
2023-06-30 19:24:21 +00:00
GitHub Actions Bot
aa0c5972fb 🔱: [client] sync upgrade with 6 commits [trident-sync]
chore:
perf: v-model editable-row示例
chore: mock tip
fix: 修复行编辑模式下,render、conditionalRender无效的bug
fix: 修复行编辑初始化无效的bug
2023-06-29 19:24:00 +00:00
xiaojunnuo
fa8e91cdcd chore: lodash-es 2023-06-29 17:29:36 +08:00
xiaojunnuo
e5d902663b chore: lodash-es 2023-06-29 17:20:47 +08:00
xiaojunnuo
042535536e chore: pref 2023-06-29 17:19:05 +08:00
xiaojunnuo
6d3063437c chore: pref 2023-06-29 16:45:16 +08:00
xiaojunnuo
3db4d04e4c chore: pref 2023-06-29 16:42:08 +08:00
xiaojunnuo
96f9eab5cd chore: env 2023-06-29 10:34:52 +08:00
xiaojunnuo
1e641b83c1 chore: env 2023-06-29 09:31:26 +08:00
xiaojunnuo
3791d92d67 chore: token expire 2023-06-29 08:56:09 +08:00
xiaojunnuo
2bcab76f5a chore: change password 2023-06-28 23:15:37 +08:00
xiaojunnuo
f5493c542b chore: get random value 2023-06-28 22:10:52 +08:00
xiaojunnuo
68eb4198f1 v1.1.1 2023-06-28 15:48:03 +08:00
xiaojunnuo
ef94607728 build: prepare to build 2023-06-28 15:46:58 +08:00
xiaojunnuo
4ccadbd2be build: prepare to build 2023-06-28 15:42:36 +08:00
xiaojunnuo
0643063b80 chore: auth 2023-06-28 15:42:10 +08:00
xiaojunnuo
d6c6ab932a chore: auth 2023-06-28 15:35:31 +08:00
xiaojunnuo
46004d2db8 chore: login 2023-06-28 15:18:36 +08:00
xiaojunnuo
620d1d4092 chore: clear file 2023-06-28 15:16:19 +08:00
xiaojunnuo
f30afac47e chore: 同步npm镜像 2023-06-28 14:34:22 +08:00
xiaojunnuo
1779e34773 chore: 1 2023-06-28 13:55:48 +08:00
xiaojunnuo
28f535f41c chore: 1 2023-06-28 13:54:17 +08:00
xiaojunnuo
e921f58d2f chore: 1 2023-06-28 13:45:19 +08:00
xiaojunnuo
301f6cc273 chore: off cron when remove 2023-06-28 12:46:29 +08:00
xiaojunnuo
f04e497999 chore: 1.1.0 2023-06-28 11:34:37 +08:00
xiaojunnuo
8db438d76b chore: 1.0.7 2023-06-28 10:29:16 +08:00
xiaojunnuo
af75e607ec chore: 1.0.7 2023-06-28 10:27:37 +08:00
xiaojunnuo
cd4b9527c3 v1.1.0 2023-06-28 10:23:14 +08:00
xiaojunnuo
ea8dc446ae build: prepare to build 2023-06-28 10:22:03 +08:00
xiaojunnuo
ba6270990b chore: 1.0.7 2023-06-28 10:21:32 +08:00
xiaojunnuo
df55f1066c chore: build set -e 2023-06-28 09:58:58 +08:00
xiaojunnuo
b562d661db chore: build +x 2023-06-28 09:57:20 +08:00
xiaojunnuo
aede78a0ec chore: build 2023-06-28 09:44:35 +08:00
xiaojunnuo
7e8c3fbab7 chore: 1 2023-06-27 23:17:32 +08:00
xiaojunnuo
6621601155 chore: 1 2023-06-27 23:06:08 +08:00
xiaojunnuo
1fbd585a46 chore: 1 2023-06-27 22:55:36 +08:00
xiaojunnuo
5a51c14de5 feat: cert download 2023-06-27 22:45:27 +08:00
xiaojunnuo
27a4c81c6d feat: 权限控制 2023-06-27 09:29:43 +08:00
xiaojunnuo
fdc25dc0d7 feat: config merge 2023-06-26 12:26:59 +08:00
xiaojunnuo
99522fb49a feat: save files 2023-06-25 23:45:13 +08:00
xiaojunnuo
671d273e2f feat: save files 2023-06-25 23:25:56 +08:00
xiaojunnuo
2851a33eb2 fix: 修复access选择类型trigger 2023-06-25 16:25:23 +08:00
xiaojunnuo
937e3fac19 feat: 邮件通知 2023-06-25 15:30:18 +08:00
GitHub Actions Bot
47cb00857c 🔱: [client] sync upgrade with 2 commits [trident-sync]
chore: 1.14.1
2023-06-16 19:24:07 +00:00
GitHub Actions Bot
7904e05b4a 🔱: [client] sync upgrade with 5 commits [trident-sync]
chore: 1.14.0
chore: 1
feat: crudBinding.value.table.columns由array改成map
chore: 1
2023-06-09 19:24:11 +00:00
GitHub Actions Bot
c4fe19f2e6 🔱: [client] sync upgrade with 3 commits [trident-sync]
chore: 1.13.12
chore: 1.13.11
2023-06-08 19:24:03 +00:00
GitHub Actions Bot
9db57f0517 🔱: [client] sync upgrade with 6 commits [trident-sync]
perf: search校验失败后,refresh保持原来的formData
perf(search): validation支持

https://github.com/fast-crud/fast-crud/issues/200
chore: 增加search render示例
chore: 增加search render示例
chore: jsx文档
2023-06-07 19:24:02 +00:00
xiaojunnuo
64afebecd4 chore: email 2023-06-07 23:36:42 +08:00
xiaojunnuo
4c324960e6 chore: 1 2023-06-07 23:10:33 +08:00
GitHub Actions Bot
164b90a22f 🔱: [client] sync upgrade with 3 commits [trident-sync]
chore: jsx文档
chore: jsx文档
2023-06-06 19:24:01 +00:00
GitHub Actions Bot
dc735a8aa2 🔱: [client] sync upgrade with 4 commits [trident-sync]
chore: 1.13.10
chore: 1.13.9
fix: 恢复search插槽
2023-05-31 19:24:04 +00:00
xiaojunnuo
f516b0931f chore: jwt key 2023-05-26 16:18:24 +08:00
xiaojunnuo
2297121eff chore: node 16 2023-05-26 14:43:38 +08:00
xiaojunnuo
0c2684d1cf chore: node 16 2023-05-26 14:39:51 +08:00
xiaojunnuo
4b4c5dba73 chore: node 16 2023-05-26 14:39:33 +08:00
xiaojunnuo
7b9d70e093 chore: node 16 2023-05-26 14:31:37 +08:00
xiaojunnuo
71a289b009 chore: node 16 2023-05-26 14:08:37 +08:00
xiaojunnuo
ddf98ff593 chore: node 16 2023-05-26 12:48:06 +08:00
xiaojunnuo
db8043ecb6 chore: node 16 2023-05-26 12:33:03 +08:00
xiaojunnuo
ea756cf0a4 chore: node 16 2023-05-26 10:54:30 +08:00
xiaojunnuo
8446a6d813 chore: node 16 2023-05-26 09:09:57 +08:00
xiaojunnuo
a18aaeacf7 chore: node 16 2023-05-26 01:40:03 +08:00
xiaojunnuo
58a43b3785 chore: node 16 2023-05-26 00:35:44 +08:00
xiaojunnuo
dd06f12582 v1.0.6 2023-05-26 00:22:36 +08:00
xiaojunnuo
d7dcc01c9f build: prepare to build 2023-05-26 00:19:30 +08:00
xiaojunnuo
66f56740b7 chore: node 16 2023-05-26 00:19:01 +08:00
xiaojunnuo
5bd042d9bc chore: node 16 2023-05-26 00:10:34 +08:00
xiaojunnuo
60921d9adf v1.0.5 2023-05-25 23:01:21 +08:00
xiaojunnuo
3a668f1f8b build: prepare to build 2023-05-25 22:57:44 +08:00
xiaojunnuo
609fe5f838 chore: node 16 2023-05-25 22:39:14 +08:00
xiaojunnuo
e29e528aa2 chore: pre publish 2023-05-25 20:46:56 +08:00
xiaojunnuo
e06c9e07fe chore: pre publish 2023-05-25 20:44:41 +08:00
xiaojunnuo
03ee28c380 chore: pre publish 2023-05-25 17:14:58 +08:00
xiaojunnuo
7474235283 chore: pre publish 2023-05-25 16:49:05 +08:00
xiaojunnuo
4eb6ae92d1 chore: pre publish 2023-05-25 16:48:23 +08:00
xiaojunnuo
0eeba2783b chore: pre publish 2023-05-25 16:44:17 +08:00
xiaojunnuo
8498fa75e3 chore: pre publish 2023-05-25 16:13:55 +08:00
xiaojunnuo
5556bc3a4b chore: pre publish 2023-05-25 15:17:58 +08:00
xiaojunnuo
998200e570 chore: pre publish 2023-05-25 13:43:32 +08:00
xiaojunnuo
420b835b09 v1.0.4 2023-05-25 12:49:04 +08:00
xiaojunnuo
cc3534cf00 build: prepare to build 2023-05-25 12:47:38 +08:00
xiaojunnuo
062a267a6f chore: pre publish 2023-05-25 12:47:16 +08:00
xiaojunnuo
98ee7fcd8c chore: pre publish 2023-05-25 12:38:29 +08:00
xiaojunnuo
e5ec9f4b62 Merge remote-tracking branch 'origin/v2' into v2 2023-05-25 12:28:40 +08:00
xiaojunnuo
b66bb21777 chore: 1 2023-05-25 12:28:30 +08:00
xiaojunnuo
f7e026a132 chore: eslint 2023-05-25 11:47:58 +08:00
xiaojunnuo
c12e56823e chore: 1 2023-05-25 11:37:58 +08:00
xiaojunnuo
042f8e9030 chore: 1 2023-05-25 11:37:11 +08:00
xiaojunnuo
9308950550 chore: 1 2023-05-25 10:51:13 +08:00
xiaojunnuo
a43c5b0824 v1.0.3 2023-05-25 10:47:33 +08:00
xiaojunnuo
ebdf9f4b5b build: prepare to build 2023-05-25 10:45:30 +08:00
xiaojunnuo
511be1f3ae chore: pre publish 2023-05-25 10:45:07 +08:00
xiaojunnuo
ceb0454277 chore: pre publish 2023-05-25 10:43:22 +08:00
xiaojunnuo
c553b017af chore: pre publish 2023-05-25 10:33:42 +08:00
xiaojunnuo
c553f63127 chore: pre publish 2023-05-25 10:08:40 +08:00
xiaojunnuo
152cb9b23a chore: 1 2023-05-25 00:46:44 +08:00
xiaojunnuo
5eff50e8fe chore: 1 2023-05-25 00:41:36 +08:00
xiaojunnuo
cddf01ee68 chore: 1.0.0 pre 2023-05-24 18:28:29 +08:00
xiaojunnuo
d968c4bbb9 chore: 1.0.0 pre 2023-05-24 18:09:33 +08:00
xiaojunnuo
1a738403fc v1.0.2 2023-05-24 18:07:00 +08:00
xiaojunnuo
71428b0181 build: prepare to build 2023-05-24 18:05:25 +08:00
xiaojunnuo
4b538bae97 chore: 1.0.0 pre 2023-05-24 18:05:18 +08:00
xiaojunnuo
a4bb4fd708 chore: 1.0.0 pre 2023-05-24 18:04:50 +08:00
xiaojunnuo
99bb7b70e0 v1.0.1 2023-05-24 18:02:45 +08:00
xiaojunnuo
443f6358c9 build: prepare to build 2023-05-24 18:01:02 +08:00
xiaojunnuo
0bae4851c1 chore: 1.0.0 pre 2023-05-24 18:00:50 +08:00
xiaojunnuo
66710d33c6 build: prepare to build 2023-05-24 17:53:47 +08:00
xiaojunnuo
73fe1422f3 chore: 1.0.0 pre 2023-05-24 17:53:28 +08:00
xiaojunnuo
47f3cf7ba5 chore: 1.0.0 pre 2023-05-24 17:52:32 +08:00
xiaojunnuo
d5ef57542a build: prepare to build 2023-05-24 17:49:51 +08:00
xiaojunnuo
cc3531b9d5 chore: 1.0.0 pre 2023-05-24 17:49:39 +08:00
xiaojunnuo
95722f46f4 chore: 1.0.0 pre 2023-05-24 17:41:38 +08:00
xiaojunnuo
5950e1cae7 v1.0.0 2023-05-24 17:39:40 +08:00
xiaojunnuo
d176ab4886 chore: remove workspace prefix 2023-05-24 17:39:13 +08:00
xiaojunnuo
cbccf1024b chore: 准备打包 2023-05-24 17:38:24 +08:00
xiaojunnuo
643148d283 chore: 准备打包 2023-05-24 17:30:42 +08:00
xiaojunnuo
ac15c8fc0e perf: huawei signer ts化 2023-05-24 17:00:04 +08:00
xiaojunnuo
3751fcd4c9 perf: 优化定时器 2023-05-24 15:41:35 +08:00
GitHub Actions Bot
02466ea0bd 🔱: [client] sync upgrade with 3 commits [trident-sync]
chore: 一些小优化
chore: doc
2023-05-23 19:24:05 +00:00
xiaojunnuo
6f6606d76d feat: ui模式
BREAKING CHANGE: 接口配置变更
2023-05-23 18:01:20 +08:00
GitHub Actions Bot
59f22ab17e 🔱: [client] sync upgrade with 3 commits [trident-sync]
chore: 1.13.8
perf(form): 支持conditionalRender
2023-05-22 19:23:55 +00:00
GitHub Actions Bot
2db9343e0f 🔱: [client] sync upgrade with 2 commits [trident-sync]
refactor: 1.13.7
2023-05-19 19:23:53 +00:00
GitHub Actions Bot
36b3a53ab2 🔱: [client] sync upgrade with 2 commits [trident-sync]
fix: 修复rowhandle 排列不整齐的问题
2023-05-17 19:24:06 +00:00
GitHub Actions Bot
dc8c42a820 🔱: [client] sync upgrade with 4 commits [trident-sync]
refactor:  修复login页面logo错位问题
refactor:  移除fs-bpmn
refactor:  publishConfig 恢复
2023-05-15 19:24:01 +00:00
GitHub Actions Bot
2bd5d0bd8e 🔱: [client] sync upgrade with 5 commits [trident-sync]
refactor: 1.13.6
refactor: proxy
refactor: 1.13.5
refactor: tabs remove 样式
2023-05-13 19:24:08 +00:00
xiaojunnuo
8c152371a1 refactor: huawei 2023-05-09 14:11:01 +08:00
xiaojunnuo
f489c59ca3 refactor: huawei 2023-05-09 13:53:16 +08:00
xiaojunnuo
d2897cefaa refactor: huawei 2023-05-09 13:52:25 +08:00
xiaojunnuo
9747d40734 refactor: register 2023-05-09 10:16:49 +08:00
xiaojunnuo
e123ec4089 refactor: register 2023-05-09 09:56:31 +08:00
xiaojunnuo
f358a0f226 refactor: for test 2023-05-09 09:49:42 +08:00
xiaojunnuo
003ea9310b feat: plugin-huawei 2023-05-09 09:19:17 +08:00
xiaojunnuo
d602df4c70 fix: 1 2023-05-08 11:19:19 +08:00
GitHub Actions Bot
c9ac5ae963 🔱: [client] sync upgrade with 3 commits [trident-sync]
refactor: 1.13.4
perf: 服务端过滤示例
2023-05-06 19:24:02 +00:00
xiaojunnuo
daa990ee96 build: workspace 2023-05-07 01:32:47 +08:00
GitHub Actions Bot
49487419d2 🔱: [client] sync upgrade with 3 commits [trident-sync]
fix: 修复helloworld,添加记录无效的bug
fix: 1.13.3
2023-05-04 19:24:12 +00:00
xiaojunnuo
0fca7dc3ce fix: base service bug 2023-05-01 21:53:28 +08:00
xiaojunnuo
0a946f55ca fix: base service bug 2023-05-01 21:51:41 +08:00
GitHub Actions Bot
508fe69cf8 🔱: [client] sync upgrade with 3 commits [trident-sync]
docs: vModel支持trim、number doc
perf: vModel支持trim、number

https://github.com/fast-crud/fast-crud/issues/182
2023-04-28 19:24:08 +00:00
GitHub Actions Bot
3e4a8f230f 🔱: [client] sync upgrade with 4 commits [trident-sync]
refactor: 1.13.2
refactor: fs-bpmn 1.0.14
refactor: fs-bpmn 1.0.14
2023-04-20 19:24:50 +00:00
GitHub Actions Bot
a62230c195 🔱: [client] sync upgrade with 3 commits [trident-sync]
fix: _index列 被conditionalRender影响的bug
refactor:
2023-04-19 19:24:05 +00:00
GitHub Actions Bot
1173fb1e90 🔱: [client] sync upgrade with 3 commits [trident-sync]
Merge remote-tracking branch 'origin/main'
perf: 优化fs-images-format 加载失败时的显示
2023-04-18 19:24:09 +00:00
GitHub Actions Bot
529648a30c 🔱: [client] sync upgrade with 3 commits [trident-sync]
refactor: bpmn 1.0.10
refactor: bpmn 1.0.9
2023-04-17 19:26:40 +00:00
GitHub Actions Bot
82b6b9ccb2 🔱: [client] sync upgrade with 2 commits [trident-sync]
refactor: fs-bpmn 1.0.8
2023-04-15 19:23:59 +00:00
GitHub Actions Bot
71244a4eb8 🔱: [client] sync upgrade with 2 commits [trident-sync]
fix: 修复 文件上传accept问题
2023-04-12 19:24:06 +00:00
GitHub Actions Bot
32fd424295 🔱: [client] sync upgrade with 3 commits [trident-sync]
refactor: 1.13.1
refactor:
2023-04-10 19:23:56 +00:00
GitHub Actions Bot
5746042d68 🔱: [client] sync upgrade with 9 commits [trident-sync]
refactor: bpmn 1.0.6
Merge remote-tracking branch 'origin/main'
refactor: bpmn 1.0.6
Merge branch 'main' of https://github.com/fast-crud/fs-admin-antdv
perf: toolbar按钮显隐配置,保存按钮,对话框样式优化
refactor: 1.13.0
refactor: 1.13.0
feat: FsComponentRender组件重构

修复选择联动示例报错的bug
2023-04-07 19:23:58 +00:00
GitHub Actions Bot
e76fb235aa 🔱: [client] sync upgrade with 4 commits [trident-sync]
refactor: 1.12.2
refactor: card layout style
perf: 新增table.conditionalRender配置,条件渲染
2023-04-06 19:24:11 +00:00
GitHub Actions Bot
47e13312b1 🔱: [client] sync upgrade with 2 commits [trident-sync]
refactor: 1.12.1
2023-04-04 19:24:00 +00:00
GitHub Actions Bot
55e05afe0e 🔱: [client] sync upgrade with 8 commits [trident-sync]
perf: 增加自定义组件示例
Merge remote-tracking branch 'origin/main'
refactor: fs-bpmn
refactor: integration fs-bpmn
refactor: 集成fs-bpmn
refactor:
refactor: 优化i18n
2023-04-03 19:24:05 +00:00
GitHub Actions Bot
aebce2f241 🔱: [client] sync upgrade with 21 commits [trident-sync]
refactor: 1.12.0
refactor: 多行查询优化
perf: 优化多行查询示例
feat(search): search支持自定义布局

search支持自定义布局,search.layout、search.collapse转移到 search.container之下。如果想使用原来的search组件,请配置search.is=fs-search-v1
refactor: 1.11.10
fix: 修复列设置显隐和禁用无效的bug
refactor: 1.11.9
refactor: 1.11.9
perf: 增加表单字段render示例
refactor: 删除无用的index
Merge remote-tracking branch 'origin/main'
refactor: circle check
refactor: circle check
refactor: 1.11.8
refactor: upload demo test
perf: 优化dict性能
refactor: debug
fix: 修复当limit=1时,上传文件删光后,再选择文件上传第一次无效的bug

https://github.com/fast-crud/fast-crud/issues/166
refactor: 1.11.7
refactor: 1.11.6
...
2023-03-31 19:24:21 +00:00
GitHub Actions Bot
aa3207fca5 🔱: [client] sync upgrade with 2 commits [trident-sync]
feat(search): search支持自定义布局

BREAKING CHANGE: search支持自定义布局,search.layout、search.collapse转移到 search.container之下。如果想使用原来的search组件,请配置search.is=fs-search-v1
2023-03-30 19:23:57 +00:00
GitHub Actions Bot
ce8df34b49 🔱: [client] sync upgrade with 3 commits [trident-sync]
refactor: 1.11.10
fix: 修复列设置显隐和禁用无效的bug
2023-03-29 19:23:55 +00:00
GitHub Actions Bot
8aa8c5d8ae 🔱: [client] sync upgrade with 5 commits [trident-sync]
refactor: 1.11.9
refactor: 1.11.9
perf: 增加表单字段render示例
refactor: 删除无用的index
2023-03-28 19:24:02 +00:00
GitHub Actions Bot
e7628bdbdd 🔱: [client] sync upgrade with 8 commits [trident-sync]
Merge remote-tracking branch 'origin/main'
refactor: circle check
refactor: circle check
refactor: 1.11.8
refactor: upload demo test
perf: 优化dict性能
refactor: debug
2023-03-24 19:24:06 +00:00
GitHub Actions Bot
b9dd4a35db 🔱: [client] sync upgrade with 2 commits [trident-sync]
fix: 修复当limit=1时,上传文件删光后,再选择文件上传第一次无效的bug

https://github.com/fast-crud/fast-crud/issues/166
2023-03-23 19:24:01 +00:00
GitHub Actions Bot
040b2e8a53 🔱: [client] sync upgrade with 11 commits [trident-sync]
refactor: 1.11.7
refactor: 1.11.6
refactor: 1.11.5
refactor: ui interface
refactor: ui interface
refactor: ui interface
refactor: 1.11.4
fix: 多级表头列设置不显示bug
fix: tabs,修复连续触发两次查询的bug

https://github.com/fast-crud/fast-crud/issues/161
perf: 文本复制组件优化
2023-03-22 19:23:53 +00:00
GitHub Actions Bot
af25254628 🔱: [client] sync upgrade with 3 commits [trident-sync]
refactor: 1.11.3
refactor: 1.11.2
2023-03-21 19:24:02 +00:00
GitHub Actions Bot
0c673a54cd 🔱: [client] sync upgrade with 2 commits [trident-sync]
refactor: docs
2023-03-19 19:23:51 +00:00
GitHub Actions Bot
9f1f36774d 🔱: [client] sync upgrade with 5 commits [trident-sync]
refactor: 1
refactor: 1.11.1
refactor: 1.11.1
perf: useFs优化,增加context:UseFsContext
2023-03-17 19:23:57 +00:00
GitHub Actions Bot
6ec697b010 🔱: [client] sync upgrade with 12 commits [trident-sync]
refactor: 1.11.0
refactor: 1.11.0
refactor: 1.11.0
refactor: 1.11.0
refactor: ts化
refactor: ts化
feat: 全面TS化
perf: 全面ts化
refactor: 继续优化ts
perf: ts定义优化
fix: 修复wangeditor无法上传视频的bug
2023-03-16 19:24:01 +00:00
GitHub Actions Bot
f344c58f26 🔱: [client] sync upgrade with 4 commits [trident-sync]
perf: DynamicallyCrudOptions 动态CrudOptions
refactor: doc cover
refactor: doc cover
2023-03-13 19:24:02 +00:00
GitHub Actions Bot
263b0fa455 🔱: [client] sync upgrade with 6 commits [trident-sync]
Merge remote-tracking branch 'origin/main'
refactor: fsRefValue初步
refactor: deploy
Merge remote-tracking branch 'origin/main'
refactor: 1.10.0
2023-03-12 19:23:59 +00:00
GitHub Actions Bot
a634c8f2d1 🔱: [client] sync upgrade with 6 commits [trident-sync]
refactor: deploy
refactor: deploy
refactor: 1.10.0
refactor: 1
perf: 增加s3示例
2023-03-11 19:23:57 +00:00
GitHub Actions Bot
336faa46b2 🔱: [client] sync upgrade with 4 commits [trident-sync]
perf: upload sdk换成aws-s3
feat: upload 支持s3 minio

https://github.com/fast-crud/fast-crud/issues/149
feat: fs-form-wrapper支持多实例

https://github.com/fast-crud/fast-crud/issues/150
2023-03-10 19:24:05 +00:00
GitHub Actions Bot
52a167c647 🔱: [client] sync upgrade with 9 commits [trident-sync]
perf: 完善文档,完善部分types
perf: 优化d.ts类型
perf: 日期增加week、month、year、quarter类型
feat: resetCrudOptions 示例
feat: tabs快捷查询组件
fix: 行编辑支持多级表头

https://github.com/fast-crud/fast-crud/issues/143
perf: antdv 增加自定义表头示例

https://github.com/fast-crud/fast-crud/issues/141
perf: 表单下方按钮支持context

https://github.com/fast-crud/fast-crud/issues/142
2023-03-09 19:24:01 +00:00
Greper
458756e895 Merge pull request #13 from certd/client_sync
[client] sync upgrade [trident-sync]
2023-03-03 03:24:24 +08:00
GitHub Actions Bot
76dd23174a 🔱: [client] sync upgrade with 2 commits [trident-sync]
refactor: footer version
2023-03-02 19:24:14 +00:00
Greper
0ad667b00a Merge pull request #12 from certd/client_sync
[client] sync upgrade [trident-sync]
2023-03-02 03:24:26 +08:00
GitHub Actions Bot
699ab168c1 🔱: [client] sync upgrade with 5 commits [trident-sync]
refactor: 1.9.2
perf: select 增加可输入示例
refactor: fs-admin menu center
build: 1.9.1
2023-03-01 19:24:17 +00:00
Greper
5ccb4a6f08 Merge pull request #11 from certd/client_sync
[client] sync upgrade [trident-sync]
2023-02-10 03:24:09 +08:00
GitHub Actions Bot
2c10cedb34 🔱: [client] sync upgrade with 6 commits [trident-sync]
refactor: sync gitee
refactor: sync gitee
refactor: sync gitee
refactor: 1.9.0
refactor: 准备发布
2023-02-09 19:24:00 +00:00
xiaojunnuo
3b357ef301 Merge branch 'client_sync' into v2
# Conflicts:
#	packages/ui/certd-client/vite.config.ts
2023-02-07 12:44:54 +08:00
GitHub Actions Bot
f686fb0d95 🔱: [client] sync upgrade with 2 commits [trident-sync]
perf: 自动remove debugger配置
2023-02-01 19:24:05 +00:00
Greper
3f739daaea Merge pull request #8 from certd/client_sync
[client] sync upgrade [trident-sync]
2023-02-01 21:07:37 +08:00
GitHub Actions Bot
c9d415f9db 🔱: [client] sync upgrade with 2 commits [trident-sync]
refactor: formater
2023-02-01 13:07:28 +00:00
GitHub Actions Bot
51249c304c 🔱: [client] sync upgrade with 2 commits [trident-sync]
feat: noImplicitAny: true
2023-01-31 19:24:09 +00:00
GitHub Actions Bot
83f9a551e7 🔱: [client] sync upgrade with 2 commits [trident-sync]
refactor: 1.8.5
2023-01-30 19:24:01 +00:00
Greper
6c450d3249 Merge pull request #7 from certd/server_sync
🔱: [server] sync upgrade with 1 commits [trident-sync]
2023-01-29 16:42:35 +08:00
GitHub Actions Bot
8b828b3f34 🔱: [server] sync upgrade with 1 commits [trident-sync] 2023-01-29 08:39:33 +00:00
xiaojunnuo
146d106991 Merge branch 'server_sync' into v2
# Conflicts:
#	packages/ui/certd-server/.eslintrc.json
#	packages/ui/certd-server/.gitignore
#	packages/ui/certd-server/LICENSE
#	packages/ui/certd-server/README.md
#	packages/ui/certd-server/bootstrap.js
#	packages/ui/certd-server/package.json
#	packages/ui/certd-server/src/basic/base-service.ts
#	packages/ui/certd-server/src/basic/crud-controller.ts
#	packages/ui/certd-server/src/config/config.default.ts
#	packages/ui/certd-server/src/configuration.ts
#	packages/ui/certd-server/src/middleware/authority.ts
#	packages/ui/certd-server/src/middleware/global-exception.ts
#	packages/ui/certd-server/src/middleware/preview.ts
#	packages/ui/certd-server/src/middleware/report.ts
#	packages/ui/certd-server/src/modules/authority/controller/permission-controller.ts
#	packages/ui/certd-server/src/modules/authority/controller/role-controller.ts
#	packages/ui/certd-server/src/modules/authority/controller/user-controller.ts
#	packages/ui/certd-server/src/modules/authority/service/permission-service.ts
#	packages/ui/certd-server/src/modules/authority/service/role-permission-service.ts
#	packages/ui/certd-server/src/modules/authority/service/role-service.ts
#	packages/ui/certd-server/src/modules/authority/service/user-role-service.ts
#	packages/ui/certd-server/src/modules/authority/service/user-service.ts
#	packages/ui/certd-server/src/modules/basic/controller/basic-controller.ts
#	packages/ui/certd-server/src/modules/login/controller/login-controller.ts
#	packages/ui/certd-server/tsconfig.json
2023-01-29 16:06:34 +08:00
xiaojunnuo
b15b2edcdf Merge branch 'client_sync' into v2
# Conflicts:
#	packages/ui/certd-client/.eslintrc.js
#	packages/ui/certd-client/LICENSE
#	packages/ui/certd-client/README.md
#	packages/ui/certd-client/package.json
#	packages/ui/certd-client/src/components/index.ts
#	packages/ui/certd-client/src/i18n/index.ts
#	packages/ui/certd-client/src/layout/layout-pass.vue
#	packages/ui/certd-client/src/main.ts
#	packages/ui/certd-client/src/router/index.ts
#	packages/ui/certd-client/src/router/source/framework.ts
#	packages/ui/certd-client/src/router/source/modules/crud.ts
#	packages/ui/certd-client/src/store/modules/settings.ts
#	packages/ui/certd-client/src/style/common.less
#	packages/ui/certd-client/src/views/crud/feature/header-group/index.vue
#	packages/ui/certd-client/src/views/crud/feature/search/crud.jsx
#	packages/ui/certd-client/src/views/crud/form/base/crud.jsx
#	packages/ui/certd-client/src/views/crud/form/base/index.vue
#	packages/ui/certd-client/src/views/framework/home/page-cover/index.vue
#	packages/ui/certd-client/tsconfig.json
#	packages/ui/certd-client/vite.config.ts
2023-01-29 15:46:15 +08:00
xiaojunnuo
f08f765529 Merge branch 'acme_sync' into v2
# Conflicts:
#	packages/core/acme-client/.gitignore
#	packages/core/acme-client/package.json
#	packages/core/acme-client/src/auto.js
#	packages/core/acme-client/src/crypto/forge.js
#	packages/core/acme-client/types/index.d.ts
2023-01-29 15:35:26 +08:00
xiaojunnuo
f64ea78c44 🔱: [acme] sync upgrade with 21 commits [trident-sync]
Bump v5.0.0
2023-01-29 15:27:11 +08:00
xiaojunnuo
fbde7cbd93 🔱: [server] sync upgrade with 21 commits [trident-sync]
Update README.md
2023-01-29 15:26:58 +08:00
xiaojunnuo
d10e80bf83 🔱: [client] sync upgrade with 21 commits [trident-sync]
Update README.md
2023-01-29 15:26:45 +08:00
xiaojunnuo
a269d8374e build: add node-acme-client copy 2023-01-29 14:44:10 +08:00
xiaojunnuo
49ea196160 build: remove submodules 2023-01-29 14:42:03 +08:00
xiaojunnuo
ddb1bc87bb build: remove submodules 2023-01-29 14:22:21 +08:00
xiaojunnuo
07a45b4530 build: trident-sync prepare 2023-01-29 13:44:19 +08:00
xiaojunnuo
dcd1023a39 feat: midway注解方式编写插件 2023-01-11 20:39:48 +08:00
xiaojunnuo
52522f27e9 feat: midway注解方式编写插件 2023-01-07 23:22:02 +08:00
xiaojunnuo
e4ec4e1404 feat: midway注解方式编写插件 2022-12-29 23:52:51 +08:00
xiaojunnuo
717d203622 refactor: decorator 2022-12-27 12:32:09 +08:00
xiaojunnuo
c23f6172b5 refactor: plugins 2022-11-08 22:48:57 +08:00
xiaojunnuo
b04d4cb5c5 refactor: plugins 2022-11-08 22:10:42 +08:00
xiaojunnuo
d66bc33761 refactor: 1 2022-11-07 23:31:20 +08:00
xiaojunnuo
f710c00c0d refactor: 1 2022-11-06 22:32:40 +08:00
xiaojunnuo
e68862b633 refactor: remove certd v1 code 2022-10-31 21:27:32 +08:00
xiaojunnuo
6094a4af79 refactor: fix bugs 2022-10-31 15:01:50 +08:00
xiaojunnuo
146ac49703 refactor: logs 2022-10-30 01:42:10 +08:00
xiaojunnuo
909b75eb40 refactor: history 2022-10-30 01:13:08 +08:00
xiaojunnuo
dcdb25d92d refactor: pipeline run log 2022-10-29 01:10:55 +08:00
xiaojunnuo
3dfdd3c31c refactor: pipeline run log 2022-10-28 16:08:12 +08:00
xiaojunnuo
25d5a99b3d refactor: pipeline edit view 2022-10-27 09:26:32 +08:00
xiaojunnuo
e1466737e3 refactor: pipeline edit view 2022-10-26 23:29:10 +08:00
xiaojunnuo
370a28c10e refactor: pipeline edit view 2022-10-26 09:02:47 +08:00
xiaojunnuo
af919c2f6e refactor: 1 2022-10-21 01:21:27 +08:00
xiaojunnuo
dc3ab544c8 refactor: 1 2022-10-20 23:51:52 +08:00
xiaojunnuo
708bebe6e3 refactor: 1 2022-10-20 23:46:36 +08:00
xiaojunnuo
3722e922ff refactor: 1 2022-10-20 23:19:08 +08:00
xiaojunnuo
8b5d5a8bf9 Merge branch 'master' into v2
# Conflicts:
#	.gitignore
#	.gitmodules
#	lerna.json
2022-10-20 23:13:58 +08:00
xiaojunnuo
038b1c9ca4 refactor: access selector 2022-10-20 23:11:57 +08:00
xiaojunnuo
b10ff5b6ee refactor: ui edit cert 2022-10-18 23:15:36 +08:00
xiaojunnuo
b7bde7b685 refactor: 1 2022-10-17 16:51:21 +08:00
xiaojunnuo
718028ca62 refactor: 1 2022-10-08 21:58:09 +08:00
xiaojunnuo
98b2863547 agpl license 2022-10-07 21:52:06 +08:00
xiaojunnuo
b1e60456cf refactor: 1 2022-10-07 21:48:39 +08:00
978 changed files with 57869 additions and 7660 deletions

21
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,21 @@
> 感谢您支持certd请按如下规范提交issue
> 如果有条件,请尽量在[github上提交](https://github.com/certd/certd/issues)
## 一、问题描述
`请在此处简要描述你所遇到的问题,必要时请贴出相关截图辅助理解和定位`
### 复现步骤
`请描述复现问题的详细步骤`
`如果非示例页面的问题,最好能提供最小复现示例的代码、或者仓库链接`
### 报错截图
`请贴出报错日志截图`
### 效果截图
`请贴出效果截图`
#### 1. 期望效果
#### 2. 实际效果

89
.github/workflows/build-image.yml vendored Normal file
View File

@@ -0,0 +1,89 @@
name: build-image
on:
push:
branches: ['v2']
paths:
- "build.trigger"
# schedule:
# - # 国际时间 19:17 执行北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
# - cron: '17 19 * * *'
permissions:
contents: read
jobs:
build-certd-image:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: get_certd_version
id: get_certd_version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const fs = require('fs');
const path = require('path');
const pnpmWorkspace = "./pnpm-workspace.yaml";
fs.unlinkSync(pnpmWorkspace)
const jsonFilePath = "./packages/ui/certd-server/package.json";
const jsonContent = fs.readFileSync(jsonFilePath, 'utf-8');
const pkg = JSON.parse(jsonContent)
console.log("certd_version:",pkg.version);
return pkg.version
# - name: Use Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 18
# cache: 'npm'
# working-directory: ./packages/ui/certd-client
- run: |
npm install -g pnpm@8.15.7
pnpm install
npm run build
working-directory: ./packages/ui/certd-client
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to aliyun container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-shenzhen.aliyuncs.com
username: ${{ secrets.aliyun_cs_username }}
password: ${{ secrets.aliyun_cs_password }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_password }}
- name: Build default platforms
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
context: ./packages/ui/
tags: |
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}}
greper/certd:latest
greper/certd:${{steps.get_certd_version.outputs.result}}
- name: Build armv7
uses: docker/build-push-action@v6
with:
platforms: linux/arm/v7
push: true
context: ./packages/ui/
tags: |
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:armv7
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}}-armv7
greper/certd:armv7
greper/certd:${{steps.get_certd_version.outputs.result}}-armv7

55
.github/workflows/deploy-demo.yml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: deploy-demo
on:
push:
branches: ['v2']
paths:
- "deploy.trigger"
workflow_run:
workflows: [ "build-image" ]
types:
- completed
# schedule:
# - # 国际时间 19:17 执行北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
# - cron: '17 19 * * *'
permissions:
contents: read
jobs:
deploy-certd-demo:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: get_certd_version
id: get_certd_version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const fs = require('fs');
const path = require('path');
const jsonFilePath = "./packages/ui/certd-server/package.json";
const jsonContent = fs.readFileSync(jsonFilePath, 'utf-8');
const pkg = JSON.parse(jsonContent)
console.log("certd_version:",pkg.version);
return pkg.version
- uses: GuillaumeFalourd/wait-sleep-action@v1
with:
time: '10' # for 60 seconds
- name: Send HTTP request
id: request
uses: tyrrrz/action-http-request@master
with:
url: http://flow-openapi.aliyun.com/pipeline/webhook/lzCzlGrLCOHQaTMMt0mG
method: POST
headers: |
Content-Type: application/json
body: |
{
"CERTD_VERSION": "${{steps.get_certd_version.outputs.result}}"
}
retry-count: 3
retry-delay: 5000

33
.github/workflows/sync-to-gitee.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: sync-to-gitee
on:
push:
branches: ['v2']
# schedule:
# - # 国际时间 19:17 执行北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
# - cron: '17 19 * * *'
permissions:
contents: read
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout work repo # 1. 检出当前仓库(certd-sync-work)
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set git user # 2. 给git命令设置用户名和邮箱,↙↙↙ 改成你的name和email
run: |
git config --global user.name "xiaojunnuo"
git config --global user.email "xiaojunnuo@qq.com"
- name: Set git token # 3. 给git命令设置token用于push到目标仓库
uses: de-vri-es/setup-git-credentials@v2
with: # token 格式为: username:password
credentials: https://${{secrets.PUSH_TOKEN_GITEE}}@gitee.com
- name: push to gitee # 4. 执行同步
run: |
git remote add upstream https://gitee.com/certd/certd
git push --set-upstream upstream v2

22
.gitignore vendored
View File

@@ -1,3 +1,4 @@
./packages/core/lego
# IntelliJ project files
.vscode/
node_modules/
@@ -6,7 +7,9 @@ yarn-error.log
yarn.lock
package-lock.json
/.idea/
*/**/dist
*/**/pnpm-lock.yaml
*/**/stats.html
.idea
*.iml
out
@@ -16,14 +19,13 @@ gen
/*.log
/packages/ui/*/.idea
/packages/ui/*/node_modules
/packages/*/node_modules
/packages/ui/certd-server/tmp/
/packages/ui/certd-ui/dist/
/other
/dev-sidecar-test
/packages/core/certd/yarn.lock
/packages/test
/test/own
/pnpm-lock.yaml
tsconfig.tsbuildinfo
test/**/*.js
/packages/ui/certd-server/data/db.sqlite
/packages/ui/certd-server/data/keys.yaml
/packages/pro/

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "packages/base/node-acme-client"]
path = packages/base/node-acme-client
url = https://github.com/certd/node-acme-client.git

2
.npmrc Normal file
View File

@@ -0,0 +1,2 @@
link-workspace-packages=true
prefer-workspace-packages=true

7
.prettierrc Normal file
View File

@@ -0,0 +1,7 @@
{
"printWidth": 160,
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "avoid"
}

460
CHANGELOG.md Normal file
View File

@@ -0,0 +1,460 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
### Bug Fixes
* 修复中间证书复制错误的bug ([76e86ea](https://github.com/certd/certd/commit/76e86ea283ecbe4ec76cdc92b98457d0fef544ac))
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
* 增加使用教程 ([9d9c021](https://github.com/certd/certd/commit/9d9c0218195af5b9896cce7109b26a433480571d))
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package root
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
### Bug Fixes
* 修复启动报授权验证失败的bug ([3460d3d](https://github.com/certd/certd/commit/3460d3ddca222ea702816ab805909d489eff957f))
## [1.25.3](https://github.com/certd/certd/compare/v1.25.2...v1.25.3) (2024-09-24)
### Bug Fixes
* 修复upload to host trim错误 ([0f0ddb9](https://github.com/certd/certd/commit/0f0ddb9c5963fd643d6d203334efac471c43ec3b))
## [1.25.2](https://github.com/certd/certd/compare/v1.25.1...v1.25.2) (2024-09-24)
**Note:** Version bump only for package root
## [1.25.1](https://github.com/certd/certd/compare/v1.25.0...v1.25.1) (2024-09-24)
**Note:** Version bump only for package root
# [1.25.0](https://github.com/certd/certd/compare/v1.24.4...v1.25.0) (2024-09-24)
### Bug Fixes
* 修复首次创建任务运行时不自动设置当前运行情况的bug ([ecd83ee](https://github.com/certd/certd/commit/ecd83ee136abdd3df9ed2f21ec2ff0f24c0ed9d9))
### Features
* 账号绑定 ([e046640](https://github.com/certd/certd/commit/e0466409d0c021bb415abd94df448c8a0d4799e9))
* 支持中间证书 ([e86756e](https://github.com/certd/certd/commit/e86756e4c65a53dd23106d7ecbfe2fa987cc13f3))
* 支持vip转移 ([361e8fe](https://github.com/certd/certd/commit/361e8fe7ae5877e23fd5de31bc919bedd09c57f5))
### Performance Improvements
* 群晖支持OTP双重验证登录 ([8b8039f](https://github.com/certd/certd/commit/8b8039f42bbce10a4d0e737cdeeeef9bb17bee5a))
* 任务支持禁用 ([8ed16b3](https://github.com/certd/certd/commit/8ed16b3ea2dfe847357863a0bfa614e4fa5fc041))
* 优化收件邮箱输入 ([22ef28f](https://github.com/certd/certd/commit/22ef28f6338a78465bd52ccbad13e66e80263b2f))
* 优化主机登录失败提示 ([9de77b3](https://github.com/certd/certd/commit/9de77b327d39cff5ed6660ec53b58ba0eea18e5a))
* 增加重启certd插件 ([48238d9](https://github.com/certd/certd/commit/48238d929e6c4afa1d428e4d35b9159d37a47ae0))
* 证书支持旧版RSApkcs1 ([3d9c3ec](https://github.com/certd/certd/commit/3d9c3ecb3eb604b2458154f608bde0f01915d116))
* 支持阿里云ACK证书部署 ([d331fea](https://github.com/certd/certd/commit/d331fea47789122650e057ec7c9e85ee8e66f09b))
* 支持七牛云 ([8ecc2f9](https://github.com/certd/certd/commit/8ecc2f9446a9ebd11b9bfbffbb6cf7812a043495))
* 支持k8s ingress secret ([e5a5d0a](https://github.com/certd/certd/commit/e5a5d0a607bb6b4e1a1f7a1a419bada5f2dee59f))
* http请求增加默认超时时间 ([664bd86](https://github.com/certd/certd/commit/664bd863e5b4895aabe2384277c0c65f5902fdb2))
* plugins增加图标 ([a8da658](https://github.com/certd/certd/commit/a8da658a9723342b4f43a579f7805bfef0648efb))
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Bug Fixes
* 修复腾讯云cdn证书部署后会自动关闭hstshttp2.0等配置的bug ([7908ab7](https://github.com/certd/certd/commit/7908ab79da624c94fa05849925b15e480e3317c4))
* 修复腾讯云tke证书部署报错的bug ([653f409](https://github.com/certd/certd/commit/653f409d91a441850d6381f89a8dd390831f0d5e))
### Performance Improvements
* 插件选择支持搜索 ([d1498a7](https://github.com/certd/certd/commit/d1498a71601b74d38343b1d070eadd03705dd9d5))
* 前置任务步骤增加错误提示 ([ae3daa9](https://github.com/certd/certd/commit/ae3daa9bcf4fc363825aad9b77f5d3879aeeff70))
* 群晖部署教程 ([0f0af2f](https://github.com/certd/certd/commit/0f0af2f309390f388e7a272cea3a1dd30c01977d))
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements
* 支持多吉云cdn证书部署 ([65ef685](https://github.com/certd/certd/commit/65ef6857296784ca765926e09eafcb6fc8b6ecde))
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
### Bug Fixes
* 修复复制流水线出现的各种问题 ([6314e8d](https://github.com/certd/certd/commit/6314e8d7eb58cd52e2a7bd3b5ffb9112b0b69577))
* 修复windows下无法执行第二条命令的bug ([71ac8aa](https://github.com/certd/certd/commit/71ac8aae4aa694e1a23761e9761c9fba30b43a21))
### Performance Improvements
* 阶段、任务、步骤全面支持拖动排序 ([bd73a16](https://github.com/certd/certd/commit/bd73a163cd0497f062bd424ddc6bc9bbc95f81ea))
* 任务配置不需要的字段可以自动隐藏 ([192d9dc](https://github.com/certd/certd/commit/192d9dc7e36737d684c769f255f407c28b1152ac))
* 任务支持拖动排序 ([1e9b563](https://github.com/certd/certd/commit/1e9b5638aa36a8ce70019a9c750230ba41938327))
* 西部数据支持用户级的apikey ([1c17b41](https://github.com/certd/certd/commit/1c17b41e160944b073e1849e6f9467c3659a4bfc))
* 修复windows下无法执行第二条命令的bug ([d5bfcdb](https://github.com/certd/certd/commit/d5bfcdb6de1dcc1702155442e2e00237d0bbb6e5))
* 优化跳过处理逻辑 ([b80210f](https://github.com/certd/certd/commit/b80210f24bf5db1c958d06ab27c9e5d3db452eda))
* 支持阿里云oss ([87a2673](https://github.com/certd/certd/commit/87a2673e8c33dff6eda1b836d92ecc121564ed78))
* 支持西部数码DNS ([c59cab1](https://github.com/certd/certd/commit/c59cab1aaeb19f86df8e3e0d8127cbd0a9ef77f3))
* 支持pfx、der ([fbeaed2](https://github.com/certd/certd/commit/fbeaed203519f59b6d9396c4e8953353ccb5e723))
* client 请求超时时间延长为10s ([ff46771](https://github.com/certd/certd/commit/ff46771d8dd43e71c1ca70e3ba783945750342cc))
## [1.24.1](https://github.com/certd/certd/compare/v1.24.0...v1.24.1) (2024-09-02)
### Bug Fixes
* 激活仅限管理员 ([1c17970](https://github.com/certd/certd/commit/1c17970b981f0987c506744ee6b2283fd5e40493))
* 修复在没有勾选使用代理的情况下仍然会使用代理的bug ([0f66794](https://github.com/certd/certd/commit/0f6679425f6a736bb0128527dd99c085fac17d84))
### Performance Improvements
* 部署插件支持宝塔、易盾云等 ([ee61709](https://github.com/certd/certd/commit/ee617095efa1171548cf52fd45f0f98a368555a3))
* 授权配置支持加密 ([42a56b5](https://github.com/certd/certd/commit/42a56b581d754c3e5f9838179d19ab0d004ef2eb))
* 优化内存占用 ([db61033](https://github.com/certd/certd/commit/db6103363364440b650bc10bb334834e4a9470c7))
* 支持阿里云 DCDN ([98b77f8](https://github.com/certd/certd/commit/98b77f80843834616fb26f83b4c42245326abd06))
* 支持已跳过的步骤重新运行 ([ea775ad](https://github.com/certd/certd/commit/ea775adae18d57a04470cfba6b9460d761d74035))
* 支持cdnfly ([724a850](https://github.com/certd/certd/commit/724a85028b4a7146c9e3b4df4497dcf2a7bf7c67))
* 支持ftp上传 ([b9bddbf](https://github.com/certd/certd/commit/b9bddbfabb5664365f1232e9432532187c98006c))
# [1.24.0](https://github.com/certd/certd/compare/v1.23.1...v1.24.0) (2024-08-25)
### Bug Fixes
* 部署到腾讯云cdn选择证书任务步骤限制只能选证书 ([3345c14](https://github.com/certd/certd/commit/3345c145b802170f75a098a35d0c4b8312efcd17))
* 修复成功后跳过之后丢失腾讯云证书id的bug ([37eb762](https://github.com/certd/certd/commit/37eb762afe25c5896b75dee25f32809f8426e7b7))
* 修复创建流水线后立即运行时报no id错误的bug ([17ead54](https://github.com/certd/certd/commit/17ead547aab25333603980304aa3aad3db1f73d5))
* 修复使用代理的情况下申请证书失败的bug ([95122e2](https://github.com/certd/certd/commit/95122e28609333f4df55c266e5434897954c0fb3))
* 修复执行日志没有清理的bug ([22a3363](https://github.com/certd/certd/commit/22a336370a88a7df2a23c967043bae153da71ed5))
* 修复重置密码参数配置后无效的bug ([e358a88](https://github.com/certd/certd/commit/e358a8869696578687306e4cd0dcda53f898fe13))
* 修复ssh无法连接成功无法执行命令的bug ([41b9837](https://github.com/certd/certd/commit/41b9837582323fb400ef8525ce65e8b37ad4b36f))
### Features
* 支持ECC类型 ([a7424e0](https://github.com/certd/certd/commit/a7424e02f5c7e02ac1688791040785920ce67473))
* 支持google证书申请需要使用代理 ([a593056](https://github.com/certd/certd/commit/a593056e79e99dd6a74f75b5eab621af7248cfbe))
### Performance Improvements
* 更新k8s底层api库 ([746bb9d](https://github.com/certd/certd/commit/746bb9d385e2f397daef4976eca1d4782a2f5ebd))
* 优化成功后跳过的提示 ([7b451bb](https://github.com/certd/certd/commit/7b451bbf6e6337507f4627b5a845f5bd96ab4f7b))
* 优化证书申请成功率 ([968c469](https://github.com/certd/certd/commit/968c4690a07f69c08dcb3d3a494da4e319627345))
* 优化dnspod的token id 说明 ([790bf11](https://github.com/certd/certd/commit/790bf11af06d6264ef74bc1bb919661f0354239a))
* email proxy ([453f1ba](https://github.com/certd/certd/commit/453f1baa0b9eb0f648aa1b71ccf5a95b202ce13f))
## [1.23.1](https://github.com/certd/certd/compare/v1.23.0...v1.23.1) (2024-08-06)
### Bug Fixes
* 修复模糊查询无效的bug ([9355917](https://github.com/certd/certd/commit/93559174c780173f0daec7cdbd1f72f8d5c504d5))
### Performance Improvements
* 优化插件字段的default value ([24c7be2](https://github.com/certd/certd/commit/24c7be2c9cb39c14f7a97b674127c88033280b02))
* 优化默认值设置 ([1af19f0](https://github.com/certd/certd/commit/1af19f0ac053fe109782882964533636b5969d6b))
# [1.23.0](https://github.com/certd/certd/compare/v1.22.9...v1.23.0) (2024-08-05)
### Bug Fixes
* 修复环境变量多个下划线不生效的bug ([7ec2218](https://github.com/certd/certd/commit/7ec2218c9fee5bee2bf0aa31f3e3a4301575f247))
### Features
* use node 20 ([e8ed972](https://github.com/certd/certd/commit/e8ed97206bf28e83f942db2ef4ea07fa76fd3567))
## [1.22.9](https://github.com/certd/certd/compare/v1.22.8...v1.22.9) (2024-08-05)
### Performance Improvements
* 优化定时任务 ([87e440e](https://github.com/certd/certd/commit/87e440ee2a8b10dc571ce619f28bc83c1e5eb147))
## [1.22.8](https://github.com/certd/certd/compare/v1.22.7...v1.22.8) (2024-08-05)
### Performance Improvements
* 修复删除历史记录没有删除log的bug新增history管理页面演示站点启动时不自动启动非管理员用户的定时任务 ([f78ae93](https://github.com/certd/certd/commit/f78ae93eedfe214008c3d071ca3d77c962137a64))
* 优化pipeline删除时删除其他history ([b425203](https://github.com/certd/certd/commit/b4252033d56a9ad950f3e204ff021497c3978015))
## [1.22.7](https://github.com/certd/certd/compare/v1.22.6...v1.22.7) (2024-08-04)
### Bug Fixes
* 修复保存配置报id不能为空的bug ([367f807](https://github.com/certd/certd/commit/367f80731396003416665c22853dfbc09c2c03a0))
## [1.22.6](https://github.com/certd/certd/compare/v1.22.5...v1.22.6) (2024-08-03)
### Bug Fixes
* 修复在相同的cron时偶尔无法触发定时任务的bug ([680941a](https://github.com/certd/certd/commit/680941af119619006b592e3ab6fb112cb5556a8b))
* 修复pg下pipeline title 类型问题 ([a9717b9](https://github.com/certd/certd/commit/a9717b9a0df7b5a64d4fe03314fecad4f59774cc))
### Performance Improvements
* 流水线支持名称模糊查询 ([59897c4](https://github.com/certd/certd/commit/59897c4ceae992ebe2972ca9e8f9196616ffdfd7))
* 腾讯云clb支持更多大区选择 ([e4f4570](https://github.com/certd/certd/commit/e4f4570b29f26c60f1ee9660a4c507cbeaba3d7e))
* 优化前置任务输出为空的提示 ([6ed1e18](https://github.com/certd/certd/commit/6ed1e18c7d9c46d964ecc6abc90f3908297b7632))
## [1.22.5](https://github.com/certd/certd/compare/v1.22.4...v1.22.5) (2024-07-26)
### Bug Fixes
* 修复用户管理无法添加用户的bug ([e7e89b8](https://github.com/certd/certd/commit/e7e89b8de7386e84c0d6b8e217e2034909657d68))
## [1.22.4](https://github.com/certd/certd/compare/v1.22.3...v1.22.4) (2024-07-26)
### Performance Improvements
* 证书申请支持反向代理letsencrypt无法访问时的备用方案 ([b7b5df0](https://github.com/certd/certd/commit/b7b5df0587e0f7ea288c1b2af6f87211f207395f))
* 支持arm64 ([fa14f87](https://github.com/certd/certd/commit/fa14f87a8093ef3addc5e5f3315ce1bfc9982782))
## [1.22.3](https://github.com/certd/certd/compare/v1.22.2...v1.22.3) (2024-07-25)
### Bug Fixes
* lege 无执行权限问题 ([338eb3b](https://github.com/certd/certd/commit/338eb3bdfeb461e9b3bc7eee97b97a59f5642ffe))
## [1.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
### Bug Fixes
* 修复创建流水线时无法根据dns类型默认正确的dns授权的bug ([a2c43b5](https://github.com/certd/certd/commit/a2c43b50a6069ed48958fd142844a8568c2af452))
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
### Performance Improvements
* 创建证书任务可以选择lege插件 ([affef13](https://github.com/certd/certd/commit/affef130378030c517250c58a4e787b0fc85d7d1))
* 创建证书任务增加定时任务和邮件通知输入 ([427620d](https://github.com/certd/certd/commit/427620d34f3b8ad6933005faf1878908441a2453))
* 支持配置启动后自动触发一次任务 ([a5a0c1f](https://github.com/certd/certd/commit/a5a0c1f6e7a3f05e581005e491d5b102ee854412))
# [1.22.0](https://github.com/certd/certd/compare/v1.21.2...v1.22.0) (2024-07-19)
### Features
* 升级midway支持esm ([485e603](https://github.com/certd/certd/commit/485e603b5165c28bc08694997726eaf2a585ebe7))
* 支持lego海量DNS提供商 ([0bc6d0a](https://github.com/certd/certd/commit/0bc6d0a211920fb0084d705e1db67ee1e7262c44))
* 支持postgresql ([3b19bfb](https://github.com/certd/certd/commit/3b19bfb4291e89064b3b407a80dae092d54747d5))
### Performance Improvements
* 优化一些小细节 ([b168852](https://github.com/certd/certd/commit/b1688525dbbbfd67e0ab1cf5b4ddfbe9d394f370))
* 增加备案号设置 ([bd3d959](https://github.com/certd/certd/commit/bd3d959944db63a5690b55ee150e1007133868b9))
* 自动生成jwtkey无需手动配置 ([390e485](https://github.com/certd/certd/commit/390e4853a570390a97df6a3b3882579f9547eeb4))
## [1.21.2](https://github.com/certd/certd/compare/v1.21.1...v1.21.2) (2024-07-08)
### Performance Improvements
* 申请证书时可以选择跳过本地dns校验 ([fe91d94](https://github.com/certd/certd/commit/fe91d94090d22ed0a3ea753ba74dfaa1bf057c17))
## [1.21.1](https://github.com/certd/certd/compare/v1.21.0...v1.21.1) (2024-07-08)
### Performance Improvements
* 上传到主机支持设置不mkdirs ([5ba9831](https://github.com/certd/certd/commit/5ba9831ed1aa6ec6057df246f1035b36b9c41d2e))
* 说明优化,默认值优化 ([970c7fd](https://github.com/certd/certd/commit/970c7fd8a0f557770e973d8462ee5684ef742810))
# [1.21.0](https://github.com/certd/certd/compare/v1.20.17...v1.21.0) (2024-07-03)
### Features
* 支持zero ssl ([eade2c2](https://github.com/certd/certd/commit/eade2c2b681569f03e9cd466e7d5bcd6703ed492))
## [1.20.17](https://github.com/certd/certd/compare/v1.20.16...v1.20.17) (2024-07-03)
### Performance Improvements
* 创建dns解析后强制等待60s ([f47b35f](https://github.com/certd/certd/commit/f47b35f6d5bd7d675005c3e286b7e9a029201f8b))
* 文件上传提示由cert.crt改为cert.pem ([a09b0e4](https://github.com/certd/certd/commit/a09b0e48c176f3ed763791bd50322c29729f7c1c))
* 优化cname verify ([eba333d](https://github.com/certd/certd/commit/eba333de7a5b5ef4b0b7eaa904f578720102fa61))
## [1.20.16](https://github.com/certd/certd/compare/v1.20.15...v1.20.16) (2024-07-01)
### Bug Fixes
* 修复配置了cdn cname后申请失败的bug ([4a5fa76](https://github.com/certd/certd/commit/4a5fa767edc347d03d29a467e86c9a4d70b0220c))
## [1.20.15](https://github.com/certd/certd/compare/v1.20.14...v1.20.15) (2024-06-28)
### Bug Fixes
* 修复无法强制取消任务的bug ([9cc01db](https://github.com/certd/certd/commit/9cc01db1d569a5c45bb3e731f35d85df324a8e62))
### Performance Improvements
* 腾讯云dns provider 支持腾讯云的accessId ([e0eb3a4](https://github.com/certd/certd/commit/e0eb3a441384d474fe2923c69b25318264bdc9df))
* 支持windows文件上传 ([7f61cab](https://github.com/certd/certd/commit/7f61cab101fa13b4e88234e9ad47434e6130fed2))
## [1.20.14](https://github.com/certd/certd/compare/v1.20.13...v1.20.14) (2024-06-23)
### Bug Fixes
* 修复修改密码功能异常问题 ([f740ff5](https://github.com/certd/certd/commit/f740ff517f521dce361284c2c54bccc68aee0ea2))
## [1.20.13](https://github.com/certd/certd/compare/v1.20.12...v1.20.13) (2024-06-18)
### Bug Fixes
* 日志高度越界 ([c4c9adb](https://github.com/certd/certd/commit/c4c9adb8bfd513f57252e523794e3799a9b220f8))
* 修复邮箱设置页面SMTP拼写错误的问题 ([b98f1c0](https://github.com/certd/certd/commit/b98f1c0dd0bc6c6b4f814c578692afdf6d90b88d))
* 修复logo问题 ([7e483e6](https://github.com/certd/certd/commit/7e483e60913d509b113148c735fe13ba1d72dddf))
### Performance Improvements
* 增加警告,修复一些样式错乱问题 ([fd54c2f](https://github.com/certd/certd/commit/fd54c2ffac492222e85ff2f5f49a9ee5cfc73588))
* ssh登录支持openssh格式私钥、支持私钥密码 ([5c2c508](https://github.com/certd/certd/commit/5c2c50839a9076004f9034d754ac6deb531acdfb))
## [1.20.12](https://github.com/certd/certd/compare/v1.20.10...v1.20.12) (2024-06-17)
### Bug Fixes
* 修复aliyun域名超过100个找不到域名的bug ([5b1494b](https://github.com/certd/certd/commit/5b1494b3ce93d1026dc56ee741342fbb8bf7be24))
### Performance Improvements
* 增加系统设置,可以关闭自助注册功能 ([20feace](https://github.com/certd/certd/commit/20feacea12d43386540db6a600f391d786be4014))
* 增加cloudflare access token说明 ([934e6e2](https://github.com/certd/certd/commit/934e6e2bd05387cd50ffab95f230933543954098))
* 支持重置管理员密码,忘记密码的补救方案 ([732cbc5](https://github.com/certd/certd/commit/732cbc5e927b526850724594830392b2f10c6705))
* 支持cloudflare域名 ([fbb9a47](https://github.com/certd/certd/commit/fbb9a47e8f7bb805289b9ee64bd46ffee0f01c06))
## [1.20.10](https://github.com/certd/certd/compare/v1.20.9...v1.20.10) (2024-05-30)
### Bug Fixes
* 增加权限相关helper说明 ([83e4083](https://github.com/certd/certd/commit/83e40836ebff10bec60efe8933183e1ba1c22bf9))
* 增加权限相关helper说明 ([4304c94](https://github.com/certd/certd/commit/4304c9443ad9248f63dd6d8c512d8d6f32f90d37))
### Performance Improvements
* 上传到主机插件支持复制到本机路径 ([92446c3](https://github.com/certd/certd/commit/92446c339936f98f08f654b8971a7393d8435224))
* 优化文件下载包名 ([d9eb927](https://github.com/certd/certd/commit/d9eb927b0a1445feab08b1958aa9ea80637a5ae6))
* 增加任务复制功能 ([39ad759](https://github.com/certd/certd/commit/39ad7597fa0e19cc1f7631bbd6fea0a9e05a62c9))
## [1.20.9](https://github.com/certd/certd/compare/v1.20.8...v1.20.9) (2024-03-22)
**Note:** Version bump only for package root
## [1.20.8](https://github.com/certd/certd/compare/v1.20.7...v1.20.8) (2024-03-22)
**Note:** Version bump only for package root
## [1.20.7](https://github.com/certd/certd/compare/v1.20.6...v1.20.7) (2024-03-22)
**Note:** Version bump only for package root
## [1.20.6](https://github.com/certd/certd/compare/v1.20.5...v1.20.6) (2024-03-21)
### Bug Fixes
* 调整按钮图标到居中位置 ([836d18f](https://github.com/certd/certd/commit/836d18f07e22d00faf2f213bc3301a6672b5bafc))
### Performance Improvements
* 插件贡献文档及示例 ([72fb20a](https://github.com/certd/certd/commit/72fb20abf3ba5bdd862575d2907703a52fd7eb17))
## [1.20.5](https://github.com/certd/certd/compare/v1.20.2...v1.20.5) (2024-03-11)
### Bug Fixes
* 修复腾讯云cdn部署无法选择端点的bug ([154409b](https://github.com/certd/certd/commit/154409b1dfee3ea1caae740ad9c1f99a6e7a9814))
## [1.20.2](https://github.com/certd/certd/compare/v1.2.1...v1.20.2) (2024-02-28)
### Bug Fixes
* 临时修复阿里云domainlist接口返回域名列表不全的问题后续还需要增加翻页查询 ([849c145](https://github.com/certd/certd/commit/849c145926984762bd9dbec87bd91cd047fc0855))
## [1.2.1](https://github.com/certd/certd/compare/v1.2.0...v1.2.1) (2023-12-12)
### Bug Fixes
* 修复邮箱设置无效的bug ([aaa3224](https://github.com/certd/certd/commit/aaa322464d0f65e924d1850995540d396ee24d25))
**Note:** Version bump only for package root
# [1.2.0](https://github.com/certd/certd/compare/v1.1.6...v1.2.0) (2023-10-27)
* 🔱: [client] sync upgrade with 2 commits [trident-sync] ([aa3207f](https://github.com/certd/certd/commit/aa3207fca5f15f7c3da789989d99c8ae7d1c4551))
### BREAKING CHANGES
* search支持自定义布局search.layout、search.collapse转移到 search.container之下。如果想使用原来的search组件请配置search.is=fs-search-v1
## [1.1.6](https://github.com/certd/certd/compare/v1.1.5...v1.1.6) (2023-07-10)
### Bug Fixes
* 修复上传证书到腾讯云失败的bug ([e950322](https://github.com/certd/certd/commit/e950322232e19d1263b8552eefa5b0150fd7864e))
## [1.1.5](https://github.com/certd/certd/compare/v1.1.4...v1.1.5) (2023-07-03)
**Note:** Version bump only for package root
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Bug Fixes
* 成功图标转动的问题 ([f87eee3](https://github.com/certd/certd/commit/f87eee3b9ff1ef9874e79a81fe0ed7104cb9ee8c))
### Performance Improvements
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
* flush logger ([91be682](https://github.com/certd/certd/commit/91be6826b902e0f302b1a6cbdb1d24e15914c18d))
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package root
## [1.1.2](https://github.com/certd/certd/compare/v1.1.1...v1.1.2) (2023-07-03)
**Note:** Version bump only for package root
## [1.1.1](https://github.com/certd/certd/compare/v1.1.0...v1.1.1) (2023-06-28)
**Note:** Version bump only for package root
# [1.1.0](https://github.com/certd/certd/compare/v1.0.6...v1.1.0) (2023-06-28)
### Bug Fixes
* 修复access选择类型trigger ([2851a33](https://github.com/certd/certd/commit/2851a33eb2510f038fadb55da29512597a4ba512))
### Features
* 权限控制 ([27a4c81](https://github.com/certd/certd/commit/27a4c81c6d70e70abb3892c3ea58d4719988808a))
* 邮件通知 ([937e3fa](https://github.com/certd/certd/commit/937e3fac19cd03b8aa91db8ba03fda7fcfbacea2))
* cert download ([5a51c14](https://github.com/certd/certd/commit/5a51c14de521cb8075a80d2ae41a16e6d5281259))
* config merge ([fdc25dc](https://github.com/certd/certd/commit/fdc25dc0d795555cffacc4572648ec158988fbbb))
* save files ([99522fb](https://github.com/certd/certd/commit/99522fb49adb42c1dfdf7bec3dd52d641158285b))
* save files ([671d273](https://github.com/certd/certd/commit/671d273e2f9136d16896536b0ca127cf372f1619))
## [1.0.6](https://github.com/certd/certd/compare/v1.0.5...v1.0.6) (2023-05-25)
**Note:** Version bump only for package root
## [1.0.5](https://github.com/certd/certd/compare/v1.0.4...v1.0.5) (2023-05-25)
**Note:** Version bump only for package root
## [1.0.4](https://github.com/certd/certd/compare/v1.0.3...v1.0.4) (2023-05-25)
**Note:** Version bump only for package root
## [1.0.3](https://github.com/certd/certd/compare/v1.0.2...v1.0.3) (2023-05-25)
**Note:** Version bump only for package root
## [1.0.2](https://github.com/certd/certd/compare/v1.0.1...v1.0.2) (2023-05-24)
**Note:** Version bump only for package root
## [1.0.1](https://github.com/certd/certd/compare/v1.0.0...v1.0.1) (2023-05-24)
**Note:** Version bump only for package root

674
LICENSE
View File

@@ -1,21 +1,661 @@
MIT License
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (c) 2021 Greper
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Preamble
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

30
LICENSE.md Normal file
View File

@@ -0,0 +1,30 @@
# Certd Open Source License
- This project is licensed under the **GNU Affero General Public License (AGPL)** with the following additional terms.
- 本项目遵循 GNU Affero General Public LicenseAGPL并附加以下条款。
## 1. License Terms ( 许可证条款 )
1. **Freedom to Use** (自由使用)
- You are free to use, copy, modify, and distribute the source code of this project for personal or organizational use, provided that you comply with the terms of this license.
- 您可以自由使用、复制、修改和分发本项目的源代码,前提是您遵循本许可证的条款。
2. **Modification for Personal Use** (个人使用的修改)
- Individuals and companies are allowed to modify the project according to their needs for non-commercial purposes. However, modifications to the logo, copyright information, or any code related to licensing are strictly prohibited.
- 个人和公司允许根据自身需求对本项目进行修改以供非商业用途。但任何对logo、版权信息或与许可相关代码的修改都是严格禁止的。
3. **Commercial Authorization** (商业授权)
- If you wish to make any form of monetary gain from this project, you must first obtain commercial authorization from the original author. Users should contact the author directly to negotiate the relevant licensing terms.
- 如果您希望从本项目获得任何形式的经济收益,您必须首先从原作者处获得商业授权,用户应直接与作者联系,以协商相关许可条款。
4. **Retention of Rights** (保留权利)
- All rights, title, and interest in the project remain with the original author.
- 本项目的所有权利、标题和利益仍归原作者所有。
## 2. As a contributor ( 作为贡献者 )
- you should agree that your contributed code:
- 您应同意您贡献的代码:
1. - The original author can adjust the open-source agreement to be more strict or relaxed.
- 原作者可以调整开源协议以使其更严格或更宽松。
2. - Can be used for commercial purposes.
- 可用于商业用途。

352
README.md
View File

@@ -1,139 +1,259 @@
# CertD
# Certd
CertD 是一个帮助你全自动申请和部署SSL证书的工具。
后缀D取自linux守护进程的命名风格意为证书守护进程。
Certd 是一个免费全自动申请和自动部署更新SSL证书的工具。
后缀d取自linux守护进程的命名风格意为证书守护进程。
## 特性
本项目不仅支持证书申请过程自动化,还可以自动化部署证书,让你的证书永不过期。
关键字:证书自动申请、证书自动更新、证书自动续期、证书自动续签
* 全自动申请证书
* 全自动部署证书(目前支持服务器上传部署、阿里云、腾讯云等)
* 可与CI/DI工具结合使用
************************
支持开源,为爱发电,我已入驻爱发电
https://afdian.com/a/greper
## 免费证书申请说明
发电权益:
1. 可加入发电专属群,可以获得作者一对一技术支持
2. 您的需求我们将优先实现,并且将作为专业版功能提供
3. 一年期专业版激活码
4. 赠送国外免费服务器部署方案0成本使用Certd可能需要翻墙不过现在性能越来越差了
专业版特权
1. 证书流水线条数无限制免费版限制10条
2. 免配置发邮件功能
3. FTP上传、cdnfly、宝塔等部署插件
4. 更多功能增加中...
************************
## 一、特性
本项目不仅支持证书申请过程自动化,还可以自动化部署更新证书,让你的证书永不过期。
* 全自动申请证书支持阿里云、腾讯云、华为云、Cloudflare等各种途径注册的域名
* 全自动部署更新证书(目前支持部署到主机、部署到阿里云、腾讯云等)
* 支持通配符域名/泛域名,支持多个域名打到一个证书上
* 邮件通知
* 私有化部署,保障安全
* 免费、免费、免费([阿里云单个通配符域名证书最便宜也要1800/年](https://yundun.console.aliyun.com/?p=cas#/certExtend/buy/cn-hangzhou)
## 二、在线体验
官方Demo地址自助注册后体验
https://certd.handsfree.work/
> 注意数据将不定期清理,不定期停止定时任务,生产使用请自行部署
> 包含敏感信息,务必自己本地部署进行生产使用
## 三、使用教程
本案例演示如何配置自动申请证书并部署到阿里云CDN然后快要到期前自动更新证书并重新部署
![演示](./doc/images/5-view.png)
![演示](./doc/images/9-start.png)
![演示](./doc/images/10-1-log.png)
![演示](./doc/images/13-3-download.png)
![演示](./doc/images/13-1-result.png)
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
-------> [点我查看详细使用步骤演示](./step.md) <--------
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
当前支持的部署插件列表
![演示](./doc/images/plugins.png)
## 四、私有化部署
由于证书、授权信息等属于高度敏感数据,请务必私有化部署,保障数据安全
### 4.1 宝塔面板一键部署
1. 安装宝塔面板,前往 [宝塔面板](https://www.bt.cn/u/CL3JHS) 官网选择9.2.0以上正式版的脚本下载安装
2. 安装后登录宝塔面板,在菜单栏中点击 Docker首次进入会提示安装Docker服务点击立即安装按提示完成安装
3. 安装完成后在应用商店中找到`certd`(要先点右上角更新应用),点击安装,配置域名等基本信息即可完成安装
### 4.2 宝塔面板容器编排部署
[宝塔面板容器编排部署教程](./doc/deploy/baota/baota.md)
### 4.3 Docker部署
#### 1. 安装docker、docker-compose
1.1 准备一台云服务器
* 【阿里云】云服务器2核2G新老用户同享99元/年,续费同价!【 [立即购买](https://www.aliyun.com/benefit?scm=20140722.M_10244282._.V_1&source=5176.11533457&userCode=qya11txb )】
* 【腾讯云】云服务器2核2G新老用户同享99元/年,续费同价!【 [立即购买](https://cloud.tencent.com/act/cps/redirect?redirect=6094&cps_key=b3ef73330335d7a6efa4a4bbeeb6b2c9&from=console)】
1.2 安装docker
https://docs.docker.com/engine/install/
选择对应的操作系统,按照官方文档执行命令即可
#### 2. 运行certd
[docker-compose.yaml 下载](https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml)
当前版本号: ![](https://img.shields.io/npm/v/%40certd%2Fpipeline)
```bash
# 随便创建一个目录
mkdir certd
# 进入目录
cd certd
# 下载docker-compose.yaml文件或者手动下载放到certd目录下
wget https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml
# 可以根据需要修改里面的配置
# 1.修改镜像版本号【可选】
# 2.配置数据保存路径【可选】
# 3.修改端口号【可选】
vi docker-compose.yaml # 【可选】
# 启动certd
docker compose up -d
```
> 如果提示 没有compose命令,请安装docker-compose
> https://docs.docker.com/compose/install/linux/
#### 3. 镜像说明:
* 国内镜像地址:
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest`
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:armv7``[version]-armv7`
* DockerHub地址
* `https://hub.docker.com/r/greper/certd`
* `greper/certd:latest`
* `greper/certd:armv7``greper/certd:[version]-armv7`
* 镜像构建通过`Actions`自动执行,过程公开透明,请放心使用
* [点我查看镜像构建日志](https://github.com/certd/certd/actions/workflows/build-image.yml)
![](./doc/images/action-build.jpg)
#### 4. 访问测试
http://your_server_ip:7001
默认账号密码admin/123456
记得修改密码
### 4.4 源码部署
```shell
# 克隆代码
git clone https://github.com/certd/certd
cd certd
./start.sh
```
## 五、 升级
如果使用固定版本号
1. 修改`docker-compose.yaml`中的镜像版本号
2. 运行`docker compose up -d` 即可
如果使用`latest`版本
```shell
#重新拉取镜像
docker pull registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
# 重新启动容器
docker compose down
docker compose up -d
```
> 数据默认存在`/data/certd`目录下,不用担心数据丢失
更新日志: [CHANGELOG](./CHANGELOG.md)
## 六、一些说明
* 本项目ssl证书提供商为letencrypt
* 申请过程遵循acme协议
* 需要验证域名所有权一般有两种方式目前本项目仅支持dns-01
* http-01 在网站根目录下放置一份txt文件
* dns-01 需要给域名添加txt解析记录域名只能用这种方式
* 需要验证域名所有权一般有两种方式目前本项目仅支持dns-01
* http-01 在网站根目录下放置一份txt文件
* dns-01 需要给域名添加txt解析记录通配符域名只能用这种方式
* 证书续期:
* 实际上acme并没有续期概念
* 我们所说的续期,其实就是按照全套流程重新申请一份新证书。
* 实际上没有办法不改变证书文件本身情况下直接续期或者续签
* 我们所说的续期,其实就是按照全套流程重新申请一份新证书,然后重新部署上去
* 免费证书过期时间90天以后可能还会缩短所以自动化部署必不可少
* 设置每天自动运行当证书过期前20天会自动重新申请证书并部署
## 七、不同平台的设置说明
## 快速开始
本案例演示如何配置自动申请证书并部署到阿里云CDN然后快要到期前自动更新证书并重新部署
* [Cloudflare](./doc/cf/cf.md)
* [腾讯云](./doc/tencent/tencent.md)
* [windows主机](./doc/host/host.md)
* [google证书](./doc/google/google.md)
* [群晖部署certd及证书更新教程](./doc/synology/index.md)
1. 环境准备
安装[nodejs](https://nodejs.org/zh-cn/)
2. 生成node项目
通过ui生成 https://certd.docmirror.cn/
开始生成证书,先填写域名,支持将多个域名打到一个证书上
![](./doc/step1.png)
配置证书详细信息
![](./doc/step2.png)
配置证书部署流程
![](./doc/step3.png)
配置好之后点击导出按钮导出一个node项目包
4. 运行
将导出的压缩包解压,然后执行如下命令,即可开始申请证书并部署
## 八、问题处理
### 7.1 忘记管理员密码
解决方法如下:
1. 修改docker-compose.yaml文件将环境变量`certd_system_resetAdminPasswd`改为`true`
```yaml
services:
certd:
environment: # 环境变量
- certd_system_resetAdminPasswd=false
```
npm install
npm run certd
2. 重启容器
```shell
docker compose up -d
docker logs -f --tail 500 certd
# 观察日志当日志中输出“重置1号管理员用户的密码完成”即可操作下一步
```
5. 执行效果
生成的证书默认会存储在 `${home}/.certd/${email}/certs/${domain}/current`目录下
3. 修改docker-compose.yaml`certd_system_resetAdminPasswd`改回`false`
4. 再次重启容器
```shell
docker compose up -d
```
[2021-01-08T16:15:04.681] [INFO] certd - 任务完成
[2021-01-08T16:15:04.681] [INFO] certd - ---------------------------任务结果总览--------------------------
[2021-01-08T16:15:04.682] [INFO] certd - 【更新证书】--------------------------------------- [success]
证书申请成功
[2021-01-08T16:15:04.682] [INFO] certd - 【流程1-部署到阿里云CDN】---------------------------- [success] 执行成功
[2021-01-08T16:15:04.682] [INFO] certd - └【上传到阿里云】-------------------------------- [success] 执行成功
[2021-01-08T16:15:04.682] [INFO] certd - └【部署证书到CDN】------------------------------- [success] 执行成功
```
6. 证书续期
实际上没有证书续期的概念,只有重新生成一份新的证书,然后重新部署证书
所以每天定时运行即可当证书过期日前20天时会重新申请新的证书然后执行部署任务。
5. 使用`admin/123456`登录系统,请及时修改管理员密码
7. 其他说明
证书的部署任务执行后会记录执行结果,已经成功过的不会重复执行
所以当你临时需要将证书部署到其他地方时,直接追加部署任务,然后再次运行即可
## CI/DI集成与自动续期重新部署
集成前将以上导出的node项目提交到内网git仓库或者私有git仓库由于包含敏感信息不要提交到公开git仓库
### jenkins任务
1. 创建任务
选择构建自由风格的任务
2. 配置git
配置cert-run的git地址
3. 构建触发器
配置 `H 3 * * *` 每天凌晨3点-4点执行一次
4. 构建环境
勾选 `Provide Node & npm bin/ folder to PATH`提供nodejs运行环境
如果没有此选项需要jenkins安装`nodejs`插件
5. 构建
执行shell
```
npm install --production #执行过一次之后,就可以注释掉,加快执行速度
npm run post
```
6. 构建后操作
邮件通知
配置你的邮箱地址,可以在执行失败时收到邮件通知。
## 九、联系作者
如有疑问欢迎加入群聊请备注certd
* QQ群141236433
* 微信群:
![](https://ai.handsfree.work/images/exchange_wxqroup.png)
## API
先列个提纲,待完善
加作者好友
<p align="center">
<img height="230" src="./doc/images/me.png">
</p>
参数示例参考https://gitee.com/certd/certd/blob/master/test/options.js
## 十、捐赠
支持开源,为爱发电,我已入驻爱发电
https://afdian.com/a/greper
### 授权提供者
用于dns验证接口调用
#### aliyun
#### dnspod
### deploy插件
部署任务插件
#### 阿里云
##### 上传到阿里云
type = uploadCertToAliyun
##### 部署到阿里云DNS
type = deployCertToAliyunCDN
##### 部署到阿里云CLB
type = deployCertToAliyunCLB
#### 腾讯云
##### 上传到腾讯云
type = uploadCertToTencent
##### 部署到腾讯云DNS
type = deployCertToTencentDNS
##### 部署到腾讯云CLB
type = deployCertToTencentCLB
##### 部署到腾讯云TKE-ingress
type = deployCertToTencentTKEIngress
发电权益:
1. 可加入发电专属群(先加我好友,发送发电截图,我拉你进群)
2. 你的需求优先实现
3. 可以获得作者一对一技术支持
4. 更多权益陆续增加中...
## 十一、贡献代码
1. 本地开发 [贡献插件教程](./doc/dev/development.md)
2. 作为贡献者,代表您同意您贡献的代码如下许可:
1. 可以调整开源协议以使其更严格或更宽松。
2. 可以用于商业用途。
## 十二、 开源许可
* 本项目遵循 GNU Affero General Public LicenseAGPL开源协议。
* 允许个人和公司使用、复制、修改和分发本项目,禁止任何形式的商业用途
* 未获得商业授权情况下禁止任何对logo、版权信息及授权许可相关代码的修改。
* 如需商业授权,请联系作者。
## 十三、我的其他项目求Star
* [袖手GPT](https://ai.handsfree.work/) ChatGPT国内可用无需FQ每日免费额度
* [fast-crud](https://gitee.com/fast-crud/fast-crud/) 基于vue3的crud快速开发框架
* [dev-sidecar](https://github.com/docmirror/dev-sidecar/) 直连访问github工具无需FQ解决github无法访问的问题
## 十四、更新日志
更新日志:[CHANGELOG](./CHANGELOG.md)
### 更多部署插件
等你来提需求

1
build.trigger Normal file
View File

@@ -0,0 +1 @@
14:27

106
deploy.js Normal file
View File

@@ -0,0 +1,106 @@
import http from 'axios'
import fs from 'fs'
//读取 packages/core/pipline/package.json的版本号
import {default as packageJson} from './packages/core/pipeline/package.json' assert { type: "json" };
const certdVersion = packageJson.version
console.log("certdVersion", certdVersion)
// 同步npmmirror的包
async function getPackages(directoryPath) {
return new Promise((resolve, reject) => {
// 读取目录下的文件和目录列表
fs.readdir(directoryPath, {withFileTypes: true}, (err, files) => {
if (err) {
console.log('无法读取目录:', err);
reject(err)
return;
}
// 过滤仅保留目录
const directories = files
.filter(file => file.isDirectory())
.map(directory => directory.name);
console.log('目录列表:', directories);
resolve(directories)
});
})
}
async function getAllPackages() {
const base = await getPackages("./packages/core")
const plugins = await getPackages("./packages/plugins")
const libs = await getPackages("./packages/libs")
return base.concat(plugins).concat(libs)
}
async function sync() {
const packages = await getAllPackages()
for (const pkg of packages) {
await http({
url: `http://registry-direct.npmmirror.com/@certd/${pkg}/sync?sync_upstream=true`,
method: 'PUT',
headers: {
"Content-Type": "application/json"
},
data: {}
})
console.log(`sync success:${pkg}`)
await sleep(30*1000)
}
}
// curl -X PUT https://registry-direct.npmmirror.com/@certd/plugin-cert/sync?sync_upstream=true
const certdImageBuild = "http://flow-openapi.aliyun.com/pipeline/webhook/4zgFk3i4RZEMGuQzlOcI"
const certdImageRun = "http://flow-openapi.aliyun.com/pipeline/webhook/lzCzlGrLCOHQaTMMt0mG"
const webhooks = [certdImageBuild,certdImageRun]
async function sleep(time) {
return new Promise(resolve => {
setTimeout(resolve, time)
})
}
async function triggerBuild() {
await sleep(60000)
for (const webhook of webhooks) {
await http({
url: webhook,
method: 'POST',
headers: {
"Content-Type": "application/json"
},
data: {
'CERTD_VERSION': certdVersion
}
})
console.log(`webhook success:${webhook}`)
await sleep(30*60*1000)
}
}
async function start() {
// await build()
console.log("等待60秒")
await sleep(100* 1000)
await sync()
await sleep(100 * 1000)
await triggerBuild()
}
start()
/**
* 打包前 修改 lerna
* nodemodules里面搜索如下
* return childProcess.exec("git", ["add", "--", ...files], execOpts);
*
* ('git', ['add', '--', ...files]
* ('git', ['add', '.']
*/

1
deploy.trigger Normal file
View File

@@ -0,0 +1 @@
5

15
doc/cf/cf.md Normal file
View File

@@ -0,0 +1,15 @@
# Cloudflare
## CF Token申请
### 申请地址:
https://dash.cloudflare.com/profile/api-tokens
### 权限设置:
需要设置权限和资源范围
权限包括Zone.Zone.edit, Zone.DNS.edit
资源范围要包含对应域名推荐直接设置为All Zones
最终效果如下,可以切换语言为英文对比如下图检查
![](./cf_token.png)

BIN
doc/cf/cf_token.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

32
doc/deploy/baota/baota.md Normal file
View File

@@ -0,0 +1,32 @@
# 宝塔部署教程
## 编排模版部署
### 创建docker模版
打开docker-compose.yaml
https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml
整个内容复制下来
然后到宝塔里面进到docker的编排模版新建模版
![](./images/1.png)
### 启动应用
![img.png](./images/2.png)
等待启动完成
### 打开应用
http://ip:7001
## 二、一键应用部署
需要宝塔9.2.0版本
### 应用商店
进入应用商店,更新应用列表
### 搜索certd
点击安装

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

0
doc/deploy/koyeb.md Normal file
View File

76
doc/dev/development.md Normal file
View File

@@ -0,0 +1,76 @@
# 本地开发
欢迎贡献插件
## 1.本地调试运行
安装依赖包:
```shell
# 克隆代码
git clone https://github.com/certd/certd
#进入项目目录
cd certd
# 安装依赖
npm install -g pnpm@8.15.7
pnpm install
# 初始化构建
npm run init
```
启动 server:
```shell
cd packages/ui/certd-server
npm run dev
```
启动 client:
```shell
cd packages/ui/certd-client
npm run dev
# 会自动打开浏览器,确认正常运行
```
## 开发插件
进入 `packages/ui/certd-server/src/plugins`
### 1.复制`plugin-demo`目录作为你的插件目录
比如你想做`cloudflare`的插件,那么你可以复制`plugin-demo`目录,将其命名成`plugin-cloudflare`
以下均以`plugin-cloudflare`为例进行说明,你需要将其替换成你的插件名称
### 2. access授权
如果这是一个新的平台它应该有授权方式比如accessKey accessSecret之类的
参考`plugin-cloudflare/access.ts` 修改为你要做的平台的`access`
这样用户就可以在`certd`后台中创建这种授权凭证了
### 3. dns-provider
如果域名是这个平台进行解析的那么你需要实现dns-provider
参考`plugin-cloudflare/dns-provider.ts` 修改为你要做的平台的`dns-provider`
### 4. plugin-deploy
如果这个平台有需要部署证书的地方
参考`plugin-cloudflare/plugins/plugin-deploy-to-xx.ts` 修改为你要做的平台的`plugin-deploy-to-xx`
### 5. 增加导入
`plugin-cloudflare/index.ts`中增加你的插件的`import`
```ts
export * from './dns-provider'
export * from './access'
export * from './plugins/plugin-deploy-to-xx'
````
`./src/plugins/index.ts``import`
```ts
export * from "./plugin-cloudflare"
```
## 重启服务进行调试
刷新浏览器,检查你的插件是否工作正常, 确保能够正常进行证书申请和部署
## 提交PR
我们将尽快审核PR

37
doc/google/google.md Normal file
View File

@@ -0,0 +1,37 @@
# google证书申请教程
## 1、启用API
打开如下链接,启用 API
https://console.cloud.google.com/apis/library/publicca.googleapis.com
打开该链接后点击“启用”随后等待右侧出现“API已启用”则可以关闭该页。
## 2、 申请Key
随后打开“Google Cloud Shell”在右上角点击激活CloudShell图标
等待分配完成后在 Shell 窗口内输入如下命令:
```shell
gcloud beta publicca external-account-keys create
```
此时会弹出“为 Cloud Shell 提供授权”,点击授权即可。
执行完成后会返回类似如下输出;注意不要在没有收到 Google 的邮件时执行该命令,会返回命令不存在。
```shell
Created an external account key
[b64MacKey: xxxxxxxxxxxxxxxx
keyId: xxxxxxxxxxxxx]
```
记录以上信息备用注意keyId是不带中括号的
## 3、 创建证书流水线
选择证书提供商为google 开启使用代理
## 4、 将key信息作为EAB授权信息
google证书需要EAB授权 使用第二步中的 keyId 和 b64MacKey 信息创建一条EAB授权记录
注意keyId没有`]`结尾,不要把`]`也复制了
## 5、 其他就跟正常申请证书一样了

24
doc/host/host.md Normal file
View File

@@ -0,0 +1,24 @@
# 远程主机
远程主机基于ssh协议通过ssh连接远程主机执行命令。
## windows开启OpenSSH Server
1. 安装OpenSSH Server
请前往Microsoft官方文档查看如何开启openSSH
https://learn.microsoft.com/zh-cn/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui#install-openssh-for-windows
2. 启动OpenSSH Server服务
```
win+R 弹出运行对话框,输入 services.msc 打开服务管理器
找到 OpenSSH SSH Server
启动ssh server服务并且设置为自动启动
```
3. 测试ssh登录
使用你常用的ssh客户端连接你的windows主机进行测试
```cmd
# 如何确定你用户名
C:\Users\xiaoj>
↑↑↑↑---------这个就是windows ssh的登录用户名
```

BIN
doc/images/action-build.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
doc/images/donate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

BIN
doc/images/me.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

BIN
doc/images/plugins.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

BIN
doc/synology/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
doc/synology/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
doc/synology/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
doc/synology/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
doc/synology/images/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
doc/synology/images/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

41
doc/synology/index.md Normal file
View File

@@ -0,0 +1,41 @@
# 群晖部署和证书更新
## 一、群晖系统上部署Certd教程
### 1. 打开Container Manager
![](./images/1.png)
### 2. 新增项目
![](./images/2.png)
### 3. 配置Certd项目
![](./images/3.png)
### 4. 外网访问设置
![](./images/4.png)
### 5. 确认项目信息
![](./images/5.png)
点击完成安装等待certd启动完成即可
### 6. 门户配置向导【可选】
![](./images/6.png)
## 二、更新群晖证书
## 1. 前提条件
* 已经部署了certd
* 群晖上已经设置好了证书(证书建议设置好描述,插件需要根据描述查找证书)
## 2. 在certd上配置自动更新群晖证书插件
![](./images/deploy.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

16
doc/tencent/tencent.md Normal file
View File

@@ -0,0 +1,16 @@
# 腾讯云
## DNSPOD 授权设置
目前腾讯云管理的域名的dns暂时只支持从DNSPOD进行设置
打开 https://console.dnspod.cn/account/token/apikey
然后按如下方式获取DNSPOD的授权
![](./dnspod-token.png)
## 腾讯云API密钥设置
腾讯云其他部署需要API密钥需要在腾讯云控制台进行设置
打开 https://console.cloud.tencent.com/cam/capi
然后按如下方式获取腾讯云的API密钥
![](./tencent-access.png)

View File

@@ -0,0 +1,43 @@
version: '3.3' # 兼容旧版docker-compose
services:
certd:
# 镜像 # ↓↓↓↓↓ --- 镜像版本号,建议改成固定版本号
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
container_name: certd # 容器名
restart: unless-stopped # 自动重启
volumes:
# ↓↓↓↓↓ -------------------------------------------------------- 数据库以及证书存储路径,默认存在宿主机的/data/certd/目录下,【您需要定时备份此目录,以保障数据容灾】
- /data/certd:/app/data
ports: # 端口映射
# ↓↓↓↓ ---------------------------------------------------------- 如果端口有冲突可以修改第一个7001为其他不冲突的端口号
- "7001:7001"
dns:
# ↓↓↓↓ ---------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND等错误可以尝试修改或注释dns配置
- 223.5.5.5
- 223.6.6.6
# ↓↓↓↓ ---------------------------------------------------------- 如果你服务器部署在国外可以用8.8.8.8替换上面的dns
# - 8.8.8.8
# - 8.8.4.4
# extra_hosts:
# ↓↓↓↓ ---------------------------------------------------------- 这里可以配置自定义hosts外网域名可以指向本地局域网ip地址
# - "localdomain.comm:192.168.1.3"
environment: # 环境变量
- TZ=Asia/Shanghai
#- HTTPS_PROXY=http://xxxxxx:xx
#- HTTP_PROXY=http://xxxxxx:xx
# ↑↑↑↑↑ ------------------------------------- 这里可以设置http代理
- certd_system_resetAdminPasswd=false
# ↑↑↑↑↑--------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
- certd_cron_immediateTriggerOnce=false
# ↑↑↑↑↑--------------------------- 如果设置为true启动后所有配置了cron的流水线任务都将被立即触发一次
- VITE_APP_ICP_NO=
# ↑↑↑↑↑ ----------------------------------------- 这里可以设置备案号
#- certd_koa_key=./data/ssl/cert.key
#- certd_koa_cert=./data/ssl/cert.crt
# ↑↑↑↑↑ ----------------------------------------- 配置证书和key则表示https方式启动使用https协议访问https://your.domain:7001
# 设置环境变量即可自定义certd配置
# 服务端配置项见: packages/ui/certd-server/src/config/config.default.ts
# 服务端配置规则: certd_ + 配置项, 点号用_代替
# 客户端配置项见: packages/ui/certd-client/.env
# 按实际名称配置环境变量即可,如: VITE_APP_API=http://localhost:7001

21
init.sh Normal file
View File

@@ -0,0 +1,21 @@
current_pwd=$(pwd)
echo "开始设置git配置"
read -p "请输入username" username
git config user.name $username
read -p "请输入email" email
git config user.email $email
git config credential.helper "store --file=$current_pwd/.git/credential.store"
echo "已设置记住git账号密码"
git config core.autocrlf input
echo "已设置auto crlf = input"
git config core.filemode false
echo "已设置忽略文件模式变化"
echo "git配置完成"

View File

@@ -1,8 +1,13 @@
{
"packages": [
"packages/base/*",
"packages/core/*",
"packages/plugins/*"
],
"version": "0.3.0"
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"command": {
"bootstrap": {
"npmClientArgs": [
"--no-package-lock"
]
}
},
"npmClient": "pnpm",
"version": "1.25.6"
}

View File

@@ -1,16 +1,32 @@
{
"name": "root",
"version": "1.20.4",
"private": true,
"type": "module",
"devDependencies": {
"lerna": "^3.18.4"
"@lerna-lite/cli": "^3.2.1",
"@lerna-lite/publish": "^3.2.1",
"@lerna-lite/run": "^3.2.1",
"@lerna-lite/version": "^3.2.1"
},
"scripts": {
"start": "lerna bootstrap --hoist",
"i-all": "lerna link && lerna exec npm install "
"i-all": "lerna link && lerna exec npm install ",
"publish": "npm run prepublishOnly2 && lerna publish --conventional-commits --create-release github && npm run afterpublishOnly",
"afterpublishOnly": "time /t >build.trigger && git add ./build.trigger && git commit -m \"build: trigger build image\" && TIMEOUT /T 10 && git push",
"prepublishOnly1": "npm run check && lerna run build ",
"prepublishOnly2": "npm run check && npm run before-build && lerna run build ",
"before-build": "cd ./packages/pro/plus-core && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
"deploy1": "node --experimental-json-modules deploy.js ",
"check": "node --experimental-json-modules publish-check.js",
"init": "lerna run build"
},
"license": "MIT",
"license": "AGPL-3.0",
"dependencies": {
"lodash-es": "^4.17.20"
}
"axios": "^1.7.2",
"lodash-es": "^4.17.21"
},
"workspaces": [
"packages/**"
]
}

View File

@@ -0,0 +1,13 @@
#
# http://editorconfig.org
#
root = true
[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[{*.yml,*.yaml}]
indent_size = 2

View File

@@ -0,0 +1,16 @@
extends:
- 'airbnb-base'
env:
browser: false
node: true
mocha: true
rules:
indent: [2, 4, { SwitchCase: 1, VariableDeclarator: 1 }]
brace-style: [2, 'stroustrup', { allowSingleLine: true }]
func-names: 0
class-methods-use-this: 0
no-param-reassign: 0
max-len: [1, 200, 2, { ignoreUrls: true, ignoreComments: false }]
import/no-useless-path-segments: 0

View File

@@ -0,0 +1,61 @@
#!/bin/bash
#
# Install CoreDNS for testing.
#
set -euo pipefail
# Download and install
wget -nv "https://github.com/coredns/coredns/releases/download/v${COREDNS_VERSION}/coredns_${COREDNS_VERSION}_linux_amd64.tgz" -O /tmp/coredns.tgz
tar zxvf /tmp/coredns.tgz -C /usr/local/bin
chown root:root /usr/local/bin/coredns
chmod 0755 /usr/local/bin/coredns
mkdir -p /etc/coredns
# Zones
tee /etc/coredns/db.example.com << EOF
\$ORIGIN example.com.
@ 3600 IN SOA ns.coredns.invalid. master.coredns.invalid. (
2017042745 ; serial
7200 ; refresh
3600 ; retry
1209600 ; expire
3600 ; minimum
)
3600 IN NS ns1.example.com.
3600 IN NS ns2.example.com.
ns1 3600 IN A 127.0.0.1
ns2 3600 IN A 127.0.0.1
@ 3600 IN A 127.0.0.1
www 3600 IN CNAME example.com.
EOF
# Config
tee /etc/coredns/Corefile << EOF
example.com {
errors
log
bind 127.53.53.53
file /etc/coredns/db.example.com
}
test.example.com {
errors
log
bind 127.53.53.53
forward . 127.0.0.1:${PEBBLECTS_DNS_PORT}
}
. {
errors
log
bind 127.53.53.53
forward . 8.8.8.8
}
EOF
exit 0

View File

@@ -0,0 +1,15 @@
#!/bin/bash
#
# Install Pebble Challenge Test Server for testing.
#
set -euo pipefail
# Download and install
wget -nv "https://github.com/letsencrypt/pebble/releases/download/v${PEBBLECTS_VERSION}/pebble-challtestsrv-linux-amd64.tar.gz" -O /tmp/pebble-challtestsrv.tar.gz
tar zxvf /tmp/pebble-challtestsrv.tar.gz -C /tmp
mv /tmp/pebble-challtestsrv-linux-amd64/linux/amd64/pebble-challtestsrv /usr/local/bin/pebble-challtestsrv
chown root:root /usr/local/bin/pebble-challtestsrv
chmod 0755 /usr/local/bin/pebble-challtestsrv
exit 0

View File

@@ -0,0 +1,35 @@
#!/bin/bash
#
# Install Pebble for testing.
#
set -euo pipefail
CONFIG_NAME="pebble-config.json"
# Use Pebble EAB config if enabled
set +u
if [[ -n $ACME_CAP_EAB_ENABLED ]] && [[ $ACME_CAP_EAB_ENABLED -eq 1 ]]; then
CONFIG_NAME="pebble-config-external-account-bindings.json"
fi
set -u
# Download certs and config
mkdir -p /etc/pebble
wget -nv "https://raw.githubusercontent.com/letsencrypt/pebble/v${PEBBLE_VERSION}/test/certs/pebble.minica.pem" -O /etc/pebble/ca.cert.pem
wget -nv "https://raw.githubusercontent.com/letsencrypt/pebble/v${PEBBLE_VERSION}/test/certs/localhost/cert.pem" -O /etc/pebble/cert.pem
wget -nv "https://raw.githubusercontent.com/letsencrypt/pebble/v${PEBBLE_VERSION}/test/certs/localhost/key.pem" -O /etc/pebble/key.pem
wget -nv "https://raw.githubusercontent.com/letsencrypt/pebble/v${PEBBLE_VERSION}/test/config/${CONFIG_NAME}" -O /etc/pebble/pebble.json
# Download and install Pebble
wget -nv "https://github.com/letsencrypt/pebble/releases/download/v${PEBBLE_VERSION}/pebble-linux-amd64.tar.gz" -O /tmp/pebble.tar.gz
tar zxvf /tmp/pebble.tar.gz -C /tmp
mv /tmp/pebble-linux-amd64/linux/amd64/pebble /usr/local/bin/pebble
chown root:root /usr/local/bin/pebble
chmod 0755 /usr/local/bin/pebble
# Config
sed -i 's#test/certs/localhost#/etc/pebble#' /etc/pebble/pebble.json
exit 0

View File

@@ -0,0 +1,27 @@
#!/bin/bash
#
# Wait for ACME server to accept connections.
#
set -euo pipefail
MAX_ATTEMPTS=15
ATTEMPT=0
# Loop until ready
while ! curl --cacert "${ACME_CA_CERT_PATH}" -s -D - "${ACME_DIRECTORY_URL}" | grep '^HTTP.*200' > /dev/null 2>&1; do
ATTEMPT=$((ATTEMPT + 1))
# Max attempts
if [[ $ATTEMPT -gt $MAX_ATTEMPTS ]]; then
echo "[!] Waited ${ATTEMPT} attempts for server to become ready, exit 1"
exit 1
fi
# Retry
echo "[-] Waiting 1 second for server to become ready, attempt: ${ATTEMPT}/${MAX_ATTEMPTS}, check: ${ACME_DIRECTORY_URL}, cert: ${ACME_CA_CERT_PATH}"
sleep 1
done
# Ready
echo "[+] Server ready!"
exit 0

View File

@@ -0,0 +1,91 @@
name: test
on: [push, pull_request]
jobs:
test:
name: node=${{matrix.node}} eab=${{matrix.eab}}
runs-on: ubuntu-latest
strategy:
matrix:
node: [16, 18, 20]
eab: [0, 1]
#
# Environment
#
env:
FORCE_COLOR: 1
NPM_CONFIG_COLOR: always
PEBBLE_VERSION: 2.6.0
PEBBLE_ALTERNATE_ROOTS: 2
PEBBLECTS_VERSION: 2.6.0
PEBBLECTS_DNS_PORT: 8053
COREDNS_VERSION: 1.11.1
NODE_EXTRA_CA_CERTS: /etc/pebble/ca.cert.pem
ACME_CA_CERT_PATH: /etc/pebble/ca.cert.pem
ACME_DIRECTORY_URL: https://127.0.0.1:14000/dir
ACME_CHALLTESTSRV_URL: http://127.0.0.1:8055
ACME_PEBBLE_MANAGEMENT_URL: https://127.0.0.1:15000
ACME_DOMAIN_NAME: test.example.com
ACME_CAP_EAB_ENABLED: ${{matrix.eab}}
ACME_TLSALPN_PORT: 5001
ACME_HTTP_PORT: 5002
ACME_HTTPS_PORT: 5003
#
# Pipeline
#
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}
# Pebble Challenge Test Server
- name: Install Pebble Challenge Test Server
run: sudo -E /bin/bash ./.github/scripts/tests-install-cts.sh
- name: Start Pebble Challenge Test Server
run: |-
nohup bash -c "pebble-challtestsrv \
-dns01 :${PEBBLECTS_DNS_PORT} \
-tlsalpn01 :${ACME_TLSALPN_PORT} \
-http01 :${ACME_HTTP_PORT} \
-https01 :${ACME_HTTPS_PORT} \
-defaultIPv4 127.0.0.1 \
-defaultIPv6 \"\" &"
# Pebble
- name: Install Pebble
run: sudo -E /bin/bash ./.github/scripts/tests-install-pebble.sh
- name: Start Pebble
run: nohup bash -c "pebble -strict -config /etc/pebble/pebble.json -dnsserver 127.53.53.53:53 &"
- name: Wait for Pebble
run: /bin/bash ./.github/scripts/tests-wait-for-ca.sh
# CoreDNS
- name: Install CoreDNS
run: sudo -E /bin/bash ./.github/scripts/tests-install-coredns.sh
- name: Start CoreDNS
run: nohup bash -c "sudo coredns -p 53 -conf /etc/coredns/Corefile &"
- name: Use CoreDNS for DNS resolution
run: echo "nameserver 127.53.53.53" | sudo tee /etc/resolv.conf
# Run tests
- run: npm i
- run: npm run lint
- run: npm run lint-types
- run: npm run build-docs
- run: npm run test

View File

@@ -1,7 +1,6 @@
.actrc
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

View File

@@ -0,0 +1,394 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/publishlab/node-acme-client/compare/v1.25.5...v1.25.6) (2024-09-29)
### Performance Improvements
* 部署支持1Panel ([d047234](https://github.com/publishlab/node-acme-client/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
## [1.25.5](https://github.com/publishlab/node-acme-client/compare/v1.25.4...v1.25.5) (2024-09-26)
**Note:** Version bump only for package @certd/acme-client
## [1.25.4](https://github.com/publishlab/node-acme-client/compare/v1.25.3...v1.25.4) (2024-09-25)
**Note:** Version bump only for package @certd/acme-client
## [1.25.3](https://github.com/publishlab/node-acme-client/compare/v1.25.2...v1.25.3) (2024-09-24)
**Note:** Version bump only for package @certd/acme-client
## [1.25.2](https://github.com/publishlab/node-acme-client/compare/v1.25.1...v1.25.2) (2024-09-24)
**Note:** Version bump only for package @certd/acme-client
## [1.25.1](https://github.com/publishlab/node-acme-client/compare/v1.25.0...v1.25.1) (2024-09-24)
**Note:** Version bump only for package @certd/acme-client
# [1.25.0](https://github.com/publishlab/node-acme-client/compare/v1.24.4...v1.25.0) (2024-09-24)
### Performance Improvements
* 证书支持旧版RSApkcs1 ([3d9c3ec](https://github.com/publishlab/node-acme-client/commit/3d9c3ecb3eb604b2458154f608bde0f01915d116))
* 支持七牛云 ([8ecc2f9](https://github.com/publishlab/node-acme-client/commit/8ecc2f9446a9ebd11b9bfbffbb6cf7812a043495))
## [1.24.4](https://github.com/publishlab/node-acme-client/compare/v1.24.3...v1.24.4) (2024-09-09)
**Note:** Version bump only for package @certd/acme-client
## [1.24.3](https://github.com/publishlab/node-acme-client/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/acme-client
## [1.24.2](https://github.com/publishlab/node-acme-client/compare/v1.24.1...v1.24.2) (2024-09-06)
### Performance Improvements
* 修复windows下无法执行第二条命令的bug ([d5bfcdb](https://github.com/publishlab/node-acme-client/commit/d5bfcdb6de1dcc1702155442e2e00237d0bbb6e5))
## [1.24.1](https://github.com/publishlab/node-acme-client/compare/v1.24.0...v1.24.1) (2024-09-02)
### Bug Fixes
* 修复在没有勾选使用代理的情况下仍然会使用代理的bug ([0f66794](https://github.com/publishlab/node-acme-client/commit/0f6679425f6a736bb0128527dd99c085fac17d84))
### Performance Improvements
* 部署插件支持宝塔、易盾云等 ([ee61709](https://github.com/publishlab/node-acme-client/commit/ee617095efa1171548cf52fd45f0f98a368555a3))
* 授权配置支持加密 ([42a56b5](https://github.com/publishlab/node-acme-client/commit/42a56b581d754c3e5f9838179d19ab0d004ef2eb))
# [1.24.0](https://github.com/publishlab/node-acme-client/compare/v1.23.1...v1.24.0) (2024-08-25)
### Bug Fixes
* 修复成功后跳过之后丢失腾讯云证书id的bug ([37eb762](https://github.com/publishlab/node-acme-client/commit/37eb762afe25c5896b75dee25f32809f8426e7b7))
* 修复创建流水线后立即运行时报no id错误的bug ([17ead54](https://github.com/publishlab/node-acme-client/commit/17ead547aab25333603980304aa3aad3db1f73d5))
* 修复使用代理的情况下申请证书失败的bug ([95122e2](https://github.com/publishlab/node-acme-client/commit/95122e28609333f4df55c266e5434897954c0fb3))
### Features
* 支持google证书申请需要使用代理 ([a593056](https://github.com/publishlab/node-acme-client/commit/a593056e79e99dd6a74f75b5eab621af7248cfbe))
### Performance Improvements
* 优化证书申请成功率 ([968c469](https://github.com/publishlab/node-acme-client/commit/968c4690a07f69c08dcb3d3a494da4e319627345))
## [1.22.6](https://github.com/publishlab/node-acme-client/compare/v1.22.5...v1.22.6) (2024-08-03)
**Note:** Version bump only for package @certd/acme-client
## [1.22.4](https://github.com/publishlab/node-acme-client/compare/v1.22.3...v1.22.4) (2024-07-26)
### Performance Improvements
* 证书申请支持反向代理letsencrypt无法访问时的备用方案 ([b7b5df0](https://github.com/publishlab/node-acme-client/commit/b7b5df0587e0f7ea288c1b2af6f87211f207395f))
## [1.22.3](https://github.com/publishlab/node-acme-client/compare/v1.22.2...v1.22.3) (2024-07-25)
**Note:** Version bump only for package @certd/acme-client
## [1.22.2](https://github.com/publishlab/node-acme-client/compare/v1.22.1...v1.22.2) (2024-07-23)
**Note:** Version bump only for package @certd/acme-client
## [1.22.1](https://github.com/publishlab/node-acme-client/compare/v1.22.0...v1.22.1) (2024-07-20)
**Note:** Version bump only for package @certd/acme-client
# [1.22.0](https://github.com/publishlab/node-acme-client/compare/v1.21.2...v1.22.0) (2024-07-19)
### Features
* 升级midway支持esm ([485e603](https://github.com/publishlab/node-acme-client/commit/485e603b5165c28bc08694997726eaf2a585ebe7))
## [1.21.2](https://github.com/publishlab/node-acme-client/compare/v1.21.1...v1.21.2) (2024-07-08)
**Note:** Version bump only for package @certd/acme-client
## [1.21.1](https://github.com/publishlab/node-acme-client/compare/v1.21.0...v1.21.1) (2024-07-08)
**Note:** Version bump only for package @certd/acme-client
# [1.21.0](https://github.com/publishlab/node-acme-client/compare/v1.20.17...v1.21.0) (2024-07-03)
### Features
* 支持zero ssl ([eade2c2](https://github.com/publishlab/node-acme-client/commit/eade2c2b681569f03e9cd466e7d5bcd6703ed492))
## [1.20.17](https://github.com/publishlab/node-acme-client/compare/v1.20.16...v1.20.17) (2024-07-03)
### Performance Improvements
* 创建dns解析后强制等待60s ([f47b35f](https://github.com/publishlab/node-acme-client/commit/f47b35f6d5bd7d675005c3e286b7e9a029201f8b))
* 优化cname verify ([eba333d](https://github.com/publishlab/node-acme-client/commit/eba333de7a5b5ef4b0b7eaa904f578720102fa61))
## [1.20.16](https://github.com/publishlab/node-acme-client/compare/v1.20.15...v1.20.16) (2024-07-01)
### Bug Fixes
* 修复配置了cdn cname后申请失败的bug ([4a5fa76](https://github.com/publishlab/node-acme-client/commit/4a5fa767edc347d03d29a467e86c9a4d70b0220c))
## [1.20.15](https://github.com/publishlab/node-acme-client/compare/v1.20.14...v1.20.15) (2024-06-28)
### Performance Improvements
* 腾讯云dns provider 支持腾讯云的accessId ([e0eb3a4](https://github.com/publishlab/node-acme-client/commit/e0eb3a441384d474fe2923c69b25318264bdc9df))
## [1.20.14](https://github.com/publishlab/node-acme-client/compare/v1.20.13...v1.20.14) (2024-06-23)
**Note:** Version bump only for package @certd/acme-client
## [1.20.13](https://github.com/publishlab/node-acme-client/compare/v1.20.12...v1.20.13) (2024-06-18)
**Note:** Version bump only for package @certd/acme-client
## [1.20.12](https://github.com/publishlab/node-acme-client/compare/v1.20.10...v1.20.12) (2024-06-17)
### Bug Fixes
* 修复aliyun域名超过100个找不到域名的bug ([5b1494b](https://github.com/publishlab/node-acme-client/commit/5b1494b3ce93d1026dc56ee741342fbb8bf7be24))
### Performance Improvements
* 支持cloudflare域名 ([fbb9a47](https://github.com/publishlab/node-acme-client/commit/fbb9a47e8f7bb805289b9ee64bd46ffee0f01c06))
## [1.20.10](https://github.com/publishlab/node-acme-client/compare/v1.20.9...v1.20.10) (2024-05-30)
**Note:** Version bump only for package @certd/acme-client
## [1.20.9](https://github.com/publishlab/node-acme-client/compare/v1.20.8...v1.20.9) (2024-03-22)
**Note:** Version bump only for package @certd/acme-client
## [1.20.8](https://github.com/publishlab/node-acme-client/compare/v1.20.7...v1.20.8) (2024-03-22)
**Note:** Version bump only for package @certd/acme-client
## [1.20.7](https://github.com/publishlab/node-acme-client/compare/v1.20.6...v1.20.7) (2024-03-22)
**Note:** Version bump only for package @certd/acme-client
## [1.20.6](https://github.com/publishlab/node-acme-client/compare/v1.20.5...v1.20.6) (2024-03-21)
**Note:** Version bump only for package @certd/acme-client
## [1.20.5](https://github.com/publishlab/node-acme-client/compare/v1.20.2...v1.20.5) (2024-03-11)
### Bug Fixes
* 修复腾讯云cdn部署无法选择端点的bug ([154409b](https://github.com/publishlab/node-acme-client/commit/154409b1dfee3ea1caae740ad9c1f99a6e7a9814))
# Changelog
## v5.4.0 (2024-07-16)
* `added` Directory URLs for [Google](https://cloud.google.com/certificate-manager/docs/overview) ACME provider
* `fixed` Invalidate ACME provider directory cache after 24 hours
* `fixed` Retry HTTP requests on server errors or when rate limited - [#89](https://github.com/publishlab/node-acme-client/issues/89)
## v5.3.1 (2024-05-22)
* `fixed` Allow `client.auto()` being called with an empty CSR common name
* `fixed` Bug when calling `updateAccountKey()` with external account binding
## v5.3.0 (2024-02-05)
* `added` Support and tests for satisfying `tls-alpn-01` challenges
* `changed` Replace `jsrsasign` with `@peculiar/x509` for certificate and CSR handling
* `changed` Method `getChallengeKeyAuthorization()` now returns `$token.$thumbprint` when called with a `tls-alpn-01` challenge
* Previously returned base64url encoded SHA256 digest of `$token.$thumbprint` erroneously
* This change is not considered breaking since the previous behavior was incorrect
## v5.2.0 (2024-01-22)
* `fixed` Allow self-signed or invalid certs when validating `http-01` challenges that redirect to HTTPS - [#65](https://github.com/publishlab/node-acme-client/issues/65)
* `fixed` Wait for all challenge promises to settle before rejecting `client.auto()` - [#75](https://github.com/publishlab/node-acme-client/issues/75)
## v5.1.0 (2024-01-20)
* `fixed` Upgrade `jsrsasign@11.0.0` - [GHSA-rh63-9qcf-83gf](https://github.com/kjur/jsrsasign/security/advisories/GHSA-rh63-9qcf-83gf)
* `fixed` Upgrade `axios@1.6.5` - [CVE-2023-45857](https://cve.mitre.org/cgi-bin/cvename.cgi?name=2023-45857)
## v5.0.0 (2022-07-28)
* [Upgrade guide here](docs/upgrade-v5.md)
* `added` New native crypto interface, ECC/ECDSA support
* `breaking` Remove support for Node v10, v12 and v14
* `breaking` Prioritize issuer closest to root during preferred chain selection - [#46](https://github.com/publishlab/node-acme-client/issues/46)
* `changed` Replace `bluebird` dependency with native promise APIs
* `changed` Replace `backo2` dependency with internal utility
## v4.2.5 (2022-03-21)
* `fixed` Upgrade `axios@0.26.1`
* `fixed` Upgrade `node-forge@1.3.0` - [CVE-2022-24771](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24771), [CVE-2022-24772](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24772), [CVE-2022-24773](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24773)
## v4.2.4 (2022-03-19)
* `fixed` Use SHA-256 when signing CSRs
## v3.3.2 (2022-03-19)
* `backport` Use SHA-256 when signing CSRs
## v4.2.3 (2022-01-11)
* `added` Directory URLs for ACME providers [Buypass](https://www.buypass.com) and [ZeroSSL](https://zerossl.com)
* `fixed` Skip already valid authorizations when using `client.auto()`
## v4.2.2 (2022-01-10)
* `fixed` Upgrade `node-forge@1.2.0`
## v4.2.1 (2022-01-10)
* `fixed` ZeroSSL `duplicate_domains_in_array` error when using `client.auto()`
## v4.2.0 (2022-01-06)
* `added` Support for external account binding - [RFC 8555 Section 7.3.4](https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.4)
* `added` Ability to pass through custom logger function
* `changed` Increase default `backoffAttempts` to 10
* `fixed` Deactivate authorizations where challenges can not be completed
* `fixed` Attempt authoritative name servers when verifying `dns-01` challenges
* `fixed` Error verbosity when failing to read ACME directory
* `fixed` Correctly recognize `ready` and `processing` states - [RFC 8555 Section 7.1.6](https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.6)
## v4.1.4 (2021-12-23)
* `fixed` Upgrade `axios@0.21.4` - [CVE-2021-3749](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3749)
## v4.1.3 (2021-02-22)
* `fixed` Upgrade `axios@0.21.1` - [CVE-2020-28168](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-28168)
## v4.1.2 (2020-11-16)
* `fixed` Bug when encoding PEM payloads, potentially causing malformed requests
## v4.1.1 (2020-11-13)
* `fixed` Missing TypeScript definitions
## v4.1.0 (2020-11-12)
* `added` Option `preferredChain` added to `client.getCertificate()` and `client.auto()` to indicate which certificate chain is preferred if a CA offers multiple
* Related: [https://community.letsencrypt.org/t/transition-to-isrgs-root-delayed-until-jan-11-2021/125516](https://community.letsencrypt.org/t/transition-to-isrgs-root-delayed-until-jan-11-2021/125516)
* `added` Method `client.getOrder()` to refresh order from CA
* `fixed` Upgrade `axios@0.21.0`
* `fixed` Error when attempting to revoke a certificate chain
* `fixed` Missing URL augmentation in `client.finalizeOrder()` and `client.deactivateAuthorization()`
* `fixed` Add certificate issuer to response from `forge.readCertificateInfo()`
## v4.0.2 (2020-10-09)
* `fixed` Explicitly set default `axios` HTTP adapter - [axios/axios#1180](https://github.com/axios/axios/issues/1180)
## v4.0.1 (2020-09-15)
* `fixed` Upgrade `node-forge@0.10.0` - [CVE-2020-7720](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7720)
## v4.0.0 (2020-05-29)
* `breaking` Remove support for Node v8
* `breaking` Remove deprecated `openssl` crypto module
* `fixed` Incorrect TypeScript `CertificateInfo` definitions
* `fixed` Allow trailing whitespace character in `http-01` challenge response
## v3.3.1 (2020-01-07)
* `fixed` Improvements to TypeScript definitions
## v3.3.0 (2019-12-19)
* `added` TypeScript definitions
* `fixed` Allow missing ACME directory meta field - [RFC 8555 Section 7.1.1](https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.1)
## v3.2.1 (2019-11-14)
* `added` New option `skipChallengeVerification` added to `client.auto()` to bypass internal challenge verification
## v3.2.0 (2019-08-26)
* `added` More extensive testing using [letsencrypt/pebble](https://github.com/letsencrypt/pebble)
* `changed` When creating a CSR, `commonName` no longer defaults to `'localhost'`
* This change is not considered breaking since `commonName: 'localhost'` will result in an error when ordering a certificate
* `fixed` Retry signed API requests on `urn:ietf:params:acme:error:badNonce` - [RFC 8555 Section 6.5](https://datatracker.ietf.org/doc/html/rfc8555#section-6.5)
* `fixed` Minor bugs related to `POST-as-GET` when calling `updateAccount()`
* `fixed` Ensure subject common name is present in SAN when creating a CSR - [CAB v1.2.3 Section 9.2.2](https://cabforum.org/wp-content/uploads/BRv1.2.3.pdf)
* `fixed` Send empty JSON body when responding to challenges - [RFC 8555 Section 7.5.1](https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.1)
## v2.3.1 (2019-08-26)
* `backport` Minor bugs related to `POST-as-GET` when calling `client.updateAccount()`
* `backport` Send empty JSON body when responding to challenges
## v3.1.0 (2019-08-21)
* `added` UTF-8 support when generating a CSR subject using forge - [RFC 5280](https://datatracker.ietf.org/doc/html/rfc5280)
* `fixed` Implement `POST-as-GET` for all ACME API requests - [RFC 8555 Section 6.3](https://datatracker.ietf.org/doc/html/rfc8555#section-6.3)
## v2.3.0 (2019-08-21)
* `backport` Implement `POST-as-GET` for all ACME API requests
## v3.0.0 (2019-07-13)
* `added` Expose `axios` instance to allow manipulating HTTP client defaults
* `breaking` Remove support for Node v4 and v6
* `breaking` Remove Babel transpilation
## v2.2.3 (2019-01-25)
* `added` DNS CNAME detection when verifying `dns-01` challenges
## v2.2.2 (2019-01-07)
* `added` Support for `tls-alpn-01` challenge key authorization
## v2.2.1 (2019-01-04)
* `fixed` Handle and throw errors from OpenSSL process
## v2.2.0 (2018-11-06)
* `added` New [node-forge](https://www.npmjs.com/package/node-forge) crypto interface, removes OpenSSL CLI dependency
* `added` Support native `crypto.generateKeyPair()` API when generating key pairs
## v2.1.0 (2018-10-21)
* `added` Ability to set and get current account URL
* `fixed` Replace HTTP client `request` with `axios`
* `fixed` Auto-mode no longer tries to create account when account URL exists
## v2.0.1 (2018-08-17)
* `fixed` Key rollover in compliance with [draft-ietf-acme-13](https://datatracker.ietf.org/doc/html/draft-ietf-acme-acme-13)
## v2.0.0 (2018-04-02)
* `breaking` ACMEv2
* `breaking` API changes
* `breaking` Rewrite to ES6
* `breaking` Promises instead of callbacks
## v1.0.0 (2017-10-20)
* API stable
## v0.2.1 (2017-09-27)
* `fixed` Bug causing invalid anti-replay nonce
## v0.2.0 (2017-09-21)
* `breaking` OpenSSL method `readCsrDomains` and `readCertificateInfo` now return domains as an object
* `fixed` Added and fixed some tests
## v0.1.0 (2017-09-14)
* `acme-client` released

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017-2024 Labrador CMS AS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,241 @@
# acme-client [![test](https://github.com/publishlab/node-acme-client/actions/workflows/tests.yml/badge.svg)](https://github.com/publishlab/node-acme-client/actions/workflows/tests.yml)
*A simple and unopinionated ACME client.*
This module is written to handle communication with a Boulder/Let's Encrypt-style ACME API.
* RFC 8555 - Automatic Certificate Management Environment (ACME): [https://datatracker.ietf.org/doc/html/rfc8555](https://datatracker.ietf.org/doc/html/rfc8555)
* Boulder divergences from ACME: [https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md](https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md)
## Compatibility
| acme-client | Node.js | |
| ----------- | ------- | ----------------------------------------- |
| v5.x | >= v16 | [Upgrade guide](docs/upgrade-v5.md) |
| v4.x | >= v10 | [Changelog](CHANGELOG.md#v400-2020-05-29) |
| v3.x | >= v8 | [Changelog](CHANGELOG.md#v300-2019-07-13) |
| v2.x | >= v4 | [Changelog](CHANGELOG.md#v200-2018-04-02) |
| v1.x | >= v4 | [Changelog](CHANGELOG.md#v100-2017-10-20) |
## Table of contents
* [Installation](#installation)
* [Usage](#usage)
* [Directory URLs](#directory-urls)
* [External account binding](#external-account-binding)
* [Specifying the account URL](#specifying-the-account-url)
* [Cryptography](#cryptography)
* [Legacy .forge interface](#legacy-forge-interface)
* [Auto mode](#auto-mode)
* [Challenge priority](#challenge-priority)
* [Internal challenge verification](#internal-challenge-verification)
* [API](#api)
* [HTTP client defaults](#http-client-defaults)
* [Debugging](#debugging)
* [License](#license)
## Installation
```bash
$ npm install acme-client
```
## Usage
```js
const acme = require('acme-client');
const accountPrivateKey = '<PEM encoded private key>';
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: accountPrivateKey,
});
```
### Directory URLs
```js
acme.directory.buypass.staging;
acme.directory.buypass.production;
acme.directory.google.staging;
acme.directory.google.production;
acme.directory.letsencrypt.staging;
acme.directory.letsencrypt.production;
acme.directory.zerossl.production;
```
### External account binding
To enable [external account binding](https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.4) when creating your ACME account, provide your KID and HMAC key to the client constructor.
```js
const client = new acme.Client({
directoryUrl: 'https://acme-provider.example.com/directory-url',
accountKey: accountPrivateKey,
externalAccountBinding: {
kid: 'YOUR-EAB-KID',
hmacKey: 'YOUR-EAB-HMAC-KEY',
},
});
```
### Specifying the account URL
During the ACME account creation process, the server will check the supplied account key and either create a new account if the key is unused, or return the existing ACME account bound to that key.
In some cases, for example with some EAB providers, this account creation step may be prohibited and might require you to manually specify the account URL beforehand. This can be done through `accountUrl` in the client constructor.
```js
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: accountPrivateKey,
accountUrl: 'https://acme-v02.api.letsencrypt.org/acme/acct/12345678',
});
```
You can fetch the clients current account URL, either after creating an account or supplying it through the constructor, using `getAccountUrl()`:
```js
const myAccountUrl = client.getAccountUrl();
```
## Cryptography
For key pairs `acme-client` utilizes native Node.js cryptography APIs, supporting signing and generation of both RSA and ECDSA keys. The module [@peculiar/x509](https://www.npmjs.com/package/@peculiar/x509) is used to generate and parse Certificate Signing Requests.
These utility methods are exposed through `.crypto`.
* **Documentation: [docs/crypto.md](docs/crypto.md)**
```js
const privateRsaKey = await acme.crypto.createPrivateRsaKey();
const privateEcdsaKey = await acme.crypto.createPrivateEcdsaKey();
const [certificateKey, certificateCsr] = await acme.crypto.createCsr({
altNames: ['example.com', '*.example.com'],
});
```
### Legacy `.forge` interface
The legacy `node-forge` crypto interface is still available for backward compatibility, however this interface is now considered deprecated and will be removed in a future major version of `acme-client`.
You should consider migrating to the new `.crypto` API at your earliest convenience. More details can be found in the [acme-client v5 upgrade guide](docs/upgrade-v5.md).
* **Documentation: [docs/forge.md](docs/forge.md)**
## Auto mode
For convenience an `auto()` method is included in the client that takes a single config object. This method will handle the entire process of getting a certificate for one or multiple domains.
* **Documentation: [docs/client.md#AcmeClient+auto](docs/client.md#AcmeClient+auto)**
* **Full example: [examples/auto.js](examples/auto.js)**
```js
const autoOpts = {
csr: '<PEM encoded CSR>',
email: 'test@example.com',
termsOfServiceAgreed: true,
challengeCreateFn: async (authz, challenge, keyAuthorization) => {},
challengeRemoveFn: async (authz, challenge, keyAuthorization) => {},
};
const certificate = await client.auto(autoOpts);
```
### Challenge priority
When ordering a certificate using auto mode, `acme-client` uses a priority list when selecting challenges to respond to. Its default value is `['http-01', 'dns-01']` which translates to "use `http-01` if any challenges exist, otherwise fall back to `dns-01`".
While most challenges can be validated using the method of your choosing, please note that **wildcard certificates can only be validated through `dns-01`**. More information regarding Let's Encrypt challenge types [can be found here](https://letsencrypt.org/docs/challenge-types/).
To modify challenge priority, provide a list of challenge types in `challengePriority`:
```js
await client.auto({
...,
challengePriority: ['http-01', 'dns-01'],
});
```
### Internal challenge verification
When using auto mode, `acme-client` will first validate that challenges are satisfied internally before completing the challenge at the ACME provider. In some cases (firewalls, etc) this internal challenge verification might not be possible to complete.
If internal challenge validation needs to travel through an HTTP proxy, see [HTTP client defaults](#http-client-defaults).
To completely disable `acme-client`s internal challenge verification, enable `skipChallengeVerification`:
```js
await client.auto({
...,
skipChallengeVerification: true,
});
```
## API
For more fine-grained control you can interact with the ACME API using the methods documented below.
* **Documentation: [docs/client.md](docs/client.md)**
* **Full example: [examples/api.js](examples/api.js)**
```js
const account = await client.createAccount({
termsOfServiceAgreed: true,
contact: ['mailto:test@example.com'],
});
const order = await client.createOrder({
identifiers: [
{ type: 'dns', value: 'example.com' },
{ type: 'dns', value: '*.example.com' },
],
});
```
## HTTP client defaults
This module uses [axios](https://github.com/axios/axios) when communicating with the ACME HTTP API, and exposes the client instance through `.axios`.
For example, should you need to change the default axios configuration to route requests through an HTTP proxy, this can be achieved as follows:
```js
const acme = require('acme-client');
acme.axios.defaults.proxy = {
host: '127.0.0.1',
port: 9000,
};
```
A complete list of axios options and documentation can be found at:
* [https://github.com/axios/axios#request-config](https://github.com/axios/axios#request-config)
* [https://github.com/axios/axios#custom-instance-defaults](https://github.com/axios/axios#custom-instance-defaults)
## Debugging
To get a better grasp of what `acme-client` is doing behind the scenes, you can either pass it a logger function, or enable debugging through an environment variable.
Setting a logger function may for example be useful for passing messages on to another logging system, or just dumping them to the console.
```js
acme.setLogger((message) => {
console.log(message);
});
```
Debugging to the console can also be enabled through [debug](https://www.npmjs.com/package/debug) by setting an environment variable.
```bash
DEBUG=acme-client node index.js
```
## License
[MIT](LICENSE)

View File

@@ -0,0 +1 @@
20:55

View File

@@ -0,0 +1,518 @@
## Classes
<dl>
<dt><a href="#AcmeClient">AcmeClient</a></dt>
<dd><p>AcmeClient</p>
</dd>
</dl>
## Objects
<dl>
<dt><a href="#Client">Client</a> : <code>object</code></dt>
<dd><p>ACME client</p>
</dd>
</dl>
<a name="AcmeClient"></a>
## AcmeClient
AcmeClient
**Kind**: global class
* [AcmeClient](#AcmeClient)
* [new AcmeClient(opts)](#new_AcmeClient_new)
* [.getTermsOfServiceUrl()](#AcmeClient+getTermsOfServiceUrl) ⇒ <code>Promise.&lt;(string\|null)&gt;</code>
* [.getAccountUrl()](#AcmeClient+getAccountUrl) ⇒ <code>string</code>
* [.createAccount([data])](#AcmeClient+createAccount) ⇒ <code>Promise.&lt;object&gt;</code>
* [.updateAccount([data])](#AcmeClient+updateAccount) ⇒ <code>Promise.&lt;object&gt;</code>
* [.updateAccountKey(newAccountKey, [data])](#AcmeClient+updateAccountKey) ⇒ <code>Promise.&lt;object&gt;</code>
* [.createOrder(data)](#AcmeClient+createOrder) ⇒ <code>Promise.&lt;object&gt;</code>
* [.getOrder(order)](#AcmeClient+getOrder) ⇒ <code>Promise.&lt;object&gt;</code>
* [.finalizeOrder(order, csr)](#AcmeClient+finalizeOrder) ⇒ <code>Promise.&lt;object&gt;</code>
* [.getAuthorizations(order)](#AcmeClient+getAuthorizations) ⇒ <code>Promise.&lt;Array.&lt;object&gt;&gt;</code>
* [.deactivateAuthorization(authz)](#AcmeClient+deactivateAuthorization) ⇒ <code>Promise.&lt;object&gt;</code>
* [.getChallengeKeyAuthorization(challenge)](#AcmeClient+getChallengeKeyAuthorization) ⇒ <code>Promise.&lt;string&gt;</code>
* [.verifyChallenge(authz, challenge)](#AcmeClient+verifyChallenge) ⇒ <code>Promise</code>
* [.completeChallenge(challenge)](#AcmeClient+completeChallenge) ⇒ <code>Promise.&lt;object&gt;</code>
* [.waitForValidStatus(item)](#AcmeClient+waitForValidStatus) ⇒ <code>Promise.&lt;object&gt;</code>
* [.getCertificate(order, [preferredChain])](#AcmeClient+getCertificate) ⇒ <code>Promise.&lt;string&gt;</code>
* [.revokeCertificate(cert, [data])](#AcmeClient+revokeCertificate) ⇒ <code>Promise</code>
* [.auto(opts)](#AcmeClient+auto) ⇒ <code>Promise.&lt;string&gt;</code>
<a name="new_AcmeClient_new"></a>
### new AcmeClient(opts)
| Param | Type | Description |
| --- | --- | --- |
| opts | <code>object</code> | |
| opts.directoryUrl | <code>string</code> | ACME directory URL |
| opts.accountKey | <code>buffer</code> \| <code>string</code> | PEM encoded account private key |
| [opts.accountUrl] | <code>string</code> | Account URL, default: `null` |
| [opts.externalAccountBinding] | <code>object</code> | |
| [opts.externalAccountBinding.kid] | <code>string</code> | External account binding KID |
| [opts.externalAccountBinding.hmacKey] | <code>string</code> | External account binding HMAC key |
| [opts.backoffAttempts] | <code>number</code> | Maximum number of backoff attempts, default: `10` |
| [opts.backoffMin] | <code>number</code> | Minimum backoff attempt delay in milliseconds, default: `5000` |
| [opts.backoffMax] | <code>number</code> | Maximum backoff attempt delay in milliseconds, default: `30000` |
**Example**
Create ACME client instance
```js
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: 'Private key goes here',
});
```
**Example**
Create ACME client instance
```js
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: 'Private key goes here',
accountUrl: 'Optional account URL goes here',
backoffAttempts: 10,
backoffMin: 5000,
backoffMax: 30000,
});
```
**Example**
Create ACME client with external account binding
```js
const client = new acme.Client({
directoryUrl: 'https://acme-provider.example.com/directory-url',
accountKey: 'Private key goes here',
externalAccountBinding: {
kid: 'YOUR-EAB-KID',
hmacKey: 'YOUR-EAB-HMAC-KEY',
},
});
```
<a name="AcmeClient+getTermsOfServiceUrl"></a>
### acmeClient.getTermsOfServiceUrl() ⇒ <code>Promise.&lt;(string\|null)&gt;</code>
Get Terms of Service URL if available
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;(string\|null)&gt;</code> - ToS URL
**Example**
Get Terms of Service URL
```js
const termsOfService = client.getTermsOfServiceUrl();
if (!termsOfService) {
// CA did not provide Terms of Service
}
```
<a name="AcmeClient+getAccountUrl"></a>
### acmeClient.getAccountUrl() ⇒ <code>string</code>
Get current account URL
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>string</code> - Account URL
**Throws**:
- <code>Error</code> No account URL found
**Example**
Get current account URL
```js
try {
const accountUrl = client.getAccountUrl();
}
catch (e) {
// No account URL exists, need to create account first
}
```
<a name="AcmeClient+createAccount"></a>
### acmeClient.createAccount([data]) ⇒ <code>Promise.&lt;object&gt;</code>
Create a new account
https://datatracker.ietf.org/doc/html/rfc8555#section-7.3
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Account
| Param | Type | Description |
| --- | --- | --- |
| [data] | <code>object</code> | Request data |
**Example**
Create a new account
```js
const account = await client.createAccount({
termsOfServiceAgreed: true,
});
```
**Example**
Create a new account with contact info
```js
const account = await client.createAccount({
termsOfServiceAgreed: true,
contact: ['mailto:test@example.com'],
});
```
<a name="AcmeClient+updateAccount"></a>
### acmeClient.updateAccount([data]) ⇒ <code>Promise.&lt;object&gt;</code>
Update existing account
https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.2
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Account
| Param | Type | Description |
| --- | --- | --- |
| [data] | <code>object</code> | Request data |
**Example**
Update existing account
```js
const account = await client.updateAccount({
contact: ['mailto:foo@example.com'],
});
```
<a name="AcmeClient+updateAccountKey"></a>
### acmeClient.updateAccountKey(newAccountKey, [data]) ⇒ <code>Promise.&lt;object&gt;</code>
Update account private key
https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.5
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Account
| Param | Type | Description |
| --- | --- | --- |
| newAccountKey | <code>buffer</code> \| <code>string</code> | New PEM encoded private key |
| [data] | <code>object</code> | Additional request data |
**Example**
Update account private key
```js
const newAccountKey = 'New private key goes here';
const result = await client.updateAccountKey(newAccountKey);
```
<a name="AcmeClient+createOrder"></a>
### acmeClient.createOrder(data) ⇒ <code>Promise.&lt;object&gt;</code>
Create a new order
https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Order
| Param | Type | Description |
| --- | --- | --- |
| data | <code>object</code> | Request data |
**Example**
Create a new order
```js
const order = await client.createOrder({
identifiers: [
{ type: 'dns', value: 'example.com' },
{ type: 'dns', value: 'test.example.com' },
],
});
```
<a name="AcmeClient+getOrder"></a>
### acmeClient.getOrder(order) ⇒ <code>Promise.&lt;object&gt;</code>
Refresh order object from CA
https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Order
| Param | Type | Description |
| --- | --- | --- |
| order | <code>object</code> | Order object |
**Example**
```js
const order = { ... }; // Previously created order object
const result = await client.getOrder(order);
```
<a name="AcmeClient+finalizeOrder"></a>
### acmeClient.finalizeOrder(order, csr) ⇒ <code>Promise.&lt;object&gt;</code>
Finalize order
https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Order
| Param | Type | Description |
| --- | --- | --- |
| order | <code>object</code> | Order object |
| csr | <code>buffer</code> \| <code>string</code> | PEM encoded Certificate Signing Request |
**Example**
Finalize order
```js
const order = { ... }; // Previously created order object
const csr = { ... }; // Previously created Certificate Signing Request
const result = await client.finalizeOrder(order, csr);
```
<a name="AcmeClient+getAuthorizations"></a>
### acmeClient.getAuthorizations(order) ⇒ <code>Promise.&lt;Array.&lt;object&gt;&gt;</code>
Get identifier authorizations from order
https://datatracker.ietf.org/doc/html/rfc8555#section-7.5
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;Array.&lt;object&gt;&gt;</code> - Authorizations
| Param | Type | Description |
| --- | --- | --- |
| order | <code>object</code> | Order |
**Example**
Get identifier authorizations
```js
const order = { ... }; // Previously created order object
const authorizations = await client.getAuthorizations(order);
authorizations.forEach((authz) => {
const { challenges } = authz;
});
```
<a name="AcmeClient+deactivateAuthorization"></a>
### acmeClient.deactivateAuthorization(authz) ⇒ <code>Promise.&lt;object&gt;</code>
Deactivate identifier authorization
https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.2
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Authorization
| Param | Type | Description |
| --- | --- | --- |
| authz | <code>object</code> | Identifier authorization |
**Example**
Deactivate identifier authorization
```js
const authz = { ... }; // Identifier authorization resolved from previously created order
const result = await client.deactivateAuthorization(authz);
```
<a name="AcmeClient+getChallengeKeyAuthorization"></a>
### acmeClient.getChallengeKeyAuthorization(challenge) ⇒ <code>Promise.&lt;string&gt;</code>
Get key authorization for ACME challenge
https://datatracker.ietf.org/doc/html/rfc8555#section-8.1
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;string&gt;</code> - Key authorization
| Param | Type | Description |
| --- | --- | --- |
| challenge | <code>object</code> | Challenge object returned by API |
**Example**
Get challenge key authorization
```js
const challenge = { ... }; // Challenge from previously resolved identifier authorization
const key = await client.getChallengeKeyAuthorization(challenge);
// Write key somewhere to satisfy challenge
```
<a name="AcmeClient+verifyChallenge"></a>
### acmeClient.verifyChallenge(authz, challenge) ⇒ <code>Promise</code>
Verify that ACME challenge is satisfied
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
| Param | Type | Description |
| --- | --- | --- |
| authz | <code>object</code> | Identifier authorization |
| challenge | <code>object</code> | Authorization challenge |
**Example**
Verify satisfied ACME challenge
```js
const authz = { ... }; // Identifier authorization
const challenge = { ... }; // Satisfied challenge
await client.verifyChallenge(authz, challenge);
```
<a name="AcmeClient+completeChallenge"></a>
### acmeClient.completeChallenge(challenge) ⇒ <code>Promise.&lt;object&gt;</code>
Notify CA that challenge has been completed
https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.1
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Challenge
| Param | Type | Description |
| --- | --- | --- |
| challenge | <code>object</code> | Challenge object returned by API |
**Example**
Notify CA that challenge has been completed
```js
const challenge = { ... }; // Satisfied challenge
const result = await client.completeChallenge(challenge);
```
<a name="AcmeClient+waitForValidStatus"></a>
### acmeClient.waitForValidStatus(item) ⇒ <code>Promise.&lt;object&gt;</code>
Wait for ACME provider to verify status on a order, authorization or challenge
https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.1
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;object&gt;</code> - Valid order, authorization or challenge
| Param | Type | Description |
| --- | --- | --- |
| item | <code>object</code> | An order, authorization or challenge object |
**Example**
Wait for valid challenge status
```js
const challenge = { ... };
await client.waitForValidStatus(challenge);
```
**Example**
Wait for valid authorization status
```js
const authz = { ... };
await client.waitForValidStatus(authz);
```
**Example**
Wait for valid order status
```js
const order = { ... };
await client.waitForValidStatus(order);
```
<a name="AcmeClient+getCertificate"></a>
### acmeClient.getCertificate(order, [preferredChain]) ⇒ <code>Promise.&lt;string&gt;</code>
Get certificate from ACME order
https://datatracker.ietf.org/doc/html/rfc8555#section-7.4.2
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;string&gt;</code> - Certificate
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| order | <code>object</code> | | Order object |
| [preferredChain] | <code>string</code> | <code>null</code> | Indicate which certificate chain is preferred if a CA offers multiple, by exact issuer common name, default: `null` |
**Example**
Get certificate
```js
const order = { ... }; // Previously created order
const certificate = await client.getCertificate(order);
```
**Example**
Get certificate with preferred chain
```js
const order = { ... }; // Previously created order
const certificate = await client.getCertificate(order, 'DST Root CA X3');
```
<a name="AcmeClient+revokeCertificate"></a>
### acmeClient.revokeCertificate(cert, [data]) ⇒ <code>Promise</code>
Revoke certificate
https://datatracker.ietf.org/doc/html/rfc8555#section-7.6
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
| Param | Type | Description |
| --- | --- | --- |
| cert | <code>buffer</code> \| <code>string</code> | PEM encoded certificate |
| [data] | <code>object</code> | Additional request data |
**Example**
Revoke certificate
```js
const certificate = { ... }; // Previously created certificate
const result = await client.revokeCertificate(certificate);
```
**Example**
Revoke certificate with reason
```js
const certificate = { ... }; // Previously created certificate
const result = await client.revokeCertificate(certificate, {
reason: 4,
});
```
<a name="AcmeClient+auto"></a>
### acmeClient.auto(opts) ⇒ <code>Promise.&lt;string&gt;</code>
Auto mode
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
**Returns**: <code>Promise.&lt;string&gt;</code> - Certificate
| Param | Type | Description |
| --- | --- | --- |
| opts | <code>object</code> | |
| opts.csr | <code>buffer</code> \| <code>string</code> | Certificate Signing Request |
| opts.challengeCreateFn | <code>function</code> | Function returning Promise triggered before completing ACME challenge |
| opts.challengeRemoveFn | <code>function</code> | Function returning Promise triggered after completing ACME challenge |
| [opts.email] | <code>string</code> | Account email address |
| [opts.termsOfServiceAgreed] | <code>boolean</code> | Agree to Terms of Service, default: `false` |
| [opts.skipChallengeVerification] | <code>boolean</code> | Skip internal challenge verification before notifying ACME provider, default: `false` |
| [opts.challengePriority] | <code>Array.&lt;string&gt;</code> | Array defining challenge type priority, default: `['http-01', 'dns-01']` |
| [opts.preferredChain] | <code>string</code> | Indicate which certificate chain is preferred if a CA offers multiple, by exact issuer common name, default: `null` |
**Example**
Order a certificate using auto mode
```js
const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
altNames: ['test.example.com'],
});
const certificate = await client.auto({
csr: certificateRequest,
email: 'test@example.com',
termsOfServiceAgreed: true,
challengeCreateFn: async (authz, challenge, keyAuthorization) => {
// Satisfy challenge here
},
challengeRemoveFn: async (authz, challenge, keyAuthorization) => {
// Clean up challenge here
},
});
```
**Example**
Order a certificate using auto mode with preferred chain
```js
const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
altNames: ['test.example.com'],
});
const certificate = await client.auto({
csr: certificateRequest,
email: 'test@example.com',
termsOfServiceAgreed: true,
preferredChain: 'DST Root CA X3',
challengeCreateFn: async () => {},
challengeRemoveFn: async () => {},
});
```
<a name="Client"></a>
## Client : <code>object</code>
ACME client
**Kind**: global namespace

View File

@@ -0,0 +1,316 @@
## Objects
<dl>
<dt><a href="#crypto">crypto</a> : <code>object</code></dt>
<dd><p>Native Node.js crypto interface</p>
</dd>
</dl>
## Functions
<dl>
<dt><a href="#createPrivateRsaKey">createPrivateRsaKey([modulusLength])</a> ⇒ <code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private RSA key</p>
</dd>
<dt><a href="#createPrivateKey">createPrivateKey()</a></dt>
<dd><p>Alias of <code>createPrivateRsaKey()</code></p>
</dd>
<dt><a href="#createPrivateEcdsaKey">createPrivateEcdsaKey([namedCurve])</a> ⇒ <code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private ECDSA key</p>
</dd>
<dt><a href="#getPublicKey">getPublicKey(keyPem)</a> ⇒ <code>buffer</code></dt>
<dd><p>Get a public key derived from a RSA or ECDSA key</p>
</dd>
<dt><a href="#getJwk">getJwk(keyPem)</a> ⇒ <code>object</code></dt>
<dd><p>Get a JSON Web Key derived from a RSA or ECDSA key</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc7517">https://datatracker.ietf.org/doc/html/rfc7517</a></p>
</dd>
<dt><a href="#splitPemChain">splitPemChain(chainPem)</a> ⇒ <code>Array.&lt;string&gt;</code></dt>
<dd><p>Split chain of PEM encoded objects from string into array</p>
</dd>
<dt><a href="#getPemBodyAsB64u">getPemBodyAsB64u(pem)</a> ⇒ <code>string</code></dt>
<dd><p>Parse body of PEM encoded object and return a Base64URL string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains(csrPem)</a> ⇒ <code>object</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo(certPem)</a> ⇒ <code>object</code></dt>
<dd><p>Read information from a certificate
If multiple certificates are chained, the first will be read</p>
</dd>
<dt><a href="#createCsr">createCsr(data, [keyPem])</a> ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
<dt><a href="#createAlpnCertificate">createAlpnCertificate(authz, keyAuthorization, [keyPem])</a> ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a self-signed ALPN certificate for TLS-ALPN-01 challenges</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc8737">https://datatracker.ietf.org/doc/html/rfc8737</a></p>
</dd>
<dt><a href="#isAlpnCertificateAuthorizationValid">isAlpnCertificateAuthorizationValid(certPem, keyAuthorization)</a> ⇒ <code>boolean</code></dt>
<dd><p>Validate that a ALPN certificate contains the expected key authorization</p>
</dd>
</dl>
<a name="crypto"></a>
## crypto : <code>object</code>
Native Node.js crypto interface
**Kind**: global namespace
<a name="createPrivateRsaKey"></a>
## createPrivateRsaKey([modulusLength]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [modulusLength] | <code>number</code> | <code>2048</code> | Size of the keys modulus in bits, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.crypto.createPrivateRsaKey();
```
**Example**
Private RSA key with modulus size 4096
```js
const privateKey = await acme.crypto.createPrivateRsaKey(4096);
```
<a name="createPrivateKey"></a>
## createPrivateKey()
Alias of `createPrivateRsaKey()`
**Kind**: global function
<a name="createPrivateEcdsaKey"></a>
## createPrivateEcdsaKey([namedCurve]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private ECDSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private ECDSA key
| Param | Type | Description |
| --- | --- | --- |
| [namedCurve] | <code>string</code> | ECDSA curve name (P-256, P-384 or P-521), default `P-256` |
**Example**
Generate private ECDSA key
```js
const privateKey = await acme.crypto.createPrivateEcdsaKey();
```
**Example**
Private ECDSA key using P-384 curve
```js
const privateKey = await acme.crypto.createPrivateEcdsaKey('P-384');
```
<a name="getPublicKey"></a>
## getPublicKey(keyPem) ⇒ <code>buffer</code>
Get a public key derived from a RSA or ECDSA key
**Kind**: global function
**Returns**: <code>buffer</code> - PEM encoded public key
| Param | Type | Description |
| --- | --- | --- |
| keyPem | <code>buffer</code> \| <code>string</code> | PEM encoded private or public key |
**Example**
Get public key
```js
const publicKey = acme.crypto.getPublicKey(privateKey);
```
<a name="getJwk"></a>
## getJwk(keyPem) ⇒ <code>object</code>
Get a JSON Web Key derived from a RSA or ECDSA key
https://datatracker.ietf.org/doc/html/rfc7517
**Kind**: global function
**Returns**: <code>object</code> - JSON Web Key
| Param | Type | Description |
| --- | --- | --- |
| keyPem | <code>buffer</code> \| <code>string</code> | PEM encoded private or public key |
**Example**
Get JWK
```js
const jwk = acme.crypto.getJwk(privateKey);
```
<a name="splitPemChain"></a>
## splitPemChain(chainPem) ⇒ <code>Array.&lt;string&gt;</code>
Split chain of PEM encoded objects from string into array
**Kind**: global function
**Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM objects including headers
| Param | Type | Description |
| --- | --- | --- |
| chainPem | <code>buffer</code> \| <code>string</code> | PEM encoded object chain |
<a name="getPemBodyAsB64u"></a>
## getPemBodyAsB64u(pem) ⇒ <code>string</code>
Parse body of PEM encoded object and return a Base64URL string
If multiple objects are chained, the first body will be returned
**Kind**: global function
**Returns**: <code>string</code> - Base64URL-encoded body
| Param | Type | Description |
| --- | --- | --- |
| pem | <code>buffer</code> \| <code>string</code> | PEM encoded chain or object |
<a name="readCsrDomains"></a>
## readCsrDomains(csrPem) ⇒ <code>object</code>
Read domains from a Certificate Signing Request
**Kind**: global function
**Returns**: <code>object</code> - {commonName, altNames}
| Param | Type | Description |
| --- | --- | --- |
| csrPem | <code>buffer</code> \| <code>string</code> | PEM encoded Certificate Signing Request |
**Example**
Read Certificate Signing Request domains
```js
const { commonName, altNames } = acme.crypto.readCsrDomains(certificateRequest);
console.log(`Common name: ${commonName}`);
console.log(`Alt names: ${altNames.join(', ')}`);
```
<a name="readCertificateInfo"></a>
## readCertificateInfo(certPem) ⇒ <code>object</code>
Read information from a certificate
If multiple certificates are chained, the first will be read
**Kind**: global function
**Returns**: <code>object</code> - Certificate info
| Param | Type | Description |
| --- | --- | --- |
| certPem | <code>buffer</code> \| <code>string</code> | PEM encoded certificate or chain |
**Example**
Read certificate information
```js
const info = acme.crypto.readCertificateInfo(certificate);
const { commonName, altNames } = info.domains;
console.log(`Not after: ${info.notAfter}`);
console.log(`Not before: ${info.notBefore}`);
console.log(`Common name: ${commonName}`);
console.log(`Alt names: ${altNames.join(', ')}`);
```
<a name="createCsr"></a>
## createCsr(data, [keyPem]) ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a Certificate Signing Request
**Kind**: global function
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificateSigningRequest]
| Param | Type | Description |
| --- | --- | --- |
| data | <code>object</code> | |
| [data.keySize] | <code>number</code> | Size of newly created RSA private key modulus in bits, default: `2048` |
| [data.commonName] | <code>string</code> | FQDN of your server |
| [data.altNames] | <code>Array.&lt;string&gt;</code> | SAN (Subject Alternative Names), default: `[]` |
| [data.country] | <code>string</code> | 2 letter country code |
| [data.state] | <code>string</code> | State or province |
| [data.locality] | <code>string</code> | City |
| [data.organization] | <code>string</code> | Organization name |
| [data.organizationUnit] | <code>string</code> | Organizational unit name |
| [data.emailAddress] | <code>string</code> | Email address |
| [keyPem] | <code>buffer</code> \| <code>string</code> | PEM encoded CSR private key |
**Example**
Create a Certificate Signing Request
```js
const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
altNames: ['test.example.com'],
});
```
**Example**
Certificate Signing Request with both common and alternative names
> *Warning*: Certificate subject common name has been [deprecated](https://letsencrypt.org/docs/glossary/#def-CN) and its use is [discouraged](https://cabforum.org/uploads/BRv1.2.3.pdf).
```js
const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
keySize: 4096,
commonName: 'test.example.com',
altNames: ['foo.example.com', 'bar.example.com'],
});
```
**Example**
Certificate Signing Request with additional information
```js
const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
altNames: ['test.example.com'],
country: 'US',
state: 'California',
locality: 'Los Angeles',
organization: 'The Company Inc.',
organizationUnit: 'IT Department',
emailAddress: 'contact@example.com',
});
```
**Example**
Certificate Signing Request with ECDSA private key
```js
const certificateKey = await acme.crypto.createPrivateEcdsaKey();
const [, certificateRequest] = await acme.crypto.createCsr({
altNames: ['test.example.com'],
}, certificateKey);
```
<a name="createAlpnCertificate"></a>
## createAlpnCertificate(authz, keyAuthorization, [keyPem]) ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a self-signed ALPN certificate for TLS-ALPN-01 challenges
https://datatracker.ietf.org/doc/html/rfc8737
**Kind**: global function
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificate]
| Param | Type | Description |
| --- | --- | --- |
| authz | <code>object</code> | Identifier authorization |
| keyAuthorization | <code>string</code> | Challenge key authorization |
| [keyPem] | <code>buffer</code> \| <code>string</code> | PEM encoded CSR private key |
**Example**
Create a ALPN certificate
```js
const [alpnKey, alpnCertificate] = await acme.crypto.createAlpnCertificate(authz, keyAuthorization);
```
**Example**
Create a ALPN certificate with ECDSA private key
```js
const alpnKey = await acme.crypto.createPrivateEcdsaKey();
const [, alpnCertificate] = await acme.crypto.createAlpnCertificate(authz, keyAuthorization, alpnKey);
```
<a name="isAlpnCertificateAuthorizationValid"></a>
## isAlpnCertificateAuthorizationValid(certPem, keyAuthorization) ⇒ <code>boolean</code>
Validate that a ALPN certificate contains the expected key authorization
**Kind**: global function
**Returns**: <code>boolean</code> - True when valid
| Param | Type | Description |
| --- | --- | --- |
| certPem | <code>buffer</code> \| <code>string</code> | PEM encoded certificate |
| keyAuthorization | <code>string</code> | Expected challenge key authorization |

View File

@@ -0,0 +1,258 @@
## Objects
<dl>
<dt><a href="#forge">forge</a> : <code>object</code></dt>
<dd><p>Legacy node-forge crypto interface</p>
<p>DEPRECATION WARNING: This crypto interface is deprecated and will be removed from acme-client in a future
major release. Please migrate to the new <code>acme.crypto</code> interface at your earliest convenience.</p>
</dd>
</dl>
## Functions
<dl>
<dt><a href="#createPrivateKey">createPrivateKey([size])</a> ⇒ <code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private RSA key</p>
</dd>
<dt><a href="#createPublicKey">createPublicKey(key)</a> ⇒ <code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Create public key from a private RSA key</p>
</dd>
<dt><a href="#getPemBody">getPemBody(str)</a> ⇒ <code>string</code></dt>
<dd><p>Parse body of PEM encoded object from buffer or string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#splitPemChain">splitPemChain(str)</a> ⇒ <code>Array.&lt;string&gt;</code></dt>
<dd><p>Split chain of PEM encoded objects from buffer or string into array</p>
</dd>
<dt><a href="#getModulus">getModulus(input)</a> ⇒ <code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get modulus</p>
</dd>
<dt><a href="#getPublicExponent">getPublicExponent(input)</a> ⇒ <code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get public exponent</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains(csr)</a> ⇒ <code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo(cert)</a> ⇒ <code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read information from a certificate</p>
</dd>
<dt><a href="#createCsr">createCsr(data, [key])</a> ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
</dl>
<a name="forge"></a>
## forge : <code>object</code>
Legacy node-forge crypto interface
DEPRECATION WARNING: This crypto interface is deprecated and will be removed from acme-client in a future
major release. Please migrate to the new `acme.crypto` interface at your earliest convenience.
**Kind**: global namespace
<a name="createPrivateKey"></a>
## createPrivateKey([size]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [size] | <code>number</code> | <code>2048</code> | Size of the key, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.forge.createPrivateKey();
```
**Example**
Private RSA key with defined size
```js
const privateKey = await acme.forge.createPrivateKey(4096);
```
<a name="createPublicKey"></a>
## createPublicKey(key) ⇒ <code>Promise.&lt;buffer&gt;</code>
Create public key from a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded public RSA key
| Param | Type | Description |
| --- | --- | --- |
| key | <code>buffer</code> \| <code>string</code> | PEM encoded private RSA key |
**Example**
Create public key
```js
const publicKey = await acme.forge.createPublicKey(privateKey);
```
<a name="getPemBody"></a>
## getPemBody(str) ⇒ <code>string</code>
Parse body of PEM encoded object from buffer or string
If multiple objects are chained, the first body will be returned
**Kind**: global function
**Returns**: <code>string</code> - PEM body
| Param | Type | Description |
| --- | --- | --- |
| str | <code>buffer</code> \| <code>string</code> | PEM encoded buffer or string |
<a name="splitPemChain"></a>
## splitPemChain(str) ⇒ <code>Array.&lt;string&gt;</code>
Split chain of PEM encoded objects from buffer or string into array
**Kind**: global function
**Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM bodies
| Param | Type | Description |
| --- | --- | --- |
| str | <code>buffer</code> \| <code>string</code> | PEM encoded buffer or string |
<a name="getModulus"></a>
## getModulus(input) ⇒ <code>Promise.&lt;buffer&gt;</code>
Get modulus
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - Modulus
| Param | Type | Description |
| --- | --- | --- |
| input | <code>buffer</code> \| <code>string</code> | PEM encoded private key, certificate or CSR |
**Example**
Get modulus
```js
const m1 = await acme.forge.getModulus(privateKey);
const m2 = await acme.forge.getModulus(certificate);
const m3 = await acme.forge.getModulus(certificateRequest);
```
<a name="getPublicExponent"></a>
## getPublicExponent(input) ⇒ <code>Promise.&lt;buffer&gt;</code>
Get public exponent
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - Exponent
| Param | Type | Description |
| --- | --- | --- |
| input | <code>buffer</code> \| <code>string</code> | PEM encoded private key, certificate or CSR |
**Example**
Get public exponent
```js
const e1 = await acme.forge.getPublicExponent(privateKey);
const e2 = await acme.forge.getPublicExponent(certificate);
const e3 = await acme.forge.getPublicExponent(certificateRequest);
```
<a name="readCsrDomains"></a>
## readCsrDomains(csr) ⇒ <code>Promise.&lt;object&gt;</code>
Read domains from a Certificate Signing Request
**Kind**: global function
**Returns**: <code>Promise.&lt;object&gt;</code> - {commonName, altNames}
| Param | Type | Description |
| --- | --- | --- |
| csr | <code>buffer</code> \| <code>string</code> | PEM encoded Certificate Signing Request |
**Example**
Read Certificate Signing Request domains
```js
const { commonName, altNames } = await acme.forge.readCsrDomains(certificateRequest);
console.log(`Common name: ${commonName}`);
console.log(`Alt names: ${altNames.join(', ')}`);
```
<a name="readCertificateInfo"></a>
## readCertificateInfo(cert) ⇒ <code>Promise.&lt;object&gt;</code>
Read information from a certificate
**Kind**: global function
**Returns**: <code>Promise.&lt;object&gt;</code> - Certificate info
| Param | Type | Description |
| --- | --- | --- |
| cert | <code>buffer</code> \| <code>string</code> | PEM encoded certificate |
**Example**
Read certificate information
```js
const info = await acme.forge.readCertificateInfo(certificate);
const { commonName, altNames } = info.domains;
console.log(`Not after: ${info.notAfter}`);
console.log(`Not before: ${info.notBefore}`);
console.log(`Common name: ${commonName}`);
console.log(`Alt names: ${altNames.join(', ')}`);
```
<a name="createCsr"></a>
## createCsr(data, [key]) ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a Certificate Signing Request
**Kind**: global function
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificateSigningRequest]
| Param | Type | Description |
| --- | --- | --- |
| data | <code>object</code> | |
| [data.keySize] | <code>number</code> | Size of newly created private key, default: `2048` |
| [data.commonName] | <code>string</code> | |
| [data.altNames] | <code>Array.&lt;string&gt;</code> | default: `[]` |
| [data.country] | <code>string</code> | |
| [data.state] | <code>string</code> | |
| [data.locality] | <code>string</code> | |
| [data.organization] | <code>string</code> | |
| [data.organizationUnit] | <code>string</code> | |
| [data.emailAddress] | <code>string</code> | |
| [key] | <code>buffer</code> \| <code>string</code> | CSR private key |
**Example**
Create a Certificate Signing Request
```js
const [certificateKey, certificateRequest] = await acme.forge.createCsr({
altNames: ['test.example.com'],
});
```
**Example**
Certificate Signing Request with both common and alternative names
> *Warning*: Certificate subject common name has been [deprecated](https://letsencrypt.org/docs/glossary/#def-CN) and its use is [discouraged](https://cabforum.org/uploads/BRv1.2.3.pdf).
```js
const [certificateKey, certificateRequest] = await acme.forge.createCsr({
keySize: 4096,
commonName: 'test.example.com',
altNames: ['foo.example.com', 'bar.example.com'],
});
```
**Example**
Certificate Signing Request with additional information
```js
const [certificateKey, certificateRequest] = await acme.forge.createCsr({
altNames: ['test.example.com'],
country: 'US',
state: 'California',
locality: 'Los Angeles',
organization: 'The Company Inc.',
organizationUnit: 'IT Department',
emailAddress: 'contact@example.com',
});
```
**Example**
Certificate Signing Request with predefined private key
```js
const certificateKey = await acme.forge.createPrivateKey();
const [, certificateRequest] = await acme.forge.createCsr({
altNames: ['test.example.com'],
}, certificateKey);

View File

@@ -0,0 +1,93 @@
# Upgrading to v5 of `acme-client`
This document outlines the breaking changes introduced in v5 of `acme-client`, why they were introduced and what you should look out for when upgrading your application.
First off this release drops support for Node LTS v10, v12 and v14, and the reason for that is a new native crypto interface - more on that below. Since Node v14 is still currently in maintenance mode, `acme-client` v4 will continue to receive security updates and bugfixes until (at least) Node v14 reaches its end-of-line.
## New native crypto interface
A new crypto interface has been introduced with v5, which you can find under `acme.crypto`. It uses native Node.js cryptography APIs to generate private keys, JSON Web Keys and signatures, and finally enables support for ECC/ECDSA (P-256, P384 and P521), both for account private keys and certificates. The [@peculiar/x509](https://www.npmjs.com/package/@peculiar/x509) module is used to handle generation and parsing of Certificate Signing Requests.
Full documentation of `acme.crypto` can be [found here](crypto.md).
Since the release of `acme-client` v1.0.0 the crypto interface API has remained mostly unaltered. Back then an OpenSSL CLI wrapper was used to generate keys, and very much has changed since. This has naturally resulted in a buildup of technical debt and slight API inconsistencies over time. The introduction of a new interface was a good opportunity to finally clean up these APIs.
Below you will find a table summarizing the current `acme.forge` methods, and their new `acme.crypto` replacements. A summary of the changes for each method, including examples on how to migrate, can be found following the table.
*Note: The now deprecated `acme.forge` interface is still available for use in v5, and will not be removed until a future major version, most likely v6. Should you not wish to change to the new interface right away, the following breaking changes will not immediately affect you.*
* :green_circle: = API functionality unchanged between `acme.forge` and `acme.crypto`
* :orange_circle: = Slight API changes, like depromising or renaming, action may be required
* :red_circle: = Breaking API changes or removal, action required if using these methods
| Deprecated `.forge` API | New `.crypto` API | State |
| ----------------------------- | ----------------------------- | --------------------- |
| `await createPrivateKey()` | `await createPrivateKey()` | :green_circle: |
| `await createPublicKey()` | `getPublicKey()` | :orange_circle: (1) |
| `getPemBody()` | `getPemBodyAsB64u()` | :red_circle: (2) |
| `splitPemChain()` | `splitPemChain()` | :green_circle: |
| `await getModulus()` | `getJwk()` | :red_circle: (3) |
| `await getPublicExponent()` | `getJwk()` | :red_circle: (3) |
| `await readCsrDomains()` | `readCsrDomains()` | :orange_circle: (4) |
| `await readCertificateInfo()` | `readCertificateInfo()` | :orange_circle: (4) |
| `await createCsr()` | `await createCsr()` | :green_circle: |
### 1. `createPublicKey` renamed and depromised
* The method `createPublicKey()` has been renamed to `getPublicKey()`
* No longer returns a promise, but the resulting public key directly
* This is non-breaking if called with `await`, since `await` does not require its operand to be a promise
* :orange_circle: **This is a breaking change if used with `.then()` or `.catch()`**
```js
// Before
const publicKey = await acme.forge.createPublicKey(privateKey);
// After
const publicKey = acme.crypto.getPublicKey(privateKey);
```
### 2. `getPemBody` renamed, now returns Base64URL
* Method `getPemBody()` has been renamed to `getPemBodyAsB64u()`
* Instead of a Base64-encoded PEM body, now returns a Base64URL-encoded PEM body
* :red_circle: **This is a breaking change**
```js
// Before
const body = acme.forge.getPemBody(pem);
// After
const body = acme.crypto.getPemBodyAsB64u(pem);
```
### 3. `getModulus` and `getPublicExponent` merged into `getJwk`
* Methods `getModulus()` and `getPublicExponent()` have been removed
* Replaced by new method `getJwk()`
* :red_circle: **This is a breaking change**
```js
// Before
const mod = await acme.forge.getModulus(key);
const exp = await acme.forge.getPublicExponent(key);
// After
const { e, n } = acme.crypto.getJwk(key);
```
### 4. `readCsrDomains` and `readCertificateInfo` depromised
* Methods `readCsrDomains()` and `readCertificateInfo()` no longer return promises, but their resulting payloads directly
* This is non-breaking if called with `await`, since `await` does not require its operand to be a promise
* :orange_circle: **This is a breaking change if used with `.then()` or `.catch()`**
```js
// Before
const domains = await acme.forge.readCsrDomains(csr);
const info = await acme.forge.readCertificateInfo(certificate);
// After
const domains = acme.crypto.readCsrDomains(csr);
const info = acme.crypto.readCertificateInfo(certificate);
```

View File

@@ -0,0 +1,19 @@
# Disclaimer
These examples should not be used as is for any production environment, as they are just proof of concepts meant for testing and to get you started. The examples are naively written and purposefully avoids important topics since they will be specific to your application and how you choose to use `acme-client`, like for example:
1. **Concurrency control**
* If implementing on-demand certificate generation
* What happens when multiple requests hit your domain at the same time?
* Ensure your application does not place multiple cert orders for the same domain at the same time by implementing some sort of exclusive lock
2. **Domain allow lists**
* If implementing on-demand certificate generation
* What happens when someone manipulates the `ServerName` or `Host` header to your service?
* Ensure your application is unable to place certificate orders for domains you do not intend, as this can quickly rate limit your account and cause a DoS
3. **Clustering**
* If using `acme-client` across a cluster of servers
* Ensure challenge responses are known to all servers in your cluster, perhaps using a database or shared storage
4. **Certificate and key storage**
* Where and how should the account key be stored and read?
* Where and how should certificates and cert keys be stored and read?
* How and when should they be renewed?

View File

@@ -0,0 +1,148 @@
/**
* Example of acme.Client API
*/
const acme = require('./../');
function log(m) {
process.stdout.write(`${m}\n`);
}
/**
* Function used to satisfy an ACME challenge
*
* @param {object} authz Authorization object
* @param {object} challenge Selected challenge
* @param {string} keyAuthorization Authorization key
* @returns {Promise}
*/
async function challengeCreateFn(authz, challenge, keyAuthorization) {
/* Do something here */
log(JSON.stringify(authz));
log(JSON.stringify(challenge));
log(keyAuthorization);
}
/**
* Function used to remove an ACME challenge response
*
* @param {object} authz Authorization object
* @param {object} challenge Selected challenge
* @returns {Promise}
*/
async function challengeRemoveFn(authz, challenge, keyAuthorization) {
/* Do something here */
log(JSON.stringify(authz));
log(JSON.stringify(challenge));
log(keyAuthorization);
}
/**
* Main
*/
module.exports = async () => {
/* Init client */
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: await acme.crypto.createPrivateKey(),
});
/* Register account */
await client.createAccount({
termsOfServiceAgreed: true,
contact: ['mailto:test@example.com'],
});
/* Place new order */
const order = await client.createOrder({
identifiers: [
{ type: 'dns', value: 'example.com' },
{ type: 'dns', value: '*.example.com' },
],
});
/**
* authorizations / client.getAuthorizations(order);
* An array with one item per DNS name in the certificate order.
* All items require at least one satisfied challenge before order can be completed.
*/
const authorizations = await client.getAuthorizations(order);
const promises = authorizations.map(async (authz) => {
let challengeCompleted = false;
try {
/**
* challenges / authz.challenges
* An array of all available challenge types for a single DNS name.
* One of these challenges needs to be satisfied.
*/
const { challenges } = authz;
/* Just select any challenge */
const challenge = challenges.pop();
const keyAuthorization = await client.getChallengeKeyAuthorization(challenge);
try {
/* Satisfy challenge */
await challengeCreateFn(authz, challenge, keyAuthorization);
/* Verify that challenge is satisfied */
await client.verifyChallenge(authz, challenge);
/* Notify ACME provider that challenge is satisfied */
await client.completeChallenge(challenge);
challengeCompleted = true;
/* Wait for ACME provider to respond with valid status */
await client.waitForValidStatus(challenge);
}
finally {
/* Clean up challenge response */
try {
await challengeRemoveFn(authz, challenge, keyAuthorization);
}
catch (e) {
/**
* Catch errors thrown by challengeRemoveFn() so the order can
* be finalized, even though something went wrong during cleanup
*/
}
}
}
catch (e) {
/* Deactivate pending authz when unable to complete challenge */
if (!challengeCompleted) {
try {
await client.deactivateAuthorization(authz);
}
catch (f) {
/* Catch and suppress deactivateAuthorization() errors */
}
}
throw e;
}
});
/* Wait for challenges to complete */
await Promise.all(promises);
/* Finalize order */
const [key, csr] = await acme.crypto.createCsr({
altNames: ['example.com', '*.example.com'],
});
const finalized = await client.finalizeOrder(order, csr);
const cert = await client.getCertificate(finalized);
/* Done */
log(`CSR:\n${csr.toString()}`);
log(`Private key:\n${key.toString()}`);
log(`Certificate:\n${cert.toString()}`);
};

View File

@@ -0,0 +1,114 @@
/**
* Example of acme.Client.auto()
*/
// const fs = require('fs').promises;
const acme = require('./../');
function log(m) {
process.stdout.write(`${m}\n`);
}
/**
* Function used to satisfy an ACME challenge
*
* @param {object} authz Authorization object
* @param {object} challenge Selected challenge
* @param {string} keyAuthorization Authorization key
* @returns {Promise}
*/
async function challengeCreateFn(authz, challenge, keyAuthorization) {
log('Triggered challengeCreateFn()');
/* http-01 */
if (challenge.type === 'http-01') {
const filePath = `/var/www/html/.well-known/acme-challenge/${challenge.token}`;
const fileContents = keyAuthorization;
log(`Creating challenge response for ${authz.identifier.value} at path: ${filePath}`);
/* Replace this */
log(`Would write "${fileContents}" to path "${filePath}"`);
// await fs.writeFile(filePath, fileContents);
}
/* dns-01 */
else if (challenge.type === 'dns-01') {
const dnsRecord = `_acme-challenge.${authz.identifier.value}`;
const recordValue = keyAuthorization;
log(`Creating TXT record for ${authz.identifier.value}: ${dnsRecord}`);
/* Replace this */
log(`Would create TXT record "${dnsRecord}" with value "${recordValue}"`);
// await dnsProvider.createRecord(dnsRecord, 'TXT', recordValue);
}
}
/**
* Function used to remove an ACME challenge response
*
* @param {object} authz Authorization object
* @param {object} challenge Selected challenge
* @param {string} keyAuthorization Authorization key
* @returns {Promise}
*/
async function challengeRemoveFn(authz, challenge, keyAuthorization) {
log('Triggered challengeRemoveFn()');
/* http-01 */
if (challenge.type === 'http-01') {
const filePath = `/var/www/html/.well-known/acme-challenge/${challenge.token}`;
log(`Removing challenge response for ${authz.identifier.value} at path: ${filePath}`);
/* Replace this */
log(`Would remove file on path "${filePath}"`);
// await fs.unlink(filePath);
}
/* dns-01 */
else if (challenge.type === 'dns-01') {
const dnsRecord = `_acme-challenge.${authz.identifier.value}`;
const recordValue = keyAuthorization;
log(`Removing TXT record for ${authz.identifier.value}: ${dnsRecord}`);
/* Replace this */
log(`Would remove TXT record "${dnsRecord}" with value "${recordValue}"`);
// await dnsProvider.removeRecord(dnsRecord, 'TXT', recordValue);
}
}
/**
* Main
*/
module.exports = async () => {
/* Init client */
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: await acme.crypto.createPrivateKey(),
});
/* Create CSR */
const [key, csr] = await acme.crypto.createCsr({
altNames: ['example.com'],
});
/* Certificate */
const cert = await client.auto({
csr,
email: 'test@example.com',
termsOfServiceAgreed: true,
challengeCreateFn,
challengeRemoveFn,
});
/* Done */
log(`CSR:\n${csr.toString()}`);
log(`Private key:\n${key.toString()}`);
log(`Certificate:\n${cert.toString()}`);
};

View File

@@ -0,0 +1,21 @@
# dns-01
The greatest benefit of `dns-01` is that it is the only challenge type that can be used to issue ACME wildcard certificates, however it also has a few downsides. Your DNS provider needs to offer some sort of API you can use to automate adding and removing the required `TXT` DNS records. Additionally, solving DNS challenges will be much slower than the other challenge types because of DNS propagation delays.
## How it works
When solving `dns-01` challenges, you prove ownership of a domain by serving a specific payload within a specific DNS `TXT` record from the domains authoritative nameservers. The ACME authority provides the client with a token that, along with a thumbprint of your account key, is used to generate a `base64url` encoded `SHA256` digest. This payload is then placed as a `TXT` record under DNS name `_acme-challenge.$YOUR_DOMAIN`.
Once the order is finalized, the ACME authority will lookup your domains DNS record to verify that the payload is correct. `CNAME` and `NS` records are followed, should you wish to delegate challenge response to another DNS zone or record.
## Pros and cons
* Only challenge type that can be used to issue wildcard certificates
* Your DNS provider needs to supply an API that can be used
* DNS propagation time may be slow
* Useful in instances where both port 80 and 443 are unavailable
## External links
* [https://letsencrypt.org/docs/challenge-types/#dns-01-challenge](https://letsencrypt.org/docs/challenge-types/#dns-01-challenge)
* [https://datatracker.ietf.org/doc/html/rfc8555#section-8.4](https://datatracker.ietf.org/doc/html/rfc8555#section-8.4)

View File

@@ -0,0 +1,88 @@
/**
* Example using dns-01 challenge to generate certificates
*
* NOTE: This example is incomplete as the DNS challenge response implementation
* will be specific to your DNS providers API.
*
* NOTE: This example does not order certificates on-demand, as solving dns-01
* will likely be too slow for it to make sense. Instead, it orders a wildcard
* certificate on init before starting the HTTPS server as a demonstration.
*/
const https = require('https');
const acme = require('./../../');
const HTTPS_SERVER_PORT = 443;
const WILDCARD_DOMAIN = 'example.com';
function log(m) {
process.stdout.write(`${(new Date()).toISOString()} ${m}\n`);
}
/**
* Main
*/
(async () => {
try {
/**
* Initialize ACME client
*/
log('Initializing ACME client');
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: await acme.crypto.createPrivateKey(),
});
/**
* Order wildcard certificate
*/
log(`Creating CSR for ${WILDCARD_DOMAIN}`);
const [key, csr] = await acme.crypto.createCsr({
altNames: [WILDCARD_DOMAIN, `*.${WILDCARD_DOMAIN}`],
});
log(`Ordering certificate for ${WILDCARD_DOMAIN}`);
const cert = await client.auto({
csr,
email: 'test@example.com',
termsOfServiceAgreed: true,
challengePriority: ['dns-01'],
challengeCreateFn: (authz, challenge, keyAuthorization) => {
/* TODO: Implement this */
log(`[TODO] Add TXT record key=_acme-challenge.${authz.identifier.value} value=${keyAuthorization}`);
},
challengeRemoveFn: (authz, challenge, keyAuthorization) => {
/* TODO: Implement this */
log(`[TODO] Remove TXT record key=_acme-challenge.${authz.identifier.value} value=${keyAuthorization}`);
},
});
log(`Certificate for ${WILDCARD_DOMAIN} created successfully`);
/**
* HTTPS server
*/
const requestListener = (req, res) => {
log(`HTTP 200 ${req.headers.host}${req.url}`);
res.writeHead(200);
res.end('Hello world\n');
};
const httpsServer = https.createServer({
key,
cert,
}, requestListener);
httpsServer.listen(HTTPS_SERVER_PORT, () => {
log(`HTTPS server listening on port ${HTTPS_SERVER_PORT}`);
});
}
catch (e) {
log(`[FATAL] ${e.message}`);
process.exit(1);
}
})();

View File

@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDCTCCAfGgAwIBAgIUGwI6ZLE3HN7oRZ9BvWLde0Tsu7EwDQYJKoZIhvcNAQEL
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIyMDgwMTAwNTMzMVoXDTIyMDgz
MTAwNTMzMVowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF
AAOCAQ8AMIIBCgKCAQEA4c7zSiY6OEp9xYZHY42FUfOLREm03NstZhd9IxFFePwe
CTTirJjmi5teKQwzBmEok0SJkanJUaMsMlOHjEykWSc4SBO4QjD349Q60044i9WS
7KHzeSqpWTG+V9jF3HOJPw843VG9hXy3ulXKcysTXzumTVQwfatCODBNkpWqMju2
N33biLgmpqwLbDSfKXS3uSVTfoHAKGT/oRepko7/0Hwr5oEmjXEbpRWRhU09KYjH
7jokRaiQRn0h216a0r4AKzSNGihNQtKJZIuwJvLFPMQYafsu9qBaCLPqDBXCwQWG
aYh6Cm3kTkADKzG1LVPB/7/Uh2d4Fck/ejR9qXRK3QIDAQABo1MwUTAdBgNVHQ4E
FgQUvyceAVDMPbW7wHwNF9px5dWfgd4wHwYDVR0jBBgwFoAUvyceAVDMPbW7wHwN
F9px5dWfgd4wDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAaYkz
AOHrRirPwfkwjb+uMliGHfANrmak8r5VDQA73RLTQLRhMpf1yrb1uhH7p/CUYKap
x1C8RGQAXujoQbQOslyZA7cVLA9ASSZS6Noq7NerfGBiqxeuye+x3lIIk1EOL/rH
aBu9rrYGmlU49PlGAQSfFHkwzXti2Mp1VQv8eMOBLR49ezZIXHiPE8S3gjNymZ0G
UA13wzZCT7SG1BLmQ/cBVASG2wvhlC8IG/4vF0Xe+boSOb1vGWUtHS+MnvvRK4n5
TMUtrnxSQ/LA8AtobvzqgvQVKBSPLK6RzLE7I+Q9pWsbKTBqfyStuQrQFqafBOqN
eYfPUgiID9uvfrxLvA==
-----END CERTIFICATE-----

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDhzvNKJjo4Sn3F
hkdjjYVR84tESbTc2y1mF30jEUV4/B4JNOKsmOaLm14pDDMGYSiTRImRqclRoywy
U4eMTKRZJzhIE7hCMPfj1DrTTjiL1ZLsofN5KqlZMb5X2MXcc4k/DzjdUb2FfLe6
VcpzKxNfO6ZNVDB9q0I4ME2SlaoyO7Y3fduIuCamrAtsNJ8pdLe5JVN+gcAoZP+h
F6mSjv/QfCvmgSaNcRulFZGFTT0piMfuOiRFqJBGfSHbXprSvgArNI0aKE1C0olk
i7Am8sU8xBhp+y72oFoIs+oMFcLBBYZpiHoKbeROQAMrMbUtU8H/v9SHZ3gVyT96
NH2pdErdAgMBAAECggEBAImI0FxQblOM45AkmmTDdPmWWjPspNGEWeF92wU55tOq
0+yNnqa7tmg/6JkdyhJPqTQRoazr+ifUN/4rLDtDDzMSFVCpWihOxR2qTW4YjY52
NjgU6EPbvSwLhUDiUplUcbrL3bnHqKSecxV2XYnKKdFudntRFPvmDL5GhWkL6Y8P
9KiQaYuPf4av8PR0NlWBMiZs+CBjLlnSTMAWRYj5mRSyFSEOMT7+Lvr3TqrO2/nh
0H30LXxrXXXuCbQXnVy3oSNf7TrathT2ADIrUUTdRHsLscvkEA35VtFQtWdJLtEg
sso1J7viV9YDU4niPSdHPj3ubBjAExej4qCOzatsIQ0CgYEA8L5S3ojy89g7q6vB
QuusIrjGkyM1yebDWqhEnjvlMpfrU1hCS90BM1ozZ28bjz/7PBimKL+A8BO+W0m4
2s9YbZP5aGwo18Iq86XEdtDgWtQ3NXbYkb8F8LNtyevC/UlAI/xyIRr7hDYlr/1v
jJg16DXiNLyk+uj4Q3EuwzNl8n8CgYEA8B5UUkOiufPtm+ZOq9AlBpIa+NYaahZM
h52jzMTKsFB18xsZU/ufvpKvXEu1sTeCDRo3JAHmiA6AG292Zc7W+uWRtMtlmQWE
wnoZ6hKvEkFnArLCY6Nm5Qqm1wipLwDVO3dD/CDL86siHrXK4wU7Q+bp6xbt8lDi
itz5F7p7HKMCgYAoj8iimexlTU9wczXSsqaECyHZ9JrBc9ICWkuFZY4OYi5SEpLI
+WmUX2Q9zyiTkDIiQ/zq7KkqygjOlLNCmqDJhZ8GCwMupxZZitp5MmQ6qXrL1URT
+h1kGrcqyEBIMKlP5t7L2SH7eqwK5OaAh7y9bSa5v/cEF3CM3GsGlIhevQKBgBGU
RtwW84zlnNmzDMNrY6qNe8gH9LsbktLC6cEOD0DFQz1fGIWbgGB1YL1DFbQ5uh23
c54BPZ1sYlif2m0trXOE5xvzYCbJzqRmSAto/sQ5YY9DAxREXD4cf4ZyreAxEWtf
Ge0VgZj/SGozKP1h3qrj9vAtJ5J79XnxH5NrJaQ9AoGBAM2rQrt8H2kizg4wMGRZ
0G3709W7xxlbPdm+i/jFVDayJswCr0+eMm4gGyyZL3135D0fcijxytKgg3/OpOJF
jC9vsHsE2K1ATp6eYvYjrhqJHI1m44aq/h46SfajytZQjwMT/jaApULDP2/fCBm5
6eS2WCyHyrYJyrgoYQF56nsT
-----END PRIVATE KEY-----

View File

@@ -0,0 +1,21 @@
# http-01
The `http-01` challenge type is the simplest to implement and should likely be your default choice, unless you either require wildcard certificates or if port 80 is unavailable for use.
## How it works
When solving `http-01` challenges, you prove ownership of a domain name by serving a specific payload from a specific URL. The ACME authority provides the client with a token that is used to generate the URL and file contents. The file must exist at `http://$YOUR_DOMAIN/.well-known/acme-challenge/$TOKEN` and contain the token and a thumbprint of your account key.
Once the order is finalized, the ACME authority will verify that the URL responds with the correct payload by sending HTTP requests before the challenge is valid. HTTP redirects are followed, and Let's Encrypt allows redirecting to HTTPS although this diverges from the ACME spec.
## Pros and cons
* Challenge must be satisfied using port 80 (HTTP)
* The simplest challenge type to implement
* Can not be used to issue wildcard certificates
* If using multiple web servers, all of them need to respond with the correct token
## External links
* [https://letsencrypt.org/docs/challenge-types/#http-01-challenge](https://letsencrypt.org/docs/challenge-types/#http-01-challenge)
* [https://datatracker.ietf.org/doc/html/rfc8555#section-8.3](https://datatracker.ietf.org/doc/html/rfc8555#section-8.3)

View File

@@ -0,0 +1,168 @@
/**
* Example using http-01 challenge to generate certificates on-demand
*/
const fs = require('fs');
const path = require('path');
const http = require('http');
const https = require('https');
const tls = require('tls');
const acme = require('./../../');
const HTTP_SERVER_PORT = 80;
const HTTPS_SERVER_PORT = 443;
const VALID_DOMAINS = ['example.com', 'example.org'];
const FALLBACK_KEY = fs.readFileSync(path.join(__dirname, '..', 'fallback.key'));
const FALLBACK_CERT = fs.readFileSync(path.join(__dirname, '..', 'fallback.crt'));
const pendingDomains = {};
const challengeResponses = {};
const certificateStore = {};
function log(m) {
process.stdout.write(`${(new Date()).toISOString()} ${m}\n`);
}
/**
* On-demand certificate generation using http-01
*/
async function getCertOnDemand(client, servername, attempt = 0) {
/* Invalid domain */
if (!VALID_DOMAINS.includes(servername)) {
throw new Error(`Invalid domain: ${servername}`);
}
/* Certificate exists */
if (servername in certificateStore) {
return certificateStore[servername];
}
/* Waiting on certificate order to go through */
if (servername in pendingDomains) {
if (attempt >= 10) {
throw new Error(`Gave up waiting on certificate for ${servername}`);
}
await new Promise((resolve) => { setTimeout(resolve, 1000); });
return getCertOnDemand(client, servername, (attempt + 1));
}
/* Create CSR */
log(`Creating CSR for ${servername}`);
const [key, csr] = await acme.crypto.createCsr({
altNames: [servername],
});
/* Order certificate */
log(`Ordering certificate for ${servername}`);
const cert = await client.auto({
csr,
email: 'test@example.com',
termsOfServiceAgreed: true,
challengePriority: ['http-01'],
challengeCreateFn: (authz, challenge, keyAuthorization) => {
challengeResponses[challenge.token] = keyAuthorization;
},
challengeRemoveFn: (authz, challenge) => {
delete challengeResponses[challenge.token];
},
});
/* Done, store certificate */
log(`Certificate for ${servername} created successfully`);
certificateStore[servername] = [key, cert];
delete pendingDomains[servername];
return certificateStore[servername];
}
/**
* Main
*/
(async () => {
try {
/**
* Initialize ACME client
*/
log('Initializing ACME client');
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: await acme.crypto.createPrivateKey(),
});
/**
* HTTP server
*/
const httpServer = http.createServer((req, res) => {
if (req.url.match(/\/\.well-known\/acme-challenge\/.+/)) {
const token = req.url.split('/').pop();
log(`Received challenge request for token=${token}`);
/* ACME challenge response */
if (token in challengeResponses) {
log(`Serving challenge response HTTP 200 token=${token}`);
res.writeHead(200);
res.end(challengeResponses[token]);
return;
}
/* Challenge response not found */
log(`Oops, challenge response not found for token=${token}`);
res.writeHead(404);
res.end();
return;
}
/* HTTP 302 redirect */
log(`HTTP 302 ${req.headers.host}${req.url}`);
res.writeHead(302, { Location: `https://${req.headers.host}${req.url}` });
res.end();
});
httpServer.listen(HTTP_SERVER_PORT, () => {
log(`HTTP server listening on port ${HTTP_SERVER_PORT}`);
});
/**
* HTTPS server
*/
const requestListener = (req, res) => {
log(`HTTP 200 ${req.headers.host}${req.url}`);
res.writeHead(200);
res.end('Hello world\n');
};
const httpsServer = https.createServer({
/* Fallback certificate */
key: FALLBACK_KEY,
cert: FALLBACK_CERT,
/* Serve certificate based on servername */
SNICallback: async (servername, cb) => {
try {
log(`Handling SNI request for ${servername}`);
const [key, cert] = await getCertOnDemand(client, servername);
log(`Found certificate for ${servername}, serving secure context`);
cb(null, tls.createSecureContext({ key, cert }));
}
catch (e) {
log(`[ERROR] ${e.message}`);
cb(e.message);
}
},
}, requestListener);
httpsServer.listen(HTTPS_SERVER_PORT, () => {
log(`HTTPS server listening on port ${HTTPS_SERVER_PORT}`);
});
}
catch (e) {
log(`[FATAL] ${e.message}`);
process.exit(1);
}
})();

View File

@@ -0,0 +1,44 @@
# tls-alpn-01
Responding to `tls-alpn-01` challenges using Node.js is a bit more involved than the other two challenge types, and requires a proxy (f.ex. [Nginx](https://nginx.org) or [HAProxy](https://www.haproxy.org)) in front of the Node.js service. The reason for this is that `tls-alpn-01` is solved by responding to the ACME challenge using self-signed certificates with an ALPN extension containing the challenge response.
Since we don't want users of our application to be served with these self-signed certificates, we need to split the HTTPS traffic into two different Node.js backends - one that only serves ALPN certificates for challenge responses, and the other for actual end-user traffic that serves certificates retrieved from the ACME provider. As far as I *(library author)* know, routing HTTPS traffic based on ALPN protocol can not be done purely using Node.js.
The end result should look something like this:
```text
Nginx or HAProxy (0.0.0.0:443)
*inspect requests SSL ALPN protocol*
If ALPN == acme-tls/1
-> Node.js ALPN responder (127.0.0.1:4444)
Else
-> Node.js HTTPS server (127.0.0.1:4443)
```
Example proxy configuration:
* [haproxy.cfg](haproxy.cfg) *(requires HAProxy >= v1.9.1)*
* [nginx.conf](nginx.conf) *(requires [ngx_stream_ssl_preread_module](https://nginx.org/en/docs/stream/ngx_stream_ssl_preread_module.html))*
Big thanks to [acme.sh](https://github.com/acmesh-official/acme.sh) and [dehydrated](https://github.com/dehydrated-io/dehydrated) for doing the legwork and providing Nginx and HAProxy config examples.
## How it works
When solving `tls-alpn-01` challenges, you prove ownership of a domain name by serving a specially crafted certificate over HTTPS. The ACME authority provides the client with a token that is placed into the certificates `id-pe-acmeIdentifier` extension along with a thumbprint of your account key.
Once the order is finalized, the ACME authority will verify by sending HTTPS requests to your domain with the `acme-tls/1` ALPN protocol, indicating to the server that it should serve the challenge response certificate. If the `id-pe-acmeIdentifier` extension contains the correct payload, the challenge is valid.
## Pros and cons
* Challenge must be satisfied using port 443 (HTTPS)
* Useful in instances where port 80 is unavailable
* Can not be used to issue wildcard certificates
* More complex than `http-01`, can not be solved purely using Node.js
* If using multiple web servers, all of them need to respond with the correct certificate
## External links
* [https://letsencrypt.org/docs/challenge-types/#tls-alpn-01](https://letsencrypt.org/docs/challenge-types/#tls-alpn-01)
* [https://github.com/dehydrated-io/dehydrated/blob/master/docs/tls-alpn.md](https://github.com/dehydrated-io/dehydrated/blob/master/docs/tls-alpn.md)
* [https://github.com/acmesh-official/acme.sh/wiki/TLS-ALPN-without-downtime](https://github.com/acmesh-official/acme.sh/wiki/TLS-ALPN-without-downtime)
* [https://datatracker.ietf.org/doc/html/rfc8737](https://datatracker.ietf.org/doc/html/rfc8737)

View File

@@ -0,0 +1,23 @@
##
# HTTPS listener
# - Send to ALPN responder port 4444 if protocol is acme-tls/1
# - Default to HTTPS backend port 4443
##
frontend https
mode tcp
bind :443
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend alpnresp if { req.ssl_alpn acme-tls/1 }
default_backend https
# Default HTTPS backend
backend https
mode tcp
server https 127.0.0.1:4443
# ACME tls-alpn-01 responder backend
backend alpnresp
mode tcp
server acmesh 127.0.0.1:4444

View File

@@ -0,0 +1,19 @@
##
# HTTPS server
# - Send to ALPN responder port 4444 if protocol is acme-tls/1
# - Default to HTTPS backend port 4443
##
stream {
map $ssl_preread_alpn_protocols $tls_port {
~\bacme-tls/1\b 4444;
default 4443;
}
server {
listen 443;
listen [::]:443;
proxy_pass 127.0.0.1:$tls_port;
ssl_preread on;
}
}

View File

@@ -0,0 +1,176 @@
/**
* Example using tls-alpn-01 challenge to generate certificates on-demand
*/
const fs = require('fs');
const path = require('path');
const https = require('https');
const tls = require('tls');
const acme = require('./../../');
const HTTPS_SERVER_PORT = 4443;
const ALPN_RESPONDER_PORT = 4444;
const VALID_DOMAINS = ['example.com', 'example.org'];
const FALLBACK_KEY = fs.readFileSync(path.join(__dirname, '..', 'fallback.key'));
const FALLBACK_CERT = fs.readFileSync(path.join(__dirname, '..', 'fallback.crt'));
const pendingDomains = {};
const alpnResponses = {};
const certificateStore = {};
function log(m) {
process.stdout.write(`${(new Date()).toISOString()} ${m}\n`);
}
/**
* On-demand certificate generation using tls-alpn-01
*/
async function getCertOnDemand(client, servername, attempt = 0) {
/* Invalid domain */
if (!VALID_DOMAINS.includes(servername)) {
throw new Error(`Invalid domain: ${servername}`);
}
/* Certificate exists */
if (servername in certificateStore) {
return certificateStore[servername];
}
/* Waiting on certificate order to go through */
if (servername in pendingDomains) {
if (attempt >= 10) {
throw new Error(`Gave up waiting on certificate for ${servername}`);
}
await new Promise((resolve) => { setTimeout(resolve, 1000); });
return getCertOnDemand(client, servername, (attempt + 1));
}
/* Create CSR */
log(`Creating CSR for ${servername}`);
const [key, csr] = await acme.crypto.createCsr({
altNames: [servername],
});
/* Order certificate */
log(`Ordering certificate for ${servername}`);
const cert = await client.auto({
csr,
email: 'test@example.com',
termsOfServiceAgreed: true,
challengePriority: ['tls-alpn-01'],
challengeCreateFn: async (authz, challenge, keyAuthorization) => {
alpnResponses[authz.identifier.value] = await acme.crypto.createAlpnCertificate(authz, keyAuthorization);
},
challengeRemoveFn: (authz) => {
delete alpnResponses[authz.identifier.value];
},
});
/* Done, store certificate */
log(`Certificate for ${servername} created successfully`);
certificateStore[servername] = [key, cert];
delete pendingDomains[servername];
return certificateStore[servername];
}
/**
* Main
*/
(async () => {
try {
/**
* Initialize ACME client
*/
log('Initializing ACME client');
const client = new acme.Client({
directoryUrl: acme.directory.letsencrypt.staging,
accountKey: await acme.crypto.createPrivateKey(),
});
/**
* ALPN responder
*/
const alpnResponder = https.createServer({
/* Fallback cert */
key: FALLBACK_KEY,
cert: FALLBACK_CERT,
/* Allow acme-tls/1 ALPN protocol */
ALPNProtocols: ['acme-tls/1'],
/* Serve ALPN certificate based on servername */
SNICallback: async (servername, cb) => {
try {
log(`Handling ALPN SNI request for ${servername}`);
if (!Object.keys(alpnResponses).includes(servername)) {
throw new Error(`No ALPN certificate found for ${servername}`);
}
/* Serve ALPN challenge response */
log(`Found ALPN certificate for ${servername}, serving secure context`);
cb(null, tls.createSecureContext({
key: alpnResponses[servername][0],
cert: alpnResponses[servername][1],
}));
}
catch (e) {
log(`[ERROR] ${e.message}`);
cb(e.message);
}
},
});
/* Terminate once TLS handshake has been established */
alpnResponder.on('secureConnection', (socket) => {
socket.end();
});
alpnResponder.listen(ALPN_RESPONDER_PORT, () => {
log(`ALPN responder listening on port ${ALPN_RESPONDER_PORT}`);
});
/**
* HTTPS server
*/
const requestListener = (req, res) => {
log(`HTTP 200 ${req.headers.host}${req.url}`);
res.writeHead(200);
res.end('Hello world\n');
};
const httpsServer = https.createServer({
/* Fallback cert */
key: FALLBACK_KEY,
cert: FALLBACK_CERT,
/* Serve certificate based on servername */
SNICallback: async (servername, cb) => {
try {
log(`Handling SNI request for ${servername}`);
const [key, cert] = await getCertOnDemand(client, servername);
log(`Found certificate for ${servername}, serving secure context`);
cb(null, tls.createSecureContext({ key, cert }));
}
catch (e) {
log(`[ERROR] ${e.message}`);
cb(e.message);
}
},
}, requestListener);
httpsServer.listen(HTTPS_SERVER_PORT, () => {
log(`HTTPS server listening on port ${HTTPS_SERVER_PORT}`);
});
}
catch (e) {
log(`[FATAL] ${e.message}`);
process.exit(1);
}
})();

View File

@@ -0,0 +1,63 @@
{
"name": "@certd/acme-client",
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.25.6",
"main": "src/index.js",
"types": "types/index.d.ts",
"license": "MIT",
"homepage": "https://github.com/publishlab/node-acme-client",
"engines": {
"node": ">= 18"
},
"files": [
"src",
"types"
],
"dependencies": {
"@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5",
"axios": "^1.7.2",
"debug": "^4.3.5",
"https-proxy-agent": "^7.0.4",
"node-forge": "^1.3.1"
},
"devDependencies": {
"@types/node": "^20.14.10",
"chai": "^4.4.1",
"chai-as-promised": "^7.1.2",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.29.1",
"jsdoc-to-markdown": "^8.0.1",
"mocha": "^10.6.0",
"nock": "^13.5.4",
"tsd": "^0.31.1",
"typescript": "^5.4.2",
"uuid": "^8.3.2"
},
"scripts": {
"build-docs": "jsdoc2md src/client.js > docs/client.md && jsdoc2md src/crypto/index.js > docs/crypto.md && jsdoc2md src/crypto/forge.js > docs/forge.md",
"lint": "eslint .",
"lint-types": "tsd",
"prepublishOnly": "npm run build-docs",
"test": "mocha -t 60000 \"test/setup.js\" \"test/**/*.spec.js\""
},
"repository": {
"type": "git",
"url": "https://github.com/publishlab/node-acme-client"
},
"keywords": [
"acme",
"client",
"lets",
"encrypt",
"acmev2",
"boulder"
],
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "be13390b3a9177c9d99f1efabfc285d0c377b013"
}

View File

@@ -0,0 +1,250 @@
/**
* ACME API client
*/
const util = require('./util');
const { log } = require('./logger');
/**
* AcmeApi
*
* @class
* @param {HttpClient} httpClient
*/
class AcmeApi {
constructor(httpClient, accountUrl = null) {
this.http = httpClient;
this.accountUrl = accountUrl;
}
getLocationFromHeader(resp) {
let locationUrl = resp.headers.location;
const mapping = this.http.urlMapping;
if (mapping.mappings) {
// eslint-disable-next-line guard-for-in,no-restricted-syntax
for (const key in mapping.mappings) {
const url = mapping.mappings[key];
if (locationUrl.indexOf(url) > -1) {
locationUrl = locationUrl.replace(url, key);
}
}
}
return locationUrl;
}
/**
* Get account URL
*
* @private
* @returns {string} Account URL
*/
getAccountUrl() {
if (!this.accountUrl) {
throw new Error('No account URL found, register account first');
}
return this.accountUrl;
}
/**
* ACME API request
*
* @private
* @param {string} url Request URL
* @param {object} [payload] Request payload, default: `null`
* @param {number[]} [validStatusCodes] Array of valid HTTP response status codes, default: `[]`
* @param {object} [opts]
* @param {boolean} [opts.includeJwsKid] Include KID instead of JWK in JWS header, default: `true`
* @param {boolean} [opts.includeExternalAccountBinding] Include EAB in request, default: `false`
* @returns {Promise<object>} HTTP response
*/
async apiRequest(url, payload = null, validStatusCodes = [], { includeJwsKid = true, includeExternalAccountBinding = false } = {}) {
const kid = includeJwsKid ? this.getAccountUrl() : null;
const resp = await this.http.signedRequest(url, payload, { kid, includeExternalAccountBinding });
if (validStatusCodes.length && (validStatusCodes.indexOf(resp.status) === -1)) {
throw new Error(util.formatResponseError(resp));
}
return resp;
}
/**
* ACME API request by resource name helper
*
* @private
* @param {string} resource Request resource name
* @param {object} [payload] Request payload, default: `null`
* @param {number[]} [validStatusCodes] Array of valid HTTP response status codes, default: `[]`
* @param {object} [opts]
* @param {boolean} [opts.includeJwsKid] Include KID instead of JWK in JWS header, default: `true`
* @param {boolean} [opts.includeExternalAccountBinding] Include EAB in request, default: `false`
* @returns {Promise<object>} HTTP response
*/
async apiResourceRequest(resource, payload = null, validStatusCodes = [], { includeJwsKid = true, includeExternalAccountBinding = false } = {}) {
const resourceUrl = await this.http.getResourceUrl(resource);
return this.apiRequest(resourceUrl, payload, validStatusCodes, { includeJwsKid, includeExternalAccountBinding });
}
/**
* Get Terms of Service URL if available
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.1
*
* @returns {Promise<string|null>} ToS URL
*/
async getTermsOfServiceUrl() {
return this.http.getMetaField('termsOfService');
}
/**
* Create new account
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.3
*
* @param {object} data Request payload
* @returns {Promise<object>} HTTP response
*/
async createAccount(data) {
const resp = await this.apiResourceRequest('newAccount', data, [200, 201], {
includeJwsKid: false,
includeExternalAccountBinding: (data.onlyReturnExisting !== true),
});
/* Set account URL */
if (resp.headers.location) {
this.accountUrl = this.getLocationFromHeader(resp);
}
return resp;
}
/**
* Update account
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.2
*
* @param {object} data Request payload
* @returns {Promise<object>} HTTP response
*/
updateAccount(data) {
return this.apiRequest(this.getAccountUrl(), data, [200, 202]);
}
/**
* Update account key
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.5
*
* @param {object} data Request payload
* @returns {Promise<object>} HTTP response
*/
updateAccountKey(data) {
return this.apiResourceRequest('keyChange', data, [200]);
}
/**
* Create new order
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
*
* @param {object} data Request payload
* @returns {Promise<object>} HTTP response
*/
createOrder(data) {
return this.apiResourceRequest('newOrder', data, [201]);
}
/**
* Get order
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
*
* @param {string} url Order URL
* @returns {Promise<object>} HTTP response
*/
getOrder(url) {
return this.apiRequest(url, null, [200]);
}
/**
* Finalize order
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
*
* @param {string} url Finalization URL
* @param {object} data Request payload
* @returns {Promise<object>} HTTP response
*/
finalizeOrder(url, data) {
return this.apiRequest(url, data, [200]);
}
/**
* Get identifier authorization
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.5
*
* @param {string} url Authorization URL
* @returns {Promise<object>} HTTP response
*/
getAuthorization(url) {
return this.apiRequest(url, null, [200]);
}
/**
* Update identifier authorization
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.2
*
* @param {string} url Authorization URL
* @param {object} data Request payload
* @returns {Promise<object>} HTTP response
*/
updateAuthorization(url, data) {
return this.apiRequest(url, data, [200]);
}
/**
* Complete challenge
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.1
*
* @param {string} url Challenge URL
* @param {object} data Request payload
* @returns {Promise<object>} HTTP response
*/
completeChallenge(url, data) {
return this.apiRequest(url, data, [200]);
}
/**
* Revoke certificate
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.6
*
* @param {object} data Request payload
* @returns {Promise<object>} HTTP response
*/
revokeCert(data) {
return this.apiResourceRequest('revokeCert', data, [200]);
}
}
/* Export API */
module.exports = AcmeApi;

View File

@@ -0,0 +1,285 @@
/**
* ACME auto helper
*/
const { readCsrDomains } = require('./crypto');
const { log } = require('./logger');
const { wait } = require('./wait');
const defaultOpts = {
csr: null,
email: null,
preferredChain: null,
termsOfServiceAgreed: false,
skipChallengeVerification: false,
challengePriority: ['http-01', 'dns-01'],
challengeCreateFn: async () => {
throw new Error('Missing challengeCreateFn()');
},
challengeRemoveFn: async () => {
throw new Error('Missing challengeRemoveFn()');
},
};
/**
* ACME client auto mode
*
* @param {AcmeClient} client ACME client
* @param {object} userOpts Options
* @returns {Promise<buffer>} Certificate
*/
module.exports = async (client, userOpts) => {
const opts = { ...defaultOpts, ...userOpts };
const accountPayload = { termsOfServiceAgreed: opts.termsOfServiceAgreed };
if (!Buffer.isBuffer(opts.csr)) {
opts.csr = Buffer.from(opts.csr);
}
if (opts.email) {
accountPayload.contact = [`mailto:${opts.email}`];
}
if (opts.externalAccountBinding) {
accountPayload.externalAccountBinding = opts.externalAccountBinding;
}
/**
* Register account
*/
log('[auto] Checking account');
try {
client.getAccountUrl();
log('[auto] Account URL already exists, skipping account registration');
}
catch (e) {
log('[auto] Registering account');
await client.createAccount(accountPayload);
}
/**
* Parse domains from CSR
*/
log('[auto] Parsing domains from Certificate Signing Request');
const { commonName, altNames } = readCsrDomains(opts.csr);
const uniqueDomains = Array.from(new Set([commonName].concat(altNames).filter((d) => d)));
log(`[auto] Resolved ${uniqueDomains.length} unique domains from parsing the Certificate Signing Request`);
/**
* Place order
*/
log('[auto] Placing new certificate order with ACME provider');
const orderPayload = { identifiers: uniqueDomains.map((d) => ({ type: 'dns', value: d })) };
const order = await client.createOrder(orderPayload);
const authorizations = await client.getAuthorizations(order);
log(`[auto] Placed certificate order successfully, received ${authorizations.length} identity authorizations`);
/**
* Resolve and satisfy challenges
*/
log('[auto] Resolving and satisfying authorization challenges');
const clearTasks = [];
const challengeFunc = async (authz) => {
const d = authz.identifier.value;
let challengeCompleted = false;
/* Skip authz that already has valid status */
if (authz.status === 'valid') {
log(`[auto] [${d}] Authorization already has valid status, no need to complete challenges`);
return;
}
try {
/* Select challenge based on priority */
const challenge = authz.challenges.sort((a, b) => {
const aidx = opts.challengePriority.indexOf(a.type);
const bidx = opts.challengePriority.indexOf(b.type);
if (aidx === -1) return 1;
if (bidx === -1) return -1;
return aidx - bidx;
}).slice(0, 1)[0];
if (!challenge) {
throw new Error(`Unable to select challenge for ${d}, no challenge found`);
}
log(`[auto] [${d}] Found ${authz.challenges.length} challenges, selected type: ${challenge.type}`);
/* Trigger challengeCreateFn() */
log(`[auto] [${d}] Trigger challengeCreateFn()`);
const keyAuthorization = await client.getChallengeKeyAuthorization(challenge);
let recordItem = null;
try {
recordItem = await opts.challengeCreateFn(authz, challenge, keyAuthorization);
log(`[auto] [${d}] challengeCreateFn success`);
log(`[auto] [${d}] add challengeRemoveFn()`);
clearTasks.push(async () => {
/* Trigger challengeRemoveFn(), suppress errors */
log(`[auto] [${d}] Trigger challengeRemoveFn()`);
try {
await opts.challengeRemoveFn(authz, challenge, keyAuthorization, recordItem);
}
catch (e) {
log(`[auto] [${d}] challengeRemoveFn threw error: ${e.message}`);
}
});
// throw new Error('测试异常');
/* Challenge verification */
if (opts.skipChallengeVerification === true) {
log(`[auto] [${d}] Skipping challenge verification since skipChallengeVerification=truewait 60s`);
await wait(60 * 1000);
}
else {
log(`[auto] [${d}] Running challenge verification`);
try {
await client.verifyChallenge(authz, challenge);
}
catch (e) {
log(`[auto] [${d}] challenge verification threw error: ${e.message}`);
}
}
/* Complete challenge and wait for valid status */
log(`[auto] [${d}] Completing challenge with ACME provider and waiting for valid status`);
await client.completeChallenge(challenge);
challengeCompleted = true;
await client.waitForValidStatus(challenge);
}
catch (e) {
log(`[auto] [${d}] challengeCreateFn threw error: ${e.message}`);
throw e;
}
}
catch (e) {
/* Deactivate pending authz when unable to complete challenge */
if (!challengeCompleted) {
log(`[auto] [${d}] Unable to complete challenge: ${e.message}`);
try {
log(`[auto] [${d}] Deactivating failed authorization`);
await client.deactivateAuthorization(authz);
}
catch (f) {
/* Suppress deactivateAuthorization() errors */
log(`[auto] [${d}] Authorization deactivation threw error: ${f.message}`);
}
}
throw e;
}
};
const domainSets = [];
authorizations.forEach((authz) => {
const d = authz.identifier.value;
let setd = false;
// eslint-disable-next-line no-restricted-syntax
for (const group of domainSets) {
if (!group[d]) {
group[d] = authz;
setd = true;
}
}
if (!setd) {
const group = {};
group[d] = authz;
domainSets.push(group);
}
});
const allChallengePromises = [];
// eslint-disable-next-line no-restricted-syntax
for (const domainSet of domainSets) {
const challengePromises = [];
// eslint-disable-next-line guard-for-in,no-restricted-syntax
for (const domain in domainSet) {
const authz = domainSet[domain];
challengePromises.push(async () => {
log(`[auto] [${domain}] Starting challenge`);
await challengeFunc(authz);
});
}
allChallengePromises.push(challengePromises);
}
log(`[auto] challengeGroups:${allChallengePromises.length}`);
function runAllPromise(tasks) {
let promise = Promise.resolve();
tasks.forEach((task) => {
promise = promise.then(task);
});
return promise;
}
async function runPromisePa(tasks) {
const results = [];
// eslint-disable-next-line no-await-in-loop,no-restricted-syntax
for (const task of tasks) {
results.push(task());
// eslint-disable-next-line no-await-in-loop
await wait(10000);
}
return Promise.all(results);
}
log(`开始challenge${allChallengePromises.length}`);
let i = 0;
// eslint-disable-next-line no-restricted-syntax
for (const challengePromises of allChallengePromises) {
i += 1;
log(`开始第${i}`);
if (opts.signal && opts.signal.aborted) {
throw new Error('用户取消');
}
try {
// eslint-disable-next-line no-await-in-loop
await runPromisePa(challengePromises);
}
catch (e) {
log(`证书申请失败${e.message}`);
throw e;
}
finally {
log(`清理challenge痕迹length:${clearTasks.length}`);
try {
// eslint-disable-next-line no-await-in-loop
await runAllPromise(clearTasks);
}
catch (e) {
log('清理challenge失败');
log(e);
}
}
}
log('challenge结束');
// log('[auto] Waiting for challenge valid status');
// await Promise.all(challengePromises);
/**
* Finalize order and download certificate
*/
log('[auto] Finalizing order and downloading certificate');
const finalized = await client.finalizeOrder(order, opts.csr);
const res = await client.getCertificate(finalized, opts.preferredChain);
return res;
// try {
// await Promise.allSettled(challengePromises);
// }
// finally {
// log('清理challenge');
// await Promise.allSettled(clearTasks);
// }
};

View File

@@ -0,0 +1,126 @@
/**
* Axios instance
*/
const axios = require('axios');
const { parseRetryAfterHeader } = require('./util');
const { log } = require('./logger');
const pkg = require('./../package.json');
const { AxiosError } = axios;
/**
* Defaults
*/
const instance = axios.create();
/* Default User-Agent */
instance.defaults.headers.common['User-Agent'] = `node-${pkg.name}/${pkg.version}`;
/* Default ACME settings */
instance.defaults.acmeSettings = {
httpChallengePort: 80,
httpsChallengePort: 443,
tlsAlpnChallengePort: 443,
retryMaxAttempts: 5,
retryDefaultDelay: 5,
};
// instance.defaults.proxy = {
// host: '192.168.34.139',
// port: 10811
// };
/**
* Explicitly set Node as default HTTP adapter
*
* https://github.com/axios/axios/issues/1180
* https://stackoverflow.com/questions/42677387
*/
instance.defaults.adapter = 'http';
/**
* Retry requests on server errors or when rate limited
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-6.6
*/
function isRetryableError(error) {
return (error.code !== 'ECONNABORTED')
&& (error.code !== 'ERR_NOCK_NO_MATCH')
&& (!error.response
|| (error.response.status === 429)
|| ((error.response.status >= 500) && (error.response.status <= 599)));
}
/* https://github.com/axios/axios/blob/main/lib/core/settle.js */
function validateStatus(response) {
const validator = response.config.retryValidateStatus;
if (!response.status || !validator || validator(response.status)) {
return response;
}
throw new AxiosError(
`Request failed with status code ${response.status}`,
(Math.floor(response.status / 100) === 4) ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
response.config,
response.request,
response,
);
}
/* Pass all responses through the error interceptor */
instance.interceptors.request.use((config) => {
if (!('retryValidateStatus' in config)) {
config.retryValidateStatus = config.validateStatus;
}
config.validateStatus = () => false;
return config;
});
/* Handle request retries if applicable */
instance.interceptors.response.use(null, async (error) => {
const { config, response } = error;
if (!config) {
return Promise.reject(error);
}
/* Pick up errors we want to retry */
if (isRetryableError(error)) {
const { retryMaxAttempts, retryDefaultDelay } = instance.defaults.acmeSettings;
config.retryAttempt = ('retryAttempt' in config) ? (config.retryAttempt + 1) : 1;
if (config.retryAttempt <= retryMaxAttempts) {
const code = response ? `HTTP ${response.status}` : error.code;
log(`Caught ${code}, retry attempt ${config.retryAttempt}/${retryMaxAttempts} to URL ${config.url}`);
/* Attempt to parse Retry-After header, fallback to default delay */
let retryAfter = response ? parseRetryAfterHeader(response.headers['retry-after']) : 0;
if (retryAfter > 0) {
log(`Found retry-after response header with value: ${response.headers['retry-after']}, waiting ${retryAfter} seconds`);
}
else {
retryAfter = (retryDefaultDelay * config.retryAttempt);
log(`Unable to locate or parse retry-after response header, waiting ${retryAfter} seconds`);
}
/* Wait and retry the request */
await new Promise((resolve) => { setTimeout(resolve, (retryAfter * 1000)); });
return instance(config);
}
}
/* Validate and return response */
return validateStatus(response);
});
/**
* Export instance
*/
module.exports = instance;

View File

@@ -0,0 +1,719 @@
/**
* ACME client
*
* @namespace Client
*/
const { createHash } = require('crypto');
const { getPemBodyAsB64u } = require('./crypto');
const { log } = require('./logger');
const HttpClient = require('./http');
const AcmeApi = require('./api');
const verify = require('./verify');
const util = require('./util');
const auto = require('./auto');
/**
* ACME states
*
* @private
*/
const validStates = ['ready', 'valid'];
const pendingStates = ['pending', 'processing'];
const invalidStates = ['invalid'];
/**
* Default options
*
* @private
*/
const defaultOpts = {
directoryUrl: undefined,
accountKey: undefined,
accountUrl: null,
externalAccountBinding: {},
backoffAttempts: 10,
backoffMin: 5000,
backoffMax: 30000,
};
/**
* AcmeClient
*
* @class
* @param {object} opts
* @param {string} opts.directoryUrl ACME directory URL
* @param {buffer|string} opts.accountKey PEM encoded account private key
* @param {string} [opts.accountUrl] Account URL, default: `null`
* @param {object} [opts.externalAccountBinding]
* @param {string} [opts.externalAccountBinding.kid] External account binding KID
* @param {string} [opts.externalAccountBinding.hmacKey] External account binding HMAC key
* @param {number} [opts.backoffAttempts] Maximum number of backoff attempts, default: `10`
* @param {number} [opts.backoffMin] Minimum backoff attempt delay in milliseconds, default: `5000`
* @param {number} [opts.backoffMax] Maximum backoff attempt delay in milliseconds, default: `30000`
*
* @example Create ACME client instance
* ```js
* const client = new acme.Client({
* directoryUrl: acme.directory.letsencrypt.staging,
* accountKey: 'Private key goes here',
* });
* ```
*
* @example Create ACME client instance
* ```js
* const client = new acme.Client({
* directoryUrl: acme.directory.letsencrypt.staging,
* accountKey: 'Private key goes here',
* accountUrl: 'Optional account URL goes here',
* backoffAttempts: 10,
* backoffMin: 5000,
* backoffMax: 30000,
* });
* ```
*
* @example Create ACME client with external account binding
* ```js
* const client = new acme.Client({
* directoryUrl: 'https://acme-provider.example.com/directory-url',
* accountKey: 'Private key goes here',
* externalAccountBinding: {
* kid: 'YOUR-EAB-KID',
* hmacKey: 'YOUR-EAB-HMAC-KEY',
* },
* });
* ```
*/
class AcmeClient {
constructor(opts) {
if (!Buffer.isBuffer(opts.accountKey)) {
opts.accountKey = Buffer.from(opts.accountKey);
}
this.opts = { ...defaultOpts, ...opts };
this.backoffOpts = {
attempts: this.opts.backoffAttempts,
min: this.opts.backoffMin,
max: this.opts.backoffMax,
};
this.http = new HttpClient(this.opts.directoryUrl, this.opts.accountKey, this.opts.externalAccountBinding, this.opts.urlMapping);
this.api = new AcmeApi(this.http, this.opts.accountUrl);
}
/**
* Get Terms of Service URL if available
*
* @returns {Promise<string|null>} ToS URL
*
* @example Get Terms of Service URL
* ```js
* const termsOfService = client.getTermsOfServiceUrl();
*
* if (!termsOfService) {
* // CA did not provide Terms of Service
* }
* ```
*/
getTermsOfServiceUrl() {
return this.api.getTermsOfServiceUrl();
}
/**
* Get current account URL
*
* @returns {string} Account URL
* @throws {Error} No account URL found
*
* @example Get current account URL
* ```js
* try {
* const accountUrl = client.getAccountUrl();
* }
* catch (e) {
* // No account URL exists, need to create account first
* }
* ```
*/
getAccountUrl() {
return this.api.getAccountUrl();
}
/**
* Create a new account
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.3
*
* @param {object} [data] Request data
* @returns {Promise<object>} Account
*
* @example Create a new account
* ```js
* const account = await client.createAccount({
* termsOfServiceAgreed: true,
* });
* ```
*
* @example Create a new account with contact info
* ```js
* const account = await client.createAccount({
* termsOfServiceAgreed: true,
* contact: ['mailto:test@example.com'],
* });
* ```
*/
async createAccount(data = {}) {
try {
this.getAccountUrl();
/* Account URL exists */
log('Account URL exists, returning updateAccount()');
return this.updateAccount(data);
}
catch (e) {
const resp = await this.api.createAccount(data);
/* HTTP 200: Account exists */
if (resp.status === 200) {
log('Account already exists (HTTP 200), returning updateAccount()');
return this.updateAccount(data);
}
return resp.data;
}
}
/**
* Update existing account
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.2
*
* @param {object} [data] Request data
* @returns {Promise<object>} Account
*
* @example Update existing account
* ```js
* const account = await client.updateAccount({
* contact: ['mailto:foo@example.com'],
* });
* ```
*/
async updateAccount(data = {}) {
try {
this.api.getAccountUrl();
}
catch (e) {
log('No account URL found, returning createAccount()');
return this.createAccount(data);
}
/* Remove data only applicable to createAccount() */
if ('onlyReturnExisting' in data) {
delete data.onlyReturnExisting;
}
/* POST-as-GET */
if (Object.keys(data).length === 0) {
data = null;
}
const resp = await this.api.updateAccount(data);
return resp.data;
}
/**
* Update account private key
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.3.5
*
* @param {buffer|string} newAccountKey New PEM encoded private key
* @param {object} [data] Additional request data
* @returns {Promise<object>} Account
*
* @example Update account private key
* ```js
* const newAccountKey = 'New private key goes here';
* const result = await client.updateAccountKey(newAccountKey);
* ```
*/
async updateAccountKey(newAccountKey, data = {}) {
if (!Buffer.isBuffer(newAccountKey)) {
newAccountKey = Buffer.from(newAccountKey);
}
const accountUrl = this.api.getAccountUrl();
/* Create new HTTP and API clients using new key */
const newHttpClient = new HttpClient(this.opts.directoryUrl, newAccountKey, this.opts.externalAccountBinding);
const newApiClient = new AcmeApi(newHttpClient, accountUrl);
/* Get old JWK */
data.account = accountUrl;
data.oldKey = this.http.getJwk();
/* Get signed request body from new client */
const url = await newHttpClient.getResourceUrl('keyChange');
const body = newHttpClient.createSignedBody(url, data);
/* Change key using old client */
const resp = await this.api.updateAccountKey(body);
/* Replace existing HTTP and API client */
this.http = newHttpClient;
this.api = newApiClient;
return resp.data;
}
/**
* Create a new order
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
*
* @param {object} data Request data
* @returns {Promise<object>} Order
*
* @example Create a new order
* ```js
* const order = await client.createOrder({
* identifiers: [
* { type: 'dns', value: 'example.com' },
* { type: 'dns', value: 'test.example.com' },
* ],
* });
* ```
*/
async createOrder(data) {
const resp = await this.api.createOrder(data);
if (!resp.headers.location) {
throw new Error('Creating a new order did not return an order link');
}
/* Add URL to response */
resp.data.url = this.api.getLocationFromHeader(resp);
return resp.data;
}
/**
* Refresh order object from CA
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
*
* @param {object} order Order object
* @returns {Promise<object>} Order
*
* @example
* ```js
* const order = { ... }; // Previously created order object
* const result = await client.getOrder(order);
* ```
*/
async getOrder(order) {
if (!order.url) {
throw new Error('Unable to get order, URL not found');
}
const resp = await this.api.getOrder(order.url);
/* Add URL to response */
resp.data.url = order.url;
return resp.data;
}
/**
* Finalize order
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
*
* @param {object} order Order object
* @param {buffer|string} csr PEM encoded Certificate Signing Request
* @returns {Promise<object>} Order
*
* @example Finalize order
* ```js
* const order = { ... }; // Previously created order object
* const csr = { ... }; // Previously created Certificate Signing Request
* const result = await client.finalizeOrder(order, csr);
* ```
*/
async finalizeOrder(order, csr) {
if (!order.finalize) {
throw new Error('Unable to finalize order, URL not found');
}
if (!Buffer.isBuffer(csr)) {
csr = Buffer.from(csr);
}
const data = { csr: getPemBodyAsB64u(csr) };
const resp = await this.api.finalizeOrder(order.finalize, data);
/* Add URL to response */
resp.data.url = order.url;
return resp.data;
}
/**
* Get identifier authorizations from order
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.5
*
* @param {object} order Order
* @returns {Promise<object[]>} Authorizations
*
* @example Get identifier authorizations
* ```js
* const order = { ... }; // Previously created order object
* const authorizations = await client.getAuthorizations(order);
*
* authorizations.forEach((authz) => {
* const { challenges } = authz;
* });
* ```
*/
async getAuthorizations(order) {
return Promise.all((order.authorizations || []).map(async (url) => {
const resp = await this.api.getAuthorization(url);
/* Add URL to response */
resp.data.url = url;
return resp.data;
}));
}
/**
* Deactivate identifier authorization
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.2
*
* @param {object} authz Identifier authorization
* @returns {Promise<object>} Authorization
*
* @example Deactivate identifier authorization
* ```js
* const authz = { ... }; // Identifier authorization resolved from previously created order
* const result = await client.deactivateAuthorization(authz);
* ```
*/
async deactivateAuthorization(authz) {
if (!authz.url) {
throw new Error('Unable to deactivate identifier authorization, URL not found');
}
const data = { status: 'deactivated' };
const resp = await this.api.updateAuthorization(authz.url, data);
/* Add URL to response */
resp.data.url = authz.url;
return resp.data;
}
/**
* Get key authorization for ACME challenge
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-8.1
*
* @param {object} challenge Challenge object returned by API
* @returns {Promise<string>} Key authorization
*
* @example Get challenge key authorization
* ```js
* const challenge = { ... }; // Challenge from previously resolved identifier authorization
* const key = await client.getChallengeKeyAuthorization(challenge);
*
* // Write key somewhere to satisfy challenge
* ```
*/
async getChallengeKeyAuthorization(challenge) {
const jwk = this.http.getJwk();
const keysum = createHash('sha256').update(JSON.stringify(jwk));
const thumbprint = keysum.digest('base64url');
const result = `${challenge.token}.${thumbprint}`;
/* https://datatracker.ietf.org/doc/html/rfc8555#section-8.3 */
if (challenge.type === 'http-01') {
return result;
}
/* https://datatracker.ietf.org/doc/html/rfc8555#section-8.4 */
if (challenge.type === 'dns-01') {
return createHash('sha256').update(result).digest('base64url');
}
/* https://datatracker.ietf.org/doc/html/rfc8737 */
if (challenge.type === 'tls-alpn-01') {
return result;
}
throw new Error(`Unable to produce key authorization, unknown challenge type: ${challenge.type}`);
}
/**
* Verify that ACME challenge is satisfied
*
* @param {object} authz Identifier authorization
* @param {object} challenge Authorization challenge
* @returns {Promise}
*
* @example Verify satisfied ACME challenge
* ```js
* const authz = { ... }; // Identifier authorization
* const challenge = { ... }; // Satisfied challenge
* await client.verifyChallenge(authz, challenge);
* ```
*/
async verifyChallenge(authz, challenge) {
if (!authz.url || !challenge.url) {
throw new Error('Unable to verify ACME challenge, URL not found');
}
if (typeof verify[challenge.type] === 'undefined') {
throw new Error(`Unable to verify ACME challenge, unknown type: ${challenge.type}`);
}
const keyAuthorization = await this.getChallengeKeyAuthorization(challenge);
const verifyFn = async () => {
if (this.opts.signal && this.opts.signal.aborted) {
throw new Error('用户取消');
}
await verify[challenge.type](authz, challenge, keyAuthorization);
};
log('Waiting for ACME challenge verification', this.backoffOpts);
return util.retry(verifyFn, this.backoffOpts);
}
/**
* Notify CA that challenge has been completed
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.1
*
* @param {object} challenge Challenge object returned by API
* @returns {Promise<object>} Challenge
*
* @example Notify CA that challenge has been completed
* ```js
* const challenge = { ... }; // Satisfied challenge
* const result = await client.completeChallenge(challenge);
* ```
*/
async completeChallenge(challenge) {
if (this.opts.signal && this.opts.signal.aborted) {
throw new Error('用户取消');
}
const resp = await this.api.completeChallenge(challenge.url, {});
return resp.data;
}
/**
* Wait for ACME provider to verify status on a order, authorization or challenge
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.5.1
*
* @param {object} item An order, authorization or challenge object
* @returns {Promise<object>} Valid order, authorization or challenge
*
* @example Wait for valid challenge status
* ```js
* const challenge = { ... };
* await client.waitForValidStatus(challenge);
* ```
*
* @example Wait for valid authorization status
* ```js
* const authz = { ... };
* await client.waitForValidStatus(authz);
* ```
*
* @example Wait for valid order status
* ```js
* const order = { ... };
* await client.waitForValidStatus(order);
* ```
*/
async waitForValidStatus(item) {
if (!item.url) {
throw new Error('Unable to verify status of item, URL not found');
}
const verifyFn = async (abort) => {
if (this.opts.signal && this.opts.signal.aborted) {
throw new Error('用户取消');
}
const resp = await this.api.apiRequest(item.url, null, [200]);
/* Verify status */
log(`Item has status: ${resp.data.status}`);
if (invalidStates.includes(resp.data.status)) {
abort();
throw new Error(util.formatResponseError(resp));
}
else if (pendingStates.includes(resp.data.status)) {
throw new Error('Operation is pending or processing');
}
else if (validStates.includes(resp.data.status)) {
return resp.data;
}
throw new Error(`Unexpected item status: ${resp.data.status}`);
};
log(`Waiting for valid status from: ${item.url}`, this.backoffOpts);
return util.retry(verifyFn, this.backoffOpts);
}
/**
* Get certificate from ACME order
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4.2
*
* @param {object} order Order object
* @param {string} [preferredChain] Indicate which certificate chain is preferred if a CA offers multiple, by exact issuer common name, default: `null`
* @returns {Promise<string>} Certificate
*
* @example Get certificate
* ```js
* const order = { ... }; // Previously created order
* const certificate = await client.getCertificate(order);
* ```
*
* @example Get certificate with preferred chain
* ```js
* const order = { ... }; // Previously created order
* const certificate = await client.getCertificate(order, 'DST Root CA X3');
* ```
*/
async getCertificate(order, preferredChain = null) {
if (!validStates.includes(order.status)) {
order = await this.waitForValidStatus(order);
}
if (!order.certificate) {
throw new Error('Unable to download certificate, URL not found');
}
const resp = await this.api.apiRequest(order.certificate, null, [200]);
/* Handle alternate certificate chains */
if (preferredChain && resp.headers.link) {
const alternateLinks = util.parseLinkHeader(resp.headers.link);
const alternates = await Promise.all(alternateLinks.map(async (link) => this.api.apiRequest(link, null, [200])));
const certificates = [resp].concat(alternates).map((c) => c.data);
return util.findCertificateChainForIssuer(certificates, preferredChain);
}
/* Return default certificate chain */
return resp.data;
}
/**
* Revoke certificate
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.6
*
* @param {buffer|string} cert PEM encoded certificate
* @param {object} [data] Additional request data
* @returns {Promise}
*
* @example Revoke certificate
* ```js
* const certificate = { ... }; // Previously created certificate
* const result = await client.revokeCertificate(certificate);
* ```
*
* @example Revoke certificate with reason
* ```js
* const certificate = { ... }; // Previously created certificate
* const result = await client.revokeCertificate(certificate, {
* reason: 4,
* });
* ```
*/
async revokeCertificate(cert, data = {}) {
data.certificate = getPemBodyAsB64u(cert);
const resp = await this.api.revokeCert(data);
return resp.data;
}
/**
* Auto mode
*
* @param {object} opts
* @param {buffer|string} opts.csr Certificate Signing Request
* @param {function} opts.challengeCreateFn Function returning Promise triggered before completing ACME challenge
* @param {function} opts.challengeRemoveFn Function returning Promise triggered after completing ACME challenge
* @param {string} [opts.email] Account email address
* @param {boolean} [opts.termsOfServiceAgreed] Agree to Terms of Service, default: `false`
* @param {boolean} [opts.skipChallengeVerification] Skip internal challenge verification before notifying ACME provider, default: `false`
* @param {string[]} [opts.challengePriority] Array defining challenge type priority, default: `['http-01', 'dns-01']`
* @param {string} [opts.preferredChain] Indicate which certificate chain is preferred if a CA offers multiple, by exact issuer common name, default: `null`
* @returns {Promise<string>} Certificate
*
* @example Order a certificate using auto mode
* ```js
* const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
* altNames: ['test.example.com'],
* });
*
* const certificate = await client.auto({
* csr: certificateRequest,
* email: 'test@example.com',
* termsOfServiceAgreed: true,
* challengeCreateFn: async (authz, challenge, keyAuthorization) => {
* // Satisfy challenge here
* },
* challengeRemoveFn: async (authz, challenge, keyAuthorization) => {
* // Clean up challenge here
* },
* });
* ```
*
* @example Order a certificate using auto mode with preferred chain
* ```js
* const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
* altNames: ['test.example.com'],
* });
*
* const certificate = await client.auto({
* csr: certificateRequest,
* email: 'test@example.com',
* termsOfServiceAgreed: true,
* preferredChain: 'DST Root CA X3',
* challengeCreateFn: async () => {},
* challengeRemoveFn: async () => {},
* });
* ```
*/
auto(opts) {
return auto(this, opts);
}
}
/* Export client */
module.exports = AcmeClient;

View File

@@ -0,0 +1,442 @@
/**
* Legacy node-forge crypto interface
*
* DEPRECATION WARNING: This crypto interface is deprecated and will be removed from acme-client in a future
* major release. Please migrate to the new `acme.crypto` interface at your earliest convenience.
*
* @namespace forge
*/
const net = require('net');
const { promisify } = require('util');
const forge = require('node-forge');
const { createPrivateEcdsaKey, getPublicKey } = require('./index');
const generateKeyPair = promisify(forge.pki.rsa.generateKeyPair);
/**
* Attempt to parse forge object from PEM encoded string
*
* @private
* @param {string} input PEM string
* @return {object}
*/
function forgeObjectFromPem(input) {
const msg = forge.pem.decode(input)[0];
let result;
switch (msg.type) {
case 'PRIVATE KEY':
case 'RSA PRIVATE KEY':
result = forge.pki.privateKeyFromPem(input);
break;
case 'PUBLIC KEY':
case 'RSA PUBLIC KEY':
result = forge.pki.publicKeyFromPem(input);
break;
case 'CERTIFICATE':
case 'X509 CERTIFICATE':
case 'TRUSTED CERTIFICATE':
result = forge.pki.certificateFromPem(input).publicKey;
break;
case 'CERTIFICATE REQUEST':
result = forge.pki.certificationRequestFromPem(input).publicKey;
break;
default:
throw new Error('Unable to detect forge message type');
}
return result;
}
/**
* Parse domain names from a certificate or CSR
*
* @private
* @param {object} obj Forge certificate or CSR
* @returns {object} {commonName, altNames}
*/
function parseDomains(obj) {
let commonName = null;
let altNames = [];
let altNamesDict = [];
const commonNameObject = (obj.subject.attributes || []).find((a) => a.name === 'commonName');
const rootAltNames = (obj.extensions || []).find((e) => 'altNames' in e);
const rootExtensions = (obj.attributes || []).find((a) => 'extensions' in a);
if (rootAltNames && rootAltNames.altNames && rootAltNames.altNames.length) {
altNamesDict = rootAltNames.altNames;
}
else if (rootExtensions && rootExtensions.extensions && rootExtensions.extensions.length) {
const extAltNames = rootExtensions.extensions.find((e) => 'altNames' in e);
if (extAltNames && extAltNames.altNames && extAltNames.altNames.length) {
altNamesDict = extAltNames.altNames;
}
}
if (commonNameObject) {
commonName = commonNameObject.value;
}
if (altNamesDict) {
altNames = altNamesDict.map((a) => a.value);
}
return {
commonName,
altNames,
};
}
/**
* Generate a private RSA key
*
* @param {number} [size] Size of the key, default: `2048`
* @returns {Promise<buffer>} PEM encoded private RSA key
*
* @example Generate private RSA key
* ```js
* const privateKey = await acme.forge.createPrivateKey();
* ```
*
* @example Private RSA key with defined size
* ```js
* const privateKey = await acme.forge.createPrivateKey(4096);
* ```
*/
async function createPrivateKey(size = 2048) {
const keyPair = await generateKeyPair({ bits: size });
const pemKey = forge.pki.privateKeyToPem(keyPair.privateKey);
return Buffer.from(pemKey);
}
exports.createPrivateKey = createPrivateKey;
/**
* Create public key from a private RSA key
*
* @param {buffer|string} key PEM encoded private RSA key
* @returns {Promise<buffer>} PEM encoded public RSA key
*
* @example Create public key
* ```js
* const publicKey = await acme.forge.createPublicKey(privateKey);
* ```
*/
exports.createPublicKey = async (key) => {
const privateKey = forge.pki.privateKeyFromPem(key);
const publicKey = forge.pki.rsa.setPublicKey(privateKey.n, privateKey.e);
const pemKey = forge.pki.publicKeyToPem(publicKey);
return Buffer.from(pemKey);
};
/**
* Parse body of PEM encoded object from buffer or string
* If multiple objects are chained, the first body will be returned
*
* @param {buffer|string} str PEM encoded buffer or string
* @returns {string} PEM body
*/
exports.getPemBody = (str) => {
const msg = forge.pem.decode(str)[0];
return forge.util.encode64(msg.body);
};
/**
* Split chain of PEM encoded objects from buffer or string into array
*
* @param {buffer|string} str PEM encoded buffer or string
* @returns {string[]} Array of PEM bodies
*/
exports.splitPemChain = (str) => forge.pem.decode(str).map(forge.pem.encode);
/**
* Get modulus
*
* @param {buffer|string} input PEM encoded private key, certificate or CSR
* @returns {Promise<buffer>} Modulus
*
* @example Get modulus
* ```js
* const m1 = await acme.forge.getModulus(privateKey);
* const m2 = await acme.forge.getModulus(certificate);
* const m3 = await acme.forge.getModulus(certificateRequest);
* ```
*/
exports.getModulus = async (input) => {
if (!Buffer.isBuffer(input)) {
input = Buffer.from(input);
}
const obj = forgeObjectFromPem(input);
return Buffer.from(forge.util.hexToBytes(obj.n.toString(16)), 'binary');
};
/**
* Get public exponent
*
* @param {buffer|string} input PEM encoded private key, certificate or CSR
* @returns {Promise<buffer>} Exponent
*
* @example Get public exponent
* ```js
* const e1 = await acme.forge.getPublicExponent(privateKey);
* const e2 = await acme.forge.getPublicExponent(certificate);
* const e3 = await acme.forge.getPublicExponent(certificateRequest);
* ```
*/
exports.getPublicExponent = async (input) => {
if (!Buffer.isBuffer(input)) {
input = Buffer.from(input);
}
const obj = forgeObjectFromPem(input);
return Buffer.from(forge.util.hexToBytes(obj.e.toString(16)), 'binary');
};
/**
* Read domains from a Certificate Signing Request
*
* @param {buffer|string} csr PEM encoded Certificate Signing Request
* @returns {Promise<object>} {commonName, altNames}
*
* @example Read Certificate Signing Request domains
* ```js
* const { commonName, altNames } = await acme.forge.readCsrDomains(certificateRequest);
*
* console.log(`Common name: ${commonName}`);
* console.log(`Alt names: ${altNames.join(', ')}`);
* ```
*/
exports.readCsrDomains = async (csr) => {
if (!Buffer.isBuffer(csr)) {
csr = Buffer.from(csr);
}
const obj = forge.pki.certificationRequestFromPem(csr);
return parseDomains(obj);
};
/**
* Read information from a certificate
*
* @param {buffer|string} cert PEM encoded certificate
* @returns {Promise<object>} Certificate info
*
* @example Read certificate information
* ```js
* const info = await acme.forge.readCertificateInfo(certificate);
* const { commonName, altNames } = info.domains;
*
* console.log(`Not after: ${info.notAfter}`);
* console.log(`Not before: ${info.notBefore}`);
*
* console.log(`Common name: ${commonName}`);
* console.log(`Alt names: ${altNames.join(', ')}`);
* ```
*/
exports.readCertificateInfo = async (cert) => {
if (!Buffer.isBuffer(cert)) {
cert = Buffer.from(cert);
}
const obj = forge.pki.certificateFromPem(cert);
const issuerCn = (obj.issuer.attributes || []).find((a) => a.name === 'commonName');
return {
issuer: {
commonName: issuerCn ? issuerCn.value : null,
},
domains: parseDomains(obj),
notAfter: obj.validity.notAfter,
notBefore: obj.validity.notBefore,
};
};
/**
* Determine ASN.1 type for CSR subject short name
* Note: https://datatracker.ietf.org/doc/html/rfc5280
*
* @private
* @param {string} shortName CSR subject short name
* @returns {forge.asn1.Type} ASN.1 type
*/
function getCsrValueTagClass(shortName) {
switch (shortName) {
case 'C':
return forge.asn1.Type.PRINTABLESTRING;
case 'E':
return forge.asn1.Type.IA5STRING;
default:
return forge.asn1.Type.UTF8;
}
}
/**
* Create array of short names and values for Certificate Signing Request subjects
*
* @private
* @param {object} subjectObj Key-value of short names and values
* @returns {object[]} Certificate Signing Request subject array
*/
function createCsrSubject(subjectObj) {
return Object.entries(subjectObj).reduce((result, [shortName, value]) => {
if (value) {
const valueTagClass = getCsrValueTagClass(shortName);
result.push({ shortName, value, valueTagClass });
}
return result;
}, []);
}
/**
* Create array of alt names for Certificate Signing Requests
* Note: https://github.com/digitalbazaar/forge/blob/dfdde475677a8a25c851e33e8f81dca60d90cfb9/lib/x509.js#L1444-L1454
*
* @private
* @param {string[]} altNames Alt names
* @returns {object[]} Certificate Signing Request alt names array
*/
function formatCsrAltNames(altNames) {
return altNames.map((value) => {
const type = net.isIP(value) ? 7 : 2;
return { type, value };
});
}
/**
* Create a Certificate Signing Request
*
* @param {object} data
* @param {number} [data.keySize] Size of newly created private key, default: `2048`
* @param {string} [data.commonName]
* @param {string[]} [data.altNames] default: `[]`
* @param {string} [data.country]
* @param {string} [data.state]
* @param {string} [data.locality]
* @param {string} [data.organization]
* @param {string} [data.organizationUnit]
* @param {string} [data.emailAddress]
* @param {buffer|string} [key] CSR private key
* @returns {Promise<buffer[]>} [privateKey, certificateSigningRequest]
*
* @example Create a Certificate Signing Request
* ```js
* const [certificateKey, certificateRequest] = await acme.forge.createCsr({
* altNames: ['test.example.com'],
* });
* ```
*
* @example Certificate Signing Request with both common and alternative names
* > *Warning*: Certificate subject common name has been [deprecated](https://letsencrypt.org/docs/glossary/#def-CN) and its use is [discouraged](https://cabforum.org/uploads/BRv1.2.3.pdf).
* ```js
* const [certificateKey, certificateRequest] = await acme.forge.createCsr({
* keySize: 4096,
* commonName: 'test.example.com',
* altNames: ['foo.example.com', 'bar.example.com'],
* });
* ```
*
* @example Certificate Signing Request with additional information
* ```js
* const [certificateKey, certificateRequest] = await acme.forge.createCsr({
* altNames: ['test.example.com'],
* country: 'US',
* state: 'California',
* locality: 'Los Angeles',
* organization: 'The Company Inc.',
* organizationUnit: 'IT Department',
* emailAddress: 'contact@example.com',
* });
* ```
*
* @example Certificate Signing Request with predefined private key
* ```js
* const certificateKey = await acme.forge.createPrivateKey();
*
* const [, certificateRequest] = await acme.forge.createCsr({
* altNames: ['test.example.com'],
* }, certificateKey);
*/
exports.createCsr = async (data, keyType = null) => {
let key = null;
if (keyType === 'ec') {
key = await createPrivateEcdsaKey();
}
else {
key = await createPrivateKey(data.keySize);
}
// else if (!Buffer.isBuffer(key)) {
// key = Buffer.from(key);
// }
if (typeof data.altNames === 'undefined') {
data.altNames = [];
}
const csr = forge.pki.createCertificationRequest();
/* Public key */
const privateKey = forge.pki.privateKeyFromPem(key);
const publicKey = forge.pki.rsa.setPublicKey(privateKey.n, privateKey.e);
csr.publicKey = publicKey;
// const privateKey = key;
// csr.publicKey = getPublicKey(key);
/* Ensure subject common name is present in SAN - https://cabforum.org/wp-content/uploads/BRv1.2.3.pdf */
if (data.commonName && !data.altNames.includes(data.commonName)) {
data.altNames.unshift(data.commonName);
}
/* Subject */
const subject = createCsrSubject({
CN: data.commonName,
C: data.country,
ST: data.state,
L: data.locality,
O: data.organization,
OU: data.organizationUnit,
E: data.emailAddress,
});
csr.setSubject(subject);
/* SAN extension */
if (data.altNames.length) {
csr.setAttributes([{
name: 'extensionRequest',
extensions: [{
name: 'subjectAltName',
altNames: formatCsrAltNames(data.altNames),
}],
}]);
}
/* Sign CSR using SHA-256 */
csr.sign(privateKey, forge.md.sha256.create());
/* Done */
const pemCsr = forge.pki.certificationRequestToPem(csr);
return [key, Buffer.from(pemCsr)];
};

View File

@@ -0,0 +1,603 @@
/**
* Native Node.js crypto interface
*
* @namespace crypto
*/
const net = require('net');
const { promisify } = require('util');
const crypto = require('crypto');
const asn1js = require('asn1js');
const x509 = require('@peculiar/x509');
const randomInt = promisify(crypto.randomInt);
const generateKeyPair = promisify(crypto.generateKeyPair);
/* Use Node.js Web Crypto API */
x509.cryptoProvider.set(crypto.webcrypto);
/* id-ce-subjectAltName - https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.6 */
const subjectAltNameOID = '2.5.29.17';
/* id-pe-acmeIdentifier - https://datatracker.ietf.org/doc/html/rfc8737#section-6.1 */
const alpnAcmeIdentifierOID = '1.3.6.1.5.5.7.1.31';
/**
* Determine key type and info by attempting to derive public key
*
* @private
* @param {buffer|string} keyPem PEM encoded private or public key
* @returns {object}
*/
function getKeyInfo(keyPem) {
const result = {
isRSA: false,
isECDSA: false,
publicKey: crypto.createPublicKey(keyPem),
};
if (result.publicKey.asymmetricKeyType === 'rsa') {
result.isRSA = true;
}
else if (result.publicKey.asymmetricKeyType === 'ec') {
result.isECDSA = true;
}
else {
throw new Error('Unable to parse key information, unknown format');
}
return result;
}
/**
* Generate a private RSA key
*
* @param {number} [modulusLength] Size of the keys modulus in bits, default: `2048`
* @returns {Promise<buffer>} PEM encoded private RSA key
*
* @example Generate private RSA key
* ```js
* const privateKey = await acme.crypto.createPrivateRsaKey();
* ```
*
* @example Private RSA key with modulus size 4096
* ```js
* const privateKey = await acme.crypto.createPrivateRsaKey(4096);
* ```
*/
async function createPrivateRsaKey(modulusLength = 2048, encodingType = 'pkcs8') {
const pair = await generateKeyPair('rsa', {
modulusLength,
privateKeyEncoding: {
type: encodingType,
format: 'pem',
},
});
return Buffer.from(pair.privateKey);
}
exports.createPrivateRsaKey = createPrivateRsaKey;
/**
* Alias of `createPrivateRsaKey()`
*
* @function
*/
exports.createPrivateKey = createPrivateRsaKey;
/**
* Generate a private ECDSA key
*
* @param {string} [namedCurve] ECDSA curve name (P-256, P-384 or P-521), default `P-256`
* @returns {Promise<buffer>} PEM encoded private ECDSA key
*
* @example Generate private ECDSA key
* ```js
* const privateKey = await acme.crypto.createPrivateEcdsaKey();
* ```
*
* @example Private ECDSA key using P-384 curve
* ```js
* const privateKey = await acme.crypto.createPrivateEcdsaKey('P-384');
* ```
*/
exports.createPrivateEcdsaKey = async (namedCurve = 'P-256', encodingType = 'pkcs8') => {
const pair = await generateKeyPair('ec', {
namedCurve,
privateKeyEncoding: {
type: encodingType,
format: 'pem',
},
});
return Buffer.from(pair.privateKey);
};
/**
* Get a public key derived from a RSA or ECDSA key
*
* @param {buffer|string} keyPem PEM encoded private or public key
* @returns {buffer} PEM encoded public key
*
* @example Get public key
* ```js
* const publicKey = acme.crypto.getPublicKey(privateKey);
* ```
*/
exports.getPublicKey = (keyPem) => {
const info = getKeyInfo(keyPem);
const publicKey = info.publicKey.export({
type: info.isECDSA ? 'spki' : 'pkcs1',
format: 'pem',
});
return Buffer.from(publicKey);
};
/**
* Get a JSON Web Key derived from a RSA or ECDSA key
*
* https://datatracker.ietf.org/doc/html/rfc7517
*
* @param {buffer|string} keyPem PEM encoded private or public key
* @returns {object} JSON Web Key
*
* @example Get JWK
* ```js
* const jwk = acme.crypto.getJwk(privateKey);
* ```
*/
function getJwk(keyPem) {
const jwk = crypto.createPublicKey(keyPem).export({
format: 'jwk',
});
/* Sort keys */
return Object.keys(jwk).sort().reduce((result, k) => {
result[k] = jwk[k];
return result;
}, {});
}
exports.getJwk = getJwk;
/**
* Produce CryptoKeyPair and signing algorithm from a PEM encoded private key
*
* @private
* @param {buffer|string} keyPem PEM encoded private key
* @returns {Promise<array>} [keyPair, signingAlgorithm]
*/
async function getWebCryptoKeyPair(keyPem) {
const info = getKeyInfo(keyPem);
const jwk = getJwk(keyPem);
/* Signing algorithm */
const sigalg = {
name: 'RSASSA-PKCS1-v1_5',
hash: { name: 'SHA-256' },
};
if (info.isECDSA) {
sigalg.name = 'ECDSA';
sigalg.namedCurve = jwk.crv;
if (jwk.crv === 'P-384') {
sigalg.hash.name = 'SHA-384';
}
if (jwk.crv === 'P-521') {
sigalg.hash.name = 'SHA-512';
}
}
/* Decode PEM and import into CryptoKeyPair */
const privateKeyDec = x509.PemConverter.decodeFirst(keyPem.toString());
const privateKey = await crypto.webcrypto.subtle.importKey('pkcs8', privateKeyDec, sigalg, true, ['sign']);
const publicKey = await crypto.webcrypto.subtle.importKey('jwk', jwk, sigalg, true, ['verify']);
return [{ privateKey, publicKey }, sigalg];
}
/**
* Split chain of PEM encoded objects from string into array
*
* @param {buffer|string} chainPem PEM encoded object chain
* @returns {string[]} Array of PEM objects including headers
*/
function splitPemChain(chainPem) {
if (Buffer.isBuffer(chainPem)) {
chainPem = chainPem.toString();
}
/* Decode into array and re-encode */
return x509.PemConverter.decodeWithHeaders(chainPem)
.map((params) => x509.PemConverter.encode([params]));
}
exports.splitPemChain = splitPemChain;
/**
* Parse body of PEM encoded object and return a Base64URL string
* If multiple objects are chained, the first body will be returned
*
* @param {buffer|string} pem PEM encoded chain or object
* @returns {string} Base64URL-encoded body
*/
exports.getPemBodyAsB64u = (pem) => {
const chain = splitPemChain(pem);
if (!chain.length) {
throw new Error('Unable to parse PEM body from string');
}
/* Select first object, extract body and convert to b64u */
const dec = x509.PemConverter.decodeFirst(chain[0]);
return Buffer.from(dec).toString('base64url');
};
/**
* Parse domains from a certificate or CSR
*
* @private
* @param {object} input x509.Certificate or x509.Pkcs10CertificateRequest
* @returns {object} {commonName, altNames}
*/
function parseDomains(input) {
const commonName = input.subjectName.getField('CN').pop() || null;
const altNamesRaw = input.getExtension(subjectAltNameOID);
let altNames = [];
if (altNamesRaw) {
const altNamesExt = new x509.SubjectAlternativeNameExtension(altNamesRaw.rawData);
altNames = altNames.concat(altNamesExt.names.items.map((i) => i.value));
}
return {
commonName,
altNames,
};
}
/**
* Read domains from a Certificate Signing Request
*
* @param {buffer|string} csrPem PEM encoded Certificate Signing Request
* @returns {object} {commonName, altNames}
*
* @example Read Certificate Signing Request domains
* ```js
* const { commonName, altNames } = acme.crypto.readCsrDomains(certificateRequest);
*
* console.log(`Common name: ${commonName}`);
* console.log(`Alt names: ${altNames.join(', ')}`);
* ```
*/
exports.readCsrDomains = (csrPem) => {
if (Buffer.isBuffer(csrPem)) {
csrPem = csrPem.toString();
}
const dec = x509.PemConverter.decodeFirst(csrPem);
const csr = new x509.Pkcs10CertificateRequest(dec);
return parseDomains(csr);
};
/**
* Read information from a certificate
* If multiple certificates are chained, the first will be read
*
* @param {buffer|string} certPem PEM encoded certificate or chain
* @returns {object} Certificate info
*
* @example Read certificate information
* ```js
* const info = acme.crypto.readCertificateInfo(certificate);
* const { commonName, altNames } = info.domains;
*
* console.log(`Not after: ${info.notAfter}`);
* console.log(`Not before: ${info.notBefore}`);
*
* console.log(`Common name: ${commonName}`);
* console.log(`Alt names: ${altNames.join(', ')}`);
* ```
*/
exports.readCertificateInfo = (certPem) => {
if (Buffer.isBuffer(certPem)) {
certPem = certPem.toString();
}
const dec = x509.PemConverter.decodeFirst(certPem);
const cert = new x509.X509Certificate(dec);
return {
issuer: {
commonName: cert.issuerName.getField('CN').pop() || null,
},
domains: parseDomains(cert),
notBefore: cert.notBefore,
notAfter: cert.notAfter,
};
};
/**
* Determine ASN.1 character string type for CSR subject field name
*
* https://datatracker.ietf.org/doc/html/rfc5280
* https://github.com/PeculiarVentures/x509/blob/ecf78224fd594abbc2fa83c41565d79874f88e00/src/name.ts#L65-L71
*
* @private
* @param {string} field CSR subject field name
* @returns {string} ASN.1 character string type
*/
function getCsrAsn1CharStringType(field) {
switch (field) {
case 'C':
return 'printableString';
case 'E':
return 'ia5String';
default:
return 'utf8String';
}
}
/**
* Create array of subject fields for a Certificate Signing Request
*
* https://github.com/PeculiarVentures/x509/blob/ecf78224fd594abbc2fa83c41565d79874f88e00/src/name.ts#L65-L71
*
* @private
* @param {object} input Key-value of subject fields
* @returns {object[]} Certificate Signing Request subject array
*/
function createCsrSubject(input) {
return Object.entries(input).reduce((result, [type, value]) => {
if (value) {
const ds = getCsrAsn1CharStringType(type);
result.push({ [type]: [{ [ds]: value }] });
}
return result;
}, []);
}
/**
* Create x509 subject alternate name extension
*
* https://github.com/PeculiarVentures/x509/blob/ecf78224fd594abbc2fa83c41565d79874f88e00/src/extensions/subject_alt_name.ts
*
* @private
* @param {string[]} altNames Array of alt names
* @returns {x509.SubjectAlternativeNameExtension} Subject alternate name extension
*/
function createSubjectAltNameExtension(altNames) {
return new x509.SubjectAlternativeNameExtension(altNames.map((value) => {
const type = net.isIP(value) ? 'ip' : 'dns';
return { type, value };
}));
}
/**
* Create a Certificate Signing Request
*
* @param {object} data
* @param {number} [data.keySize] Size of newly created RSA private key modulus in bits, default: `2048`
* @param {string} [data.commonName] FQDN of your server
* @param {string[]} [data.altNames] SAN (Subject Alternative Names), default: `[]`
* @param {string} [data.country] 2 letter country code
* @param {string} [data.state] State or province
* @param {string} [data.locality] City
* @param {string} [data.organization] Organization name
* @param {string} [data.organizationUnit] Organizational unit name
* @param {string} [data.emailAddress] Email address
* @param {buffer|string} [keyPem] PEM encoded CSR private key
* @returns {Promise<buffer[]>} [privateKey, certificateSigningRequest]
*
* @example Create a Certificate Signing Request
* ```js
* const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
* altNames: ['test.example.com'],
* });
* ```
*
* @example Certificate Signing Request with both common and alternative names
* > *Warning*: Certificate subject common name has been [deprecated](https://letsencrypt.org/docs/glossary/#def-CN) and its use is [discouraged](https://cabforum.org/uploads/BRv1.2.3.pdf).
* ```js
* const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
* keySize: 4096,
* commonName: 'test.example.com',
* altNames: ['foo.example.com', 'bar.example.com'],
* });
* ```
*
* @example Certificate Signing Request with additional information
* ```js
* const [certificateKey, certificateRequest] = await acme.crypto.createCsr({
* altNames: ['test.example.com'],
* country: 'US',
* state: 'California',
* locality: 'Los Angeles',
* organization: 'The Company Inc.',
* organizationUnit: 'IT Department',
* emailAddress: 'contact@example.com',
* });
* ```
*
* @example Certificate Signing Request with ECDSA private key
* ```js
* const certificateKey = await acme.crypto.createPrivateEcdsaKey();
*
* const [, certificateRequest] = await acme.crypto.createCsr({
* altNames: ['test.example.com'],
* }, certificateKey);
* ```
*/
exports.createCsr = async (data, keyPem = null) => {
if (!keyPem) {
keyPem = await createPrivateRsaKey(data.keySize);
}
else if (!Buffer.isBuffer(keyPem)) {
keyPem = Buffer.from(keyPem);
}
if (typeof data.altNames === 'undefined') {
data.altNames = [];
}
/* Ensure subject common name is present in SAN - https://cabforum.org/wp-content/uploads/BRv1.2.3.pdf */
if (data.commonName && !data.altNames.includes(data.commonName)) {
data.altNames.unshift(data.commonName);
}
/* CryptoKeyPair and signing algorithm from private key */
const [keys, signingAlgorithm] = await getWebCryptoKeyPair(keyPem);
const extensions = [
/* https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3 */
new x509.KeyUsagesExtension(x509.KeyUsageFlags.digitalSignature | x509.KeyUsageFlags.keyEncipherment), // eslint-disable-line no-bitwise
/* https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.6 */
createSubjectAltNameExtension(data.altNames),
];
/* Create CSR */
const csr = await x509.Pkcs10CertificateRequestGenerator.create({
keys,
extensions,
signingAlgorithm,
name: createCsrSubject({
CN: data.commonName,
C: data.country,
ST: data.state,
L: data.locality,
O: data.organization,
OU: data.organizationUnit,
E: data.emailAddress,
}),
});
/* Done */
const pem = csr.toString('pem');
return [keyPem, Buffer.from(pem)];
};
/**
* Create a self-signed ALPN certificate for TLS-ALPN-01 challenges
*
* https://datatracker.ietf.org/doc/html/rfc8737
*
* @param {object} authz Identifier authorization
* @param {string} keyAuthorization Challenge key authorization
* @param {buffer|string} [keyPem] PEM encoded CSR private key
* @returns {Promise<buffer[]>} [privateKey, certificate]
*
* @example Create a ALPN certificate
* ```js
* const [alpnKey, alpnCertificate] = await acme.crypto.createAlpnCertificate(authz, keyAuthorization);
* ```
*
* @example Create a ALPN certificate with ECDSA private key
* ```js
* const alpnKey = await acme.crypto.createPrivateEcdsaKey();
* const [, alpnCertificate] = await acme.crypto.createAlpnCertificate(authz, keyAuthorization, alpnKey);
* ```
*/
exports.createAlpnCertificate = async (authz, keyAuthorization, keyPem = null) => {
if (!keyPem) {
keyPem = await createPrivateRsaKey();
}
else if (!Buffer.isBuffer(keyPem)) {
keyPem = Buffer.from(keyPem);
}
const now = new Date();
const commonName = authz.identifier.value;
/* Pseudo-random serial - max 20 bytes, 11 for epoch (year 5138), 9 random */
const random = await randomInt(1, 999999999);
const serialNumber = `${Math.floor(now.getTime() / 1000)}${random}`;
/* CryptoKeyPair and signing algorithm from private key */
const [keys, signingAlgorithm] = await getWebCryptoKeyPair(keyPem);
const extensions = [
/* https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3 */
new x509.KeyUsagesExtension(x509.KeyUsageFlags.keyCertSign | x509.KeyUsageFlags.cRLSign, true), // eslint-disable-line no-bitwise
/* https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.9 */
new x509.BasicConstraintsExtension(true, 2, true),
/* https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.2 */
await x509.SubjectKeyIdentifierExtension.create(keys.publicKey),
/* https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.6 */
createSubjectAltNameExtension([commonName]),
];
/* ALPN extension */
const payload = crypto.createHash('sha256').update(keyAuthorization).digest('hex');
const octstr = new asn1js.OctetString({ valueHex: Buffer.from(payload, 'hex') });
extensions.push(new x509.Extension(alpnAcmeIdentifierOID, true, octstr.toBER()));
/* Self-signed ALPN certificate */
const cert = await x509.X509CertificateGenerator.createSelfSigned({
keys,
signingAlgorithm,
extensions,
serialNumber,
notBefore: now,
notAfter: now,
name: createCsrSubject({
CN: commonName,
}),
});
/* Done */
const pem = cert.toString('pem');
return [keyPem, Buffer.from(pem)];
};
/**
* Validate that a ALPN certificate contains the expected key authorization
*
* @param {buffer|string} certPem PEM encoded certificate
* @param {string} keyAuthorization Expected challenge key authorization
* @returns {boolean} True when valid
*/
exports.isAlpnCertificateAuthorizationValid = (certPem, keyAuthorization) => {
const expected = crypto.createHash('sha256').update(keyAuthorization).digest('hex');
/* Attempt to locate ALPN extension */
const cert = new x509.X509Certificate(certPem);
const ext = cert.getExtension(alpnAcmeIdentifierOID);
if (!ext) {
throw new Error('Unable to locate ALPN extension within parsed certificate');
}
/* Decode extension value */
const parsed = asn1js.fromBER(ext.value);
const result = Buffer.from(parsed.result.valueBlock.valueHexView).toString('hex');
/* Return true if match */
return (result === expected);
};

View File

@@ -0,0 +1,339 @@
/**
* ACME HTTP client
*/
const { createHmac, createSign, constants: { RSA_PKCS1_PADDING } } = require('crypto');
const { HttpsProxyAgent } = require('https-proxy-agent');
const { getJwk } = require('./crypto');
const { log } = require('./logger');
const axios1 = require('./axios');
const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
let httpsAgent = null;
if (httpsProxy) {
httpsAgent = new HttpsProxyAgent(httpsProxy);
log(`use https_proxy:${httpsProxy}`);
}
const axios = axios1.create({
proxy: false,
httpsAgent,
});
/**
* ACME HTTP client
*
* @class
* @param {string} directoryUrl ACME directory URL
* @param {buffer} accountKey PEM encoded account private key
* @param {object} [opts.externalAccountBinding]
* @param {string} [opts.externalAccountBinding.kid] External account binding KID
* @param {string} [opts.externalAccountBinding.hmacKey] External account binding HMAC key
*/
class HttpClient {
constructor(directoryUrl, accountKey, externalAccountBinding = {}, urlMapping = {}) {
this.directoryUrl = directoryUrl;
this.accountKey = accountKey;
this.externalAccountBinding = externalAccountBinding;
this.maxBadNonceRetries = 5;
this.jwk = null;
this.directoryCache = null;
this.directoryMaxAge = 86400;
this.directoryTimestamp = 0;
this.urlMapping = urlMapping;
}
/**
* HTTP request
*
* @param {string} url HTTP URL
* @param {string} method HTTP method
* @param {object} [opts] Request options
* @returns {Promise<object>} HTTP response
*/
async request(url, method, opts = {}) {
if (this.urlMapping && this.urlMapping.enabled && this.urlMapping.mappings) {
// eslint-disable-next-line no-restricted-syntax
for (const key in this.urlMapping.mappings) {
if (url.includes(key)) {
const newUrl = url.replace(key, this.urlMapping.mappings[key]);
log(`use reverse proxy: ${newUrl}`);
url = newUrl;
}
}
}
opts.url = url;
opts.method = method;
opts.validateStatus = null;
/* Headers */
if (typeof opts.headers === 'undefined') {
opts.headers = {};
}
opts.headers['Content-Type'] = 'application/jose+json';
/* Request */
log(`HTTP request: ${method} ${url}`);
const resp = await axios.request(opts);
log(`RESP ${resp.status} ${method} ${url}`);
return resp;
}
/**
* Get ACME provider directory
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.1.1
*
* @returns {Promise<object>} ACME directory contents
*/
async getDirectory() {
const now = Math.floor(Date.now() / 1000);
const age = (now - this.directoryTimestamp);
if (!this.directoryCache || (age > this.directoryMaxAge)) {
log(`Refreshing ACME directory, age: ${age}`);
const resp = await this.request(this.directoryUrl, 'get');
if (resp.status >= 400) {
throw new Error(`Attempting to read ACME directory returned error ${resp.status}: ${this.directoryUrl}`);
}
if (!resp.data) {
throw new Error('Attempting to read ACME directory returned no data');
}
this.directoryCache = resp.data;
this.directoryTimestamp = now;
}
return this.directoryCache;
}
/**
* Get JSON Web Key
*
* @returns {object} JSON Web Key
*/
getJwk() {
if (!this.jwk) {
this.jwk = getJwk(this.accountKey);
}
return this.jwk;
}
/**
* Get nonce from directory API endpoint
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.2
*
* @returns {Promise<string>} Nonce
*/
async getNonce() {
const url = await this.getResourceUrl('newNonce');
const resp = await this.request(url, 'head');
if (!resp.headers['replay-nonce']) {
throw new Error('Failed to get nonce from ACME provider');
}
return resp.headers['replay-nonce'];
}
/**
* Get URL for a directory resource
*
* @param {string} resource API resource name
* @returns {Promise<string>} URL
*/
async getResourceUrl(resource) {
const dir = await this.getDirectory();
if (!dir[resource]) {
throw new Error(`Unable to locate API resource URL in ACME directory: "${resource}"`);
}
return dir[resource];
}
/**
* Get directory meta field
*
* @param {string} field Meta field name
* @returns {Promise<string|null>} Meta field value
*/
async getMetaField(field) {
const dir = await this.getDirectory();
if (('meta' in dir) && (field in dir.meta)) {
return dir.meta[field];
}
return null;
}
/**
* Prepare HTTP request body for signature
*
* @param {string} alg JWS algorithm
* @param {string} url Request URL
* @param {object} [payload] Request payload
* @param {object} [opts]
* @param {string} [opts.nonce] JWS anti-replay nonce
* @param {string} [opts.kid] JWS KID
* @returns {object} Signed HTTP request body
*/
prepareSignedBody(alg, url, payload = null, { nonce = null, kid = null } = {}) {
const header = { alg, url };
/* Nonce */
if (nonce) {
log(`Using nonce: ${nonce}`);
header.nonce = nonce;
}
/* KID or JWK */
if (kid) {
header.kid = kid;
}
else {
header.jwk = this.getJwk();
}
/* Body */
return {
payload: payload ? Buffer.from(JSON.stringify(payload)).toString('base64url') : '',
protected: Buffer.from(JSON.stringify(header)).toString('base64url'),
};
}
/**
* Create JWS HTTP request body using HMAC
*
* @param {string} hmacKey HMAC key
* @param {string} url Request URL
* @param {object} [payload] Request payload
* @param {object} [opts]
* @param {string} [opts.nonce] JWS anti-replay nonce
* @param {string} [opts.kid] JWS KID
* @returns {object} Signed HMAC request body
*/
createSignedHmacBody(hmacKey, url, payload = null, { nonce = null, kid = null } = {}) {
const result = this.prepareSignedBody('HS256', url, payload, { nonce, kid });
/* Signature */
const signer = createHmac('SHA256', Buffer.from(hmacKey, 'base64')).update(`${result.protected}.${result.payload}`, 'utf8');
result.signature = signer.digest().toString('base64url');
return result;
}
/**
* Create JWS HTTP request body using RSA or ECC
*
* https://datatracker.ietf.org/doc/html/rfc7515
*
* @param {string} url Request URL
* @param {object} [payload] Request payload
* @param {object} [opts]
* @param {string} [opts.nonce] JWS nonce
* @param {string} [opts.kid] JWS KID
* @returns {object} JWS request body
*/
createSignedBody(url, payload = null, { nonce = null, kid = null } = {}) {
const jwk = this.getJwk();
let headerAlg = 'RS256';
let signerAlg = 'SHA256';
/* https://datatracker.ietf.org/doc/html/rfc7518#section-3.1 */
if (jwk.crv && (jwk.kty === 'EC')) {
headerAlg = 'ES256';
if (jwk.crv === 'P-384') {
headerAlg = 'ES384';
signerAlg = 'SHA384';
}
else if (jwk.crv === 'P-521') {
headerAlg = 'ES512';
signerAlg = 'SHA512';
}
}
/* Prepare body and signer */
const result = this.prepareSignedBody(headerAlg, url, payload, { nonce, kid });
const signer = createSign(signerAlg).update(`${result.protected}.${result.payload}`, 'utf8');
/* Signature - https://stackoverflow.com/questions/39554165 */
result.signature = signer.sign({
key: this.accountKey,
padding: RSA_PKCS1_PADDING,
dsaEncoding: 'ieee-p1363',
}, 'base64url');
return result;
}
/**
* Signed HTTP request
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-6.2
*
* @param {string} url Request URL
* @param {object} payload Request payload
* @param {object} [opts]
* @param {string} [opts.kid] JWS KID
* @param {string} [opts.nonce] JWS anti-replay nonce
* @param {boolean} [opts.includeExternalAccountBinding] Include EAB in request
* @param {number} [attempts] Request attempt counter
* @returns {Promise<object>} HTTP response
*/
async signedRequest(url, payload, { kid = null, nonce = null, includeExternalAccountBinding = false } = {}, attempts = 0) {
if (!nonce) {
nonce = await this.getNonce();
}
/* External account binding */
if (includeExternalAccountBinding && this.externalAccountBinding) {
if (this.externalAccountBinding.kid && this.externalAccountBinding.hmacKey) {
const jwk = this.getJwk();
const eabKid = this.externalAccountBinding.kid;
const eabHmacKey = this.externalAccountBinding.hmacKey;
payload.externalAccountBinding = this.createSignedHmacBody(eabHmacKey, url, jwk, { kid: eabKid });
}
}
/* Sign body and send request */
const data = this.createSignedBody(url, payload, { nonce, kid });
const resp = await this.request(url, 'post', { data });
/* Retry on bad nonce - https://datatracker.ietf.org/doc/html/rfc8555#section-6.5 */
if (resp.data && resp.data.type && (resp.status === 400) && (resp.data.type === 'urn:ietf:params:acme:error:badNonce') && (attempts < this.maxBadNonceRetries)) {
nonce = resp.headers['replay-nonce'] || null;
attempts += 1;
log(`Caught invalid nonce error, retrying (${attempts}/${this.maxBadNonceRetries}) signed request to: ${url}`);
return this.signedRequest(url, payload, { kid, nonce, includeExternalAccountBinding }, attempts);
}
/* Return response */
return resp;
}
}
/* Export client */
module.exports = HttpClient;

View File

@@ -0,0 +1,47 @@
/**
* acme-client
*/
exports.Client = require('./client');
/**
* Directory URLs
*/
exports.directory = {
buypass: {
staging: 'https://api.test4.buypass.no/acme/directory',
production: 'https://api.buypass.com/acme/directory',
},
google: {
staging: 'https://dv.acme-v02.test-api.pki.goog/directory',
production: 'https://dv.acme-v02.api.pki.goog/directory',
},
letsencrypt: {
staging: 'https://acme-staging-v02.api.letsencrypt.org/directory',
production: 'https://acme-v02.api.letsencrypt.org/directory',
},
zerossl: {
staging: 'https://acme.zerossl.com/v2/DV90',
production: 'https://acme.zerossl.com/v2/DV90',
},
};
/**
* Crypto
*/
exports.crypto = require('./crypto');
exports.forge = require('./crypto/forge');
/**
* Axios
*/
exports.axios = require('./axios');
/**
* Logger
*/
exports.setLogger = require('./logger').setLogger;

View File

@@ -0,0 +1,28 @@
/**
* ACME logger
*/
const debug = require('debug')('acme-client');
let logger = () => {};
/**
* Set logger function
*
* @param {function} fn Logger function
*/
exports.setLogger = (fn) => {
logger = fn;
};
/**
* Log message
*
* @param {string} msg Message
*/
exports.log = (msg) => {
debug(msg);
logger(msg);
};

View File

@@ -0,0 +1,340 @@
/**
* Utility methods
*/
const tls = require('tls');
const dns = require('dns').promises;
const { readCertificateInfo, splitPemChain } = require('./crypto');
const { log } = require('./logger');
/**
* Exponential backoff
*
* https://github.com/mokesmokes/backo
*
* @class
* @param {object} [opts]
* @param {number} [opts.min] Minimum backoff duration in ms
* @param {number} [opts.max] Maximum backoff duration in ms
*/
class Backoff {
constructor({ min = 100, max = 10000 } = {}) {
this.min = min;
this.max = max;
this.attempts = 0;
}
/**
* Get backoff duration
*
* @returns {number} Backoff duration in ms
*/
duration() {
const ms = this.min * (2 ** this.attempts);
this.attempts += 1;
return Math.min(ms, this.max);
}
}
/**
* Retry promise
*
* @param {function} fn Function returning promise that should be retried
* @param {number} attempts Maximum number of attempts
* @param {Backoff} backoff Backoff instance
* @returns {Promise}
*/
async function retryPromise(fn, attempts, backoff) {
let aborted = false;
try {
const data = await fn(() => { aborted = true; });
return data;
}
catch (e) {
if (aborted || ((backoff.attempts + 1) >= attempts)) {
throw e;
}
const duration = backoff.duration();
log(`Promise rejected attempt #${backoff.attempts}, retrying in ${duration}ms: ${e.message}`);
await new Promise((resolve) => { setTimeout(resolve, duration); });
return retryPromise(fn, attempts, backoff);
}
}
/**
* Retry promise
*
* @param {function} fn Function returning promise that should be retried
* @param {object} [backoffOpts] Backoff options
* @param {number} [backoffOpts.attempts] Maximum number of attempts, default: `5`
* @param {number} [backoffOpts.min] Minimum attempt delay in milliseconds, default: `5000`
* @param {number} [backoffOpts.max] Maximum attempt delay in milliseconds, default: `30000`
* @returns {Promise}
*/
function retry(fn, { attempts = 5, min = 5000, max = 30000 } = {}) {
const backoff = new Backoff({ min, max });
return retryPromise(fn, attempts, backoff);
}
/**
* Parse URLs from Link header
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-7.4.2
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
*
* @param {string} header Header contents
* @param {string} rel Link relation, default: `alternate`
* @returns {string[]} Array of URLs
*/
function parseLinkHeader(header, rel = 'alternate') {
const relRe = new RegExp(`\\s*rel\\s*=\\s*"?${rel}"?`, 'i');
const results = (header || '').split(/,\s*</).map((link) => {
const [, linkUrl, linkParts] = link.match(/<?([^>]*)>;(.*)/) || [];
return (linkUrl && linkParts && linkParts.match(relRe)) ? linkUrl : null;
});
return results.filter((r) => r);
}
/**
* Parse date or duration from Retry-After header
*
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
*
* @param {string} header Header contents
* @returns {number} Retry duration in seconds
*/
function parseRetryAfterHeader(header) {
const sec = parseInt(header, 10);
const date = new Date(header);
/* Seconds into the future */
if (Number.isSafeInteger(sec) && (sec > 0)) {
return sec;
}
/* Future date string */
if (date instanceof Date && !Number.isNaN(date)) {
const now = new Date();
const diff = Math.ceil((date.getTime() - now.getTime()) / 1000);
if (diff > 0) {
return diff;
}
}
return 0;
}
/**
* Find certificate chain with preferred issuer common name
* - If issuer is found in multiple chains, the closest to root wins
* - If issuer can not be located, the first chain will be returned
*
* @param {string[]} certificates Array of PEM encoded certificate chains
* @param {string} issuer Preferred certificate issuer
* @returns {string} PEM encoded certificate chain
*/
function findCertificateChainForIssuer(chains, issuer) {
log(`Attempting to find match for issuer="${issuer}" in ${chains.length} certificate chains`);
let bestMatch = null;
let bestDistance = null;
chains.forEach((chain) => {
/* Look up all issuers */
const certs = splitPemChain(chain);
const infoCollection = certs.map((c) => readCertificateInfo(c));
const issuerCollection = infoCollection.map((i) => i.issuer.commonName);
/* Found issuer match, get distance from root - lower is better */
if (issuerCollection.includes(issuer)) {
const distance = (issuerCollection.length - issuerCollection.indexOf(issuer));
log(`Found matching chain for preferred issuer="${issuer}" distance=${distance} issuers=${JSON.stringify(issuerCollection)}`);
/* Chain wins, use it */
if (!bestDistance || (distance < bestDistance)) {
log(`Issuer is closer to root than previous match, using it (${distance} < ${bestDistance || 'undefined'})`);
bestMatch = chain;
bestDistance = distance;
}
}
else {
/* No match */
log(`Unable to match certificate for preferred issuer="${issuer}", issuers=${JSON.stringify(issuerCollection)}`);
}
});
/* Return found match */
if (bestMatch) {
return bestMatch;
}
/* No chains matched, return default */
log(`Found no match in ${chains.length} certificate chains for preferred issuer="${issuer}", returning default certificate chain`);
return chains[0];
}
/**
* Find and format error in response object
*
* @param {object} resp HTTP response
* @returns {string} Error message
*/
function formatResponseError(resp) {
let result;
if (resp.data) {
if (resp.data.error) {
result = resp.data.error.detail || resp.data.error;
}
else {
result = resp.data.detail || JSON.stringify(resp.data);
}
}
return (result || '').replace(/\n/g, '');
}
/**
* Resolve root domain name by looking for SOA record
*
* @param {string} recordName DNS record name
* @returns {Promise<string>} Root domain name
*/
async function resolveDomainBySoaRecord(recordName) {
try {
await dns.resolveSoa(recordName);
log(`Found SOA record, considering domain to be: ${recordName}`);
return recordName;
}
catch (e) {
log(`Unable to locate SOA record for name: ${recordName}`);
const parentRecordName = recordName.split('.').slice(1).join('.');
if (!parentRecordName.includes('.')) {
throw new Error('Unable to resolve domain by SOA record');
}
return resolveDomainBySoaRecord(parentRecordName);
}
}
/**
* Get DNS resolver using domains authoritative NS records
*
* @param {string} recordName DNS record name
* @returns {Promise<dns.Resolver>} DNS resolver
*/
async function getAuthoritativeDnsResolver(recordName) {
log(`Locating authoritative NS records for name: ${recordName}`);
const resolver = new dns.Resolver();
try {
/* Resolve root domain by SOA */
const domain = await resolveDomainBySoaRecord(recordName);
/* Resolve authoritative NS addresses */
log(`Looking up authoritative NS records for domain: ${domain}`);
const nsRecords = await dns.resolveNs(domain);
const nsAddrArray = await Promise.all(nsRecords.map(async (r) => dns.resolve4(r)));
const nsAddresses = [].concat(...nsAddrArray).filter((a) => a);
if (!nsAddresses.length) {
throw new Error(`Unable to locate any valid authoritative NS addresses for domain: ${domain}`);
}
/* Authoritative NS success */
log(`Found ${nsAddresses.length} authoritative NS addresses for domain: ${domain}`);
resolver.setServers(nsAddresses);
}
catch (e) {
log(`Authoritative NS lookup error: ${e.message}`);
}
/* Return resolver */
const addresses = resolver.getServers();
log(`DNS resolver addresses: ${addresses.join(', ')}`);
return resolver;
}
/**
* Attempt to retrieve TLS ALPN certificate from peer
*
* https://nodejs.org/api/tls.html#tlsconnectoptions-callback
*
* @param {string} host Host the TLS client should connect to
* @param {number} port Port the client should connect to
* @param {string} servername Server name for the SNI (Server Name Indication)
* @returns {Promise<string>} PEM encoded certificate
*/
async function retrieveTlsAlpnCertificate(host, port, timeout = 30000) {
return new Promise((resolve, reject) => {
let result;
/* TLS connection */
const socket = tls.connect({
host,
port,
servername: host,
rejectUnauthorized: false,
ALPNProtocols: ['acme-tls/1'],
});
socket.setTimeout(timeout);
socket.setEncoding('utf-8');
/* Grab certificate once connected and close */
socket.on('secureConnect', () => {
result = socket.getPeerX509Certificate();
socket.end();
});
/* Errors */
socket.on('error', (err) => {
reject(err);
});
socket.on('timeout', () => {
socket.destroy(new Error('TLS ALPN certificate lookup request timed out'));
});
/* Done, return cert as PEM if found */
socket.on('end', () => {
if (result) {
return resolve(result.toString());
}
return reject(new Error('TLS ALPN lookup failed to retrieve certificate'));
});
});
}
/**
* Export utils
*/
module.exports = {
retry,
parseLinkHeader,
parseRetryAfterHeader,
findCertificateChainForIssuer,
formatResponseError,
getAuthoritativeDnsResolver,
retrieveTlsAlpnCertificate,
};

View File

@@ -0,0 +1,156 @@
/**
* ACME challenge verification
*/
const dns = require('dns').promises;
const https = require('https');
const { log } = require('./logger');
const axios = require('./axios');
const util = require('./util');
const { isAlpnCertificateAuthorizationValid } = require('./crypto');
/**
* Verify ACME HTTP challenge
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-8.3
*
* @param {object} authz Identifier authorization
* @param {object} challenge Authorization challenge
* @param {string} keyAuthorization Challenge key authorization
* @param {string} [suffix] URL suffix
* @returns {Promise<boolean>}
*/
async function verifyHttpChallenge(authz, challenge, keyAuthorization, suffix = `/.well-known/acme-challenge/${challenge.token}`) {
const httpPort = axios.defaults.acmeSettings.httpChallengePort || 80;
const challengeUrl = `http://${authz.identifier.value}:${httpPort}${suffix}`;
/* May redirect to HTTPS with invalid/self-signed cert - https://letsencrypt.org/docs/challenge-types/#http-01-challenge */
const httpsAgent = new https.Agent({ rejectUnauthorized: false });
log(`Sending HTTP query to ${authz.identifier.value}, suffix: ${suffix}, port: ${httpPort}`);
const resp = await axios.get(challengeUrl, { httpsAgent });
const data = (resp.data || '').replace(/\s+$/, '');
log(`Query successful, HTTP status code: ${resp.status}`);
if (!data || (data !== keyAuthorization)) {
throw new Error(`Authorization not found in HTTP response from ${authz.identifier.value}`);
}
log(`Key authorization match for ${challenge.type}/${authz.identifier.value}, ACME challenge verified`);
return true;
}
/**
* Walk DNS until TXT records are found
*/
async function walkDnsChallengeRecord(recordName, resolver = dns) {
/* Resolve CNAME record first */
// try {
// log(`Checking name for CNAME records: ${recordName}`);
// const cnameRecords = await resolver.resolveCname(recordName);
//
// if (cnameRecords.length) {
// log(`CNAME record found at ${recordName}, new challenge record name: ${cnameRecords[0]}`);
// return walkDnsChallengeRecord(cnameRecords[0]);
// }
// }
// catch (e) {
// log(`No CNAME records found for name: ${recordName}`);
// }
/* Resolve TXT records */
try {
log(`Checking name for TXT records: ${recordName}`);
const txtRecords = await resolver.resolveTxt(recordName);
if (txtRecords.length) {
log(`Found ${txtRecords.length} TXT records at ${recordName}`);
return [].concat(...txtRecords);
}
}
catch (e) {
log(`No TXT records found for name: ${recordName}`);
}
/* Found nothing */
throw new Error(`No TXT records found for name: ${recordName}`);
}
/**
* Verify ACME DNS challenge
*
* https://datatracker.ietf.org/doc/html/rfc8555#section-8.4
*
* @param {object} authz Identifier authorization
* @param {object} challenge Authorization challenge
* @param {string} keyAuthorization Challenge key authorization
* @param {string} [prefix] DNS prefix
* @returns {Promise<boolean>}
*/
async function verifyDnsChallenge(authz, challenge, keyAuthorization, prefix = '_acme-challenge.') {
let recordValues = [];
const recordName = `${prefix}${authz.identifier.value}`;
log(`Resolving DNS TXT from record: ${recordName}`);
try {
/* Default DNS resolver first */
log('Attempting to resolve TXT with default DNS resolver first');
recordValues = await walkDnsChallengeRecord(recordName);
}
catch (e) {
/* Authoritative DNS resolver */
log(`Error using default resolver, attempting to resolve TXT with authoritative NS: ${e.message}`);
const authoritativeResolver = await util.getAuthoritativeDnsResolver(recordName);
recordValues = await walkDnsChallengeRecord(recordName, authoritativeResolver);
}
log(`DNS query finished successfully, found ${recordValues.length} TXT records`);
if (!recordValues.length || !recordValues.includes(keyAuthorization)) {
throw new Error(`Authorization not found in DNS TXT record: ${recordName}need:${keyAuthorization},found:${recordValues}`);
}
log(`Key authorization match for ${challenge.type}/${recordName}, ACME challenge verified`);
return true;
}
/**
* Verify ACME TLS ALPN challenge
*
* https://datatracker.ietf.org/doc/html/rfc8737
*
* @param {object} authz Identifier authorization
* @param {object} challenge Authorization challenge
* @param {string} keyAuthorization Challenge key authorization
* @returns {Promise<boolean>}
*/
async function verifyTlsAlpnChallenge(authz, challenge, keyAuthorization) {
const tlsAlpnPort = axios.defaults.acmeSettings.tlsAlpnChallengePort || 443;
const host = authz.identifier.value;
log(`Establishing TLS connection with host: ${host}:${tlsAlpnPort}`);
const certificate = await util.retrieveTlsAlpnCertificate(host, tlsAlpnPort);
log('Certificate received from server successfully, matching key authorization in ALPN');
if (!isAlpnCertificateAuthorizationValid(certificate, keyAuthorization)) {
throw new Error(`Authorization not found in certificate from ${authz.identifier.value}`);
}
log(`Key authorization match for ${challenge.type}/${authz.identifier.value}, ACME challenge verified`);
return true;
}
/**
* Export API
*/
module.exports = {
'http-01': verifyHttpChallenge,
'dns-01': verifyDnsChallenge,
'tls-alpn-01': verifyTlsAlpnChallenge,
};

View File

@@ -0,0 +1,9 @@
async function wait(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
module.exports = {
wait
};

View File

@@ -0,0 +1,208 @@
/**
* Pebble Challenge Test Server tests
*/
const dns = require('dns').promises;
const { randomUUID: uuid } = require('crypto');
const https = require('https');
const { assert } = require('chai');
const cts = require('./challtestsrv');
const axios = require('./../src/axios');
const { retrieveTlsAlpnCertificate } = require('./../src/util');
const { isAlpnCertificateAuthorizationValid } = require('./../src/crypto');
const domainName = process.env.ACME_DOMAIN_NAME || 'example.com';
const httpPort = axios.defaults.acmeSettings.httpChallengePort || 80;
const httpsPort = axios.defaults.acmeSettings.httpsChallengePort || 443;
const tlsAlpnPort = axios.defaults.acmeSettings.tlsAlpnChallengePort || 443;
describe('pebble', () => {
const httpsAgent = new https.Agent({ rejectUnauthorized: false });
const testAHost = `${uuid()}.${domainName}`;
const testARecords = ['1.1.1.1', '2.2.2.2'];
const testCnameHost = `${uuid()}.${domainName}`;
const testCnameRecord = `${uuid()}.${domainName}`;
const testHttp01ChallengeHost = `${uuid()}.${domainName}`;
const testHttp01ChallengeToken = uuid();
const testHttp01ChallengeContent = uuid();
const testHttps01ChallengeHost = `${uuid()}.${domainName}`;
const testHttps01ChallengeToken = uuid();
const testHttps01ChallengeContent = uuid();
const testDns01ChallengeHost = `_acme-challenge.${uuid()}.${domainName}.`;
const testDns01ChallengeValue = uuid();
const testTlsAlpn01ChallengeHost = `${uuid()}.${domainName}`;
const testTlsAlpn01ChallengeValue = uuid();
/**
* Pebble CTS required
*/
before(function () {
if (!cts.isEnabled()) {
this.skip();
}
});
/**
* DNS mocking
*/
describe('dns', () => {
it('should not locate a records', async () => {
const resp = await dns.resolve4(testAHost);
assert.isArray(resp);
assert.notDeepEqual(resp, testARecords);
});
it('should add dns a records', async () => {
const resp = await cts.addDnsARecord(testAHost, testARecords);
assert.isTrue(resp);
});
it('should locate a records', async () => {
const resp = await dns.resolve4(testAHost);
assert.isArray(resp);
assert.deepStrictEqual(resp, testARecords);
});
it('should not locate cname records', async () => {
await assert.isRejected(dns.resolveCname(testCnameHost));
});
it('should set dns cname record', async () => {
const resp = await cts.setDnsCnameRecord(testCnameHost, testCnameRecord);
assert.isTrue(resp);
});
it('should locate cname record', async () => {
const resp = await dns.resolveCname(testCnameHost);
assert.isArray(resp);
assert.deepStrictEqual(resp, [testCnameRecord]);
});
});
/**
* HTTP-01 challenge response
*/
describe('http-01', () => {
it('should not locate challenge response', async () => {
const resp = await axios.get(`http://${testHttp01ChallengeHost}:${httpPort}/.well-known/acme-challenge/${testHttp01ChallengeToken}`);
assert.isString(resp.data);
assert.notEqual(resp.data, testHttp01ChallengeContent);
});
it('should add challenge response', async () => {
const resp = await cts.addHttp01ChallengeResponse(testHttp01ChallengeToken, testHttp01ChallengeContent);
assert.isTrue(resp);
});
it('should locate challenge response', async () => {
const resp = await axios.get(`http://${testHttp01ChallengeHost}:${httpPort}/.well-known/acme-challenge/${testHttp01ChallengeToken}`);
assert.isString(resp.data);
assert.strictEqual(resp.data, testHttp01ChallengeContent);
});
});
/**
* HTTPS-01 challenge response
*/
describe('https-01', () => {
it('should not locate challenge response', async () => {
const r1 = await axios.get(`http://${testHttps01ChallengeHost}:${httpPort}/.well-known/acme-challenge/${testHttps01ChallengeToken}`, { httpsAgent });
const r2 = await axios.get(`https://${testHttps01ChallengeHost}:${httpsPort}/.well-known/acme-challenge/${testHttps01ChallengeToken}`, { httpsAgent });
[r1, r2].forEach((resp) => {
assert.isString(resp.data);
assert.notEqual(resp.data, testHttps01ChallengeContent);
});
});
it('should add challenge response', async () => {
const resp = await cts.addHttps01ChallengeResponse(testHttps01ChallengeToken, testHttps01ChallengeContent, testHttps01ChallengeHost);
assert.isTrue(resp);
});
it('should 302 with self-signed cert', async () => {
/* Assert HTTP 302 */
const resp = await axios.get(`http://${testHttps01ChallengeHost}:${httpPort}/.well-known/acme-challenge/${testHttps01ChallengeToken}`, {
maxRedirects: 0,
validateStatus: null,
});
assert.strictEqual(resp.status, 302);
assert.strictEqual(resp.headers.location, `https://${testHttps01ChallengeHost}:${httpsPort}/.well-known/acme-challenge/${testHttps01ChallengeToken}`);
/* Self-signed cert test */
await assert.isRejected(axios.get(`https://${testHttps01ChallengeHost}:${httpsPort}/.well-known/acme-challenge/${testHttps01ChallengeToken}`));
await assert.isFulfilled(axios.get(`https://${testHttps01ChallengeHost}:${httpsPort}/.well-known/acme-challenge/${testHttps01ChallengeToken}`, { httpsAgent }));
});
it('should locate challenge response', async () => {
const r1 = await axios.get(`http://${testHttps01ChallengeHost}:${httpPort}/.well-known/acme-challenge/${testHttps01ChallengeToken}`, { httpsAgent });
const r2 = await axios.get(`https://${testHttps01ChallengeHost}:${httpsPort}/.well-known/acme-challenge/${testHttps01ChallengeToken}`, { httpsAgent });
[r1, r2].forEach((resp) => {
assert.isString(resp.data);
assert.strictEqual(resp.data, testHttps01ChallengeContent);
});
});
});
/**
* DNS-01 challenge response
*/
describe('dns-01', () => {
it('should not locate challenge response', async () => {
await assert.isRejected(dns.resolveTxt(testDns01ChallengeHost));
});
it('should add challenge response', async () => {
const resp = await cts.addDns01ChallengeResponse(testDns01ChallengeHost, testDns01ChallengeValue);
assert.isTrue(resp);
});
it('should locate challenge response', async () => {
const resp = await dns.resolveTxt(testDns01ChallengeHost);
assert.isArray(resp);
assert.deepStrictEqual(resp, [[testDns01ChallengeValue]]);
});
});
/**
* TLS-ALPN-01 challenge response
*/
describe('tls-alpn-01', () => {
it('should not locate challenge response', async () => {
await assert.isRejected(retrieveTlsAlpnCertificate(testTlsAlpn01ChallengeHost, tlsAlpnPort), /(failed to retrieve)|(ssl3_read_bytes:tlsv1 alert internal error)/);
});
it('should timeout challenge response', async () => {
await assert.isRejected(retrieveTlsAlpnCertificate('example.org', tlsAlpnPort, 500));
});
it('should add challenge response', async () => {
const resp = await cts.addTlsAlpn01ChallengeResponse(testTlsAlpn01ChallengeHost, testTlsAlpn01ChallengeValue);
assert.isTrue(resp);
});
it('should locate challenge response', async () => {
const resp = await retrieveTlsAlpnCertificate(testTlsAlpn01ChallengeHost, tlsAlpnPort);
assert.isTrue(isAlpnCertificateAuthorizationValid(resp, testTlsAlpn01ChallengeValue));
});
});
});

View File

@@ -0,0 +1,121 @@
/**
* HTTP client tests
*/
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai');
const nock = require('nock');
const axios = require('./../src/axios');
const HttpClient = require('./../src/http');
const pkg = require('./../package.json');
describe('http', () => {
let testClient;
const endpoint = `http://${uuid()}.example.com`;
const defaultUserAgent = `node-${pkg.name}/${pkg.version}`;
const customUserAgent = 'custom-ua-123';
afterEach(() => {
nock.cleanAll();
});
/**
* Initialize
*/
it('should initialize clients', () => {
testClient = new HttpClient();
});
/**
* HTTP verbs
*/
it('should http get', async () => {
nock(endpoint).get('/').reply(200, 'ok');
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.data, 'ok');
});
/**
* User-Agent
*/
it('should request using default user-agent', async () => {
nock(endpoint).matchHeader('user-agent', defaultUserAgent).get('/').reply(200, 'ok');
axios.defaults.headers.common['User-Agent'] = defaultUserAgent;
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.data, 'ok');
});
it('should reject using custom user-agent', async () => {
nock(endpoint).matchHeader('user-agent', defaultUserAgent).get('/').reply(200, 'ok');
axios.defaults.headers.common['User-Agent'] = customUserAgent;
await assert.isRejected(testClient.request(endpoint, 'get'));
});
it('should request using custom user-agent', async () => {
nock(endpoint).matchHeader('user-agent', customUserAgent).get('/').reply(200, 'ok');
axios.defaults.headers.common['User-Agent'] = customUserAgent;
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.data, 'ok');
});
it('should reject using default user-agent', async () => {
nock(endpoint).matchHeader('user-agent', customUserAgent).get('/').reply(200, 'ok');
axios.defaults.headers.common['User-Agent'] = defaultUserAgent;
await assert.isRejected(testClient.request(endpoint, 'get'));
});
/**
* Retry on HTTP errors
*/
it('should retry on 429 rate limit', async () => {
let rateLimitCount = 0;
nock(endpoint).persist().get('/').reply(() => {
rateLimitCount += 1;
if (rateLimitCount < 3) {
return [429, 'Rate Limit Exceeded', { 'Retry-After': 1 }];
}
return [200, 'ok'];
});
assert.strictEqual(rateLimitCount, 0);
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 200);
assert.strictEqual(resp.data, 'ok');
assert.strictEqual(rateLimitCount, 3);
});
it('should retry on 5xx server error', async () => {
let serverErrorCount = 0;
nock(endpoint).persist().get('/').reply(() => {
serverErrorCount += 1;
return [500, 'Internal Server Error', { 'Retry-After': 1 }];
});
assert.strictEqual(serverErrorCount, 0);
const resp = await testClient.request(endpoint, 'get');
assert.isObject(resp);
assert.strictEqual(resp.status, 500);
assert.strictEqual(serverErrorCount, 4);
});
});

View File

@@ -0,0 +1,32 @@
/**
* Logger tests
*/
const { assert } = require('chai');
const logger = require('./../src/logger');
describe('logger', () => {
let lastLogMessage = null;
function customLoggerFn(msg) {
lastLogMessage = msg;
}
/**
* Logger
*/
it('should log without custom logger', () => {
logger.log('something');
assert.isNull(lastLogMessage);
});
it('should log with custom logger', () => {
logger.setLogger(customLoggerFn);
['abc123', 'def456', 'ghi789'].forEach((m) => {
logger.log(m);
assert.strictEqual(lastLogMessage, m);
});
});
});

View File

@@ -0,0 +1,145 @@
/**
* Utility method tests
*/
const dns = require('dns').promises;
const fs = require('fs').promises;
const path = require('path');
const { assert } = require('chai');
const util = require('./../src/util');
const { readCertificateInfo } = require('./../src/crypto');
describe('util', () => {
const testCertPath1 = path.join(__dirname, 'fixtures', 'certificate.crt');
const testCertPath2 = path.join(__dirname, 'fixtures', 'letsencrypt.crt');
it('retry()', async () => {
let attempts = 0;
const backoffOpts = {
min: 100,
max: 500,
};
await assert.isRejected(util.retry(() => {
throw new Error('oops');
}, backoffOpts));
const r = await util.retry(() => {
attempts += 1;
if (attempts < 3) {
throw new Error('oops');
}
return 'abc';
}, backoffOpts);
assert.strictEqual(r, 'abc');
assert.strictEqual(attempts, 3);
});
it('parseLinkHeader()', () => {
const r1 = util.parseLinkHeader('<https://example.com/a>;rel="alternate"');
assert.isArray(r1);
assert.strictEqual(r1.length, 1);
assert.strictEqual(r1[0], 'https://example.com/a');
const r2 = util.parseLinkHeader('<https://example.com/b>;rel="test"');
assert.isArray(r2);
assert.strictEqual(r2.length, 0);
const r3 = util.parseLinkHeader('<http://example.com/c>; rel="test"', 'test');
assert.isArray(r3);
assert.strictEqual(r3.length, 1);
assert.strictEqual(r3[0], 'http://example.com/c');
const r4 = util.parseLinkHeader(`<https://example.com/a>; rel="alternate",
<https://example.com/x>; rel="nope",
<https://example.com/b>;rel="alternate",
<https://example.com/c>; rel="alternate"`);
assert.isArray(r4);
assert.strictEqual(r4.length, 3);
assert.strictEqual(r4[0], 'https://example.com/a');
assert.strictEqual(r4[1], 'https://example.com/b');
assert.strictEqual(r4[2], 'https://example.com/c');
});
it('parseRetryAfterHeader()', () => {
const r1 = util.parseRetryAfterHeader('');
assert.strictEqual(r1, 0);
const r2 = util.parseRetryAfterHeader('abcdef');
assert.strictEqual(r2, 0);
const r3 = util.parseRetryAfterHeader('123');
assert.strictEqual(r3, 123);
const r4 = util.parseRetryAfterHeader('123.456');
assert.strictEqual(r4, 123);
const r5 = util.parseRetryAfterHeader('-555');
assert.strictEqual(r5, 0);
const r6 = util.parseRetryAfterHeader('Wed, 21 Oct 2015 07:28:00 GMT');
assert.strictEqual(r6, 0);
const now = new Date();
const future = new Date(now.getTime() + 123000);
const r7 = util.parseRetryAfterHeader(future.toUTCString());
assert.isTrue(r7 > 100);
});
it('findCertificateChainForIssuer()', async () => {
const certs = [
(await fs.readFile(testCertPath1)).toString(),
(await fs.readFile(testCertPath2)).toString(),
];
const r1 = util.findCertificateChainForIssuer(certs, 'abc123');
const r2 = util.findCertificateChainForIssuer(certs, 'example.com');
const r3 = util.findCertificateChainForIssuer(certs, 'E6');
[r1, r2, r3].forEach((r) => {
assert.isString(r);
assert.isNotEmpty(r);
});
assert.strictEqual(readCertificateInfo(r1).issuer.commonName, 'example.com');
assert.strictEqual(readCertificateInfo(r2).issuer.commonName, 'example.com');
assert.strictEqual(readCertificateInfo(r3).issuer.commonName, 'E6');
});
it('formatResponseError()', () => {
const e1 = util.formatResponseError({ data: { error: 'aaa' } });
assert.strictEqual(e1, 'aaa');
const e2 = util.formatResponseError({ data: { error: { detail: 'bbb' } } });
assert.strictEqual(e2, 'bbb');
const e3 = util.formatResponseError({ data: { detail: 'ccc' } });
assert.strictEqual(e3, 'ccc');
const e4 = util.formatResponseError({ data: { a: 123 } });
assert.strictEqual(e4, '{"a":123}');
const e5 = util.formatResponseError({});
assert.isString(e5);
assert.isEmpty(e5);
});
it('getAuthoritativeDnsResolver()', async () => {
/* valid domain - should not use global default */
const r1 = await util.getAuthoritativeDnsResolver('example.com');
assert.instanceOf(r1, dns.Resolver);
assert.isNotEmpty(r1.getServers());
assert.notDeepEqual(r1.getServers(), dns.getServers());
/* invalid domain - fallback to global default */
const r2 = await util.getAuthoritativeDnsResolver('invalid.xtldx');
assert.instanceOf(r2, dns.Resolver);
assert.deepStrictEqual(r2.getServers(), dns.getServers());
});
/* TODO: Figure out how to test this */
it('retrieveTlsAlpnCertificate()');
});

View File

@@ -0,0 +1,149 @@
/**
* Challenge verification tests
*/
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai');
const cts = require('./challtestsrv');
const verify = require('./../src/verify');
const domainName = process.env.ACME_DOMAIN_NAME || 'example.com';
describe('verify', () => {
const challengeTypes = ['http-01', 'dns-01'];
const testHttp01Authz = { identifier: { type: 'dns', value: `${uuid()}.${domainName}` } };
const testHttp01Challenge = { type: 'http-01', status: 'pending', token: uuid() };
const testHttp01Key = uuid();
const testHttps01Authz = { identifier: { type: 'dns', value: `${uuid()}.${domainName}` } };
const testHttps01Challenge = { type: 'http-01', status: 'pending', token: uuid() };
const testHttps01Key = uuid();
const testDns01Authz = { identifier: { type: 'dns', value: `${uuid()}.${domainName}` } };
const testDns01Challenge = { type: 'dns-01', status: 'pending', token: uuid() };
const testDns01Key = uuid();
const testDns01Cname = `${uuid()}.${domainName}`;
const testTlsAlpn01Authz = { identifier: { type: 'dns', value: `${uuid()}.${domainName}` } };
const testTlsAlpn01Challenge = { type: 'dns-01', status: 'pending', token: uuid() };
const testTlsAlpn01Key = uuid();
/**
* Pebble CTS required
*/
before(function () {
if (!cts.isEnabled()) {
this.skip();
}
});
/**
* API
*/
it('should expose verification api', async () => {
assert.containsAllKeys(verify, challengeTypes);
});
/**
* http-01
*/
describe('http-01', () => {
it('should reject challenge', async () => {
await assert.isRejected(verify['http-01'](testHttp01Authz, testHttp01Challenge, testHttp01Key));
});
it('should mock challenge response', async () => {
const resp = await cts.addHttp01ChallengeResponse(testHttp01Challenge.token, testHttp01Key);
assert.isTrue(resp);
});
it('should verify challenge', async () => {
const resp = await verify['http-01'](testHttp01Authz, testHttp01Challenge, testHttp01Key);
assert.isTrue(resp);
});
it('should mock challenge response with trailing newline', async () => {
const resp = await cts.addHttp01ChallengeResponse(testHttp01Challenge.token, `${testHttp01Key}\n`);
assert.isTrue(resp);
});
it('should verify challenge with trailing newline', async () => {
const resp = await verify['http-01'](testHttp01Authz, testHttp01Challenge, testHttp01Key);
assert.isTrue(resp);
});
});
/**
* https-01
*/
describe('https-01', () => {
it('should reject challenge', async () => {
await assert.isRejected(verify['http-01'](testHttps01Authz, testHttps01Challenge, testHttps01Key));
});
it('should mock challenge response', async () => {
const resp = await cts.addHttps01ChallengeResponse(testHttps01Challenge.token, testHttps01Key, testHttps01Authz.identifier.value);
assert.isTrue(resp);
});
it('should verify challenge', async () => {
const resp = await verify['http-01'](testHttps01Authz, testHttps01Challenge, testHttps01Key);
assert.isTrue(resp);
});
});
/**
* dns-01
*/
describe('dns-01', () => {
it('should reject challenge', async () => {
await assert.isRejected(verify['dns-01'](testDns01Authz, testDns01Challenge, testDns01Key));
});
it('should mock challenge response', async () => {
const resp = await cts.addDns01ChallengeResponse(`_acme-challenge.${testDns01Authz.identifier.value}.`, testDns01Key);
assert.isTrue(resp);
});
it('should add cname to challenge response', async () => {
const resp = await cts.setDnsCnameRecord(testDns01Cname, `_acme-challenge.${testDns01Authz.identifier.value}.`);
assert.isTrue(resp);
});
it('should verify challenge', async () => {
const resp = await verify['dns-01'](testDns01Authz, testDns01Challenge, testDns01Key);
assert.isTrue(resp);
});
it('should verify challenge using cname', async () => {
const resp = await verify['dns-01'](testDns01Authz, testDns01Challenge, testDns01Key);
assert.isTrue(resp);
});
});
/**
* tls-alpn-01
*/
describe('tls-alpn-01', () => {
it('should reject challenge', async () => {
await assert.isRejected(verify['tls-alpn-01'](testTlsAlpn01Authz, testTlsAlpn01Challenge, testTlsAlpn01Key));
});
it('should mock challenge response', async () => {
const resp = await cts.addTlsAlpn01ChallengeResponse(testTlsAlpn01Authz.identifier.value, testTlsAlpn01Key);
assert.isTrue(resp);
});
it('should verify challenge', async () => {
const resp = await verify['tls-alpn-01'](testTlsAlpn01Authz, testTlsAlpn01Challenge, testTlsAlpn01Key);
assert.isTrue(resp);
});
});
});

View File

@@ -0,0 +1,267 @@
/**
* Legacy crypto tests
*/
const fs = require('fs').promises;
const path = require('path');
const { assert } = require('chai');
const spec = require('./spec');
const forge = require('./../src/crypto/forge');
const cryptoEngines = {
forge,
};
describe('crypto-legacy', () => {
let testPemKey;
let testCert;
let testSanCert;
const modulusStore = [];
const exponentStore = [];
const publicKeyStore = [];
const testCsrDomain = 'example.com';
const testSanCsrDomains = ['example.com', 'test.example.com', 'abc.example.com'];
const testKeyPath = path.join(__dirname, 'fixtures', 'private.key');
const testCertPath = path.join(__dirname, 'fixtures', 'certificate.crt');
const testSanCertPath = path.join(__dirname, 'fixtures', 'san-certificate.crt');
/**
* Fixtures
*/
describe('fixtures', () => {
it('should read private key fixture', async () => {
testPemKey = await fs.readFile(testKeyPath);
assert.isTrue(Buffer.isBuffer(testPemKey));
});
it('should read certificate fixture', async () => {
testCert = await fs.readFile(testCertPath);
assert.isTrue(Buffer.isBuffer(testCert));
});
it('should read san certificate fixture', async () => {
testSanCert = await fs.readFile(testSanCertPath);
assert.isTrue(Buffer.isBuffer(testSanCert));
});
});
/**
* Engines
*/
Object.entries(cryptoEngines).forEach(([name, engine]) => {
describe(`engine/${name}`, () => {
let testCsr;
let testSanCsr;
let testNonCnCsr;
let testNonAsciiCsr;
/**
* Key generation
*/
it('should generate a private key', async () => {
const key = await engine.createPrivateKey();
assert.isTrue(Buffer.isBuffer(key));
});
it('should generate a private key with size=1024', async () => {
const key = await engine.createPrivateKey(1024);
assert.isTrue(Buffer.isBuffer(key));
});
it('should generate a public key', async () => {
const key = await engine.createPublicKey(testPemKey);
assert.isTrue(Buffer.isBuffer(key));
publicKeyStore.push(key.toString().replace(/[\r\n]/gm, ''));
});
/**
* Certificate Signing Request
*/
it('should generate a csr', async () => {
const [key, csr] = await engine.createCsr({
commonName: testCsrDomain,
});
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
testCsr = csr;
});
it('should generate a san csr', async () => {
const [key, csr] = await engine.createCsr({
commonName: testSanCsrDomains[0],
altNames: testSanCsrDomains.slice(1, testSanCsrDomains.length),
});
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
testSanCsr = csr;
});
it('should generate a csr without common name', async () => {
const [key, csr] = await engine.createCsr({
altNames: testSanCsrDomains,
});
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
testNonCnCsr = csr;
});
it('should generate a non-ascii csr', async () => {
const [key, csr] = await engine.createCsr({
commonName: testCsrDomain,
organization: '大安區',
organizationUnit: '中文部門',
});
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
testNonAsciiCsr = csr;
});
it('should resolve domains from csr', async () => {
const result = await engine.readCsrDomains(testCsr);
spec.crypto.csrDomains(result);
assert.strictEqual(result.commonName, testCsrDomain);
assert.deepStrictEqual(result.altNames, [testCsrDomain]);
});
it('should resolve domains from san csr', async () => {
const result = await engine.readCsrDomains(testSanCsr);
spec.crypto.csrDomains(result);
assert.strictEqual(result.commonName, testSanCsrDomains[0]);
assert.deepStrictEqual(result.altNames, testSanCsrDomains);
});
it('should resolve domains from san without common name', async () => {
const result = await engine.readCsrDomains(testNonCnCsr);
spec.crypto.csrDomains(result);
assert.isNull(result.commonName);
assert.deepStrictEqual(result.altNames, testSanCsrDomains);
});
it('should resolve domains from non-ascii csr', async () => {
const result = await engine.readCsrDomains(testNonAsciiCsr);
spec.crypto.csrDomains(result);
assert.strictEqual(result.commonName, testCsrDomain);
assert.deepStrictEqual(result.altNames, [testCsrDomain]);
});
/**
* Certificate
*/
it('should read info from certificate', async () => {
const info = await engine.readCertificateInfo(testCert);
spec.crypto.certificateInfo(info);
assert.strictEqual(info.domains.commonName, testCsrDomain);
assert.strictEqual(info.domains.altNames.length, 0);
});
it('should read info from san certificate', async () => {
const info = await engine.readCertificateInfo(testSanCert);
spec.crypto.certificateInfo(info);
assert.strictEqual(info.domains.commonName, testSanCsrDomains[0]);
assert.deepEqual(info.domains.altNames, testSanCsrDomains.slice(1, testSanCsrDomains.length));
});
/**
* PEM utils
*/
it('should get pem body', () => {
[testPemKey, testCert, testSanCert].forEach((pem) => {
const body = engine.getPemBody(pem);
assert.isString(body);
assert.notInclude(body, '\r');
assert.notInclude(body, '\n');
assert.notInclude(body, '\r\n');
});
});
it('should split pem chain', () => {
[testPemKey, testCert, testSanCert].forEach((pem) => {
const chain = engine.splitPemChain(pem);
assert.isArray(chain);
assert.isNotEmpty(chain);
chain.forEach((c) => assert.isString(c));
});
});
/**
* Modulus and exponent
*/
it('should get modulus', async () => {
const result = await Promise.all([testPemKey, testCert, testSanCert].map(async (item) => {
const mod = await engine.getModulus(item);
assert.isTrue(Buffer.isBuffer(mod));
return mod;
}));
modulusStore.push(result);
});
it('should get public exponent', async () => {
const result = await Promise.all([testPemKey, testCert, testSanCert].map(async (item) => {
const exp = await engine.getPublicExponent(item);
assert.isTrue(Buffer.isBuffer(exp));
const b64exp = exp.toString('base64');
assert.strictEqual(b64exp, 'AQAB');
return b64exp;
}));
exponentStore.push(result);
});
});
});
/**
* Verify identical results
*/
describe('verification', () => {
it('should have identical public keys', () => {
if (publicKeyStore.length > 1) {
const reference = publicKeyStore.shift();
publicKeyStore.forEach((item) => assert.strictEqual(reference, item));
}
});
it('should have identical moduli', () => {
if (modulusStore.length > 1) {
const reference = modulusStore.shift();
modulusStore.forEach((item) => assert.deepStrictEqual(reference, item));
}
});
it('should have identical public exponents', () => {
if (exponentStore.length > 1) {
const reference = exponentStore.shift();
exponentStore.forEach((item) => assert.deepStrictEqual(reference, item));
}
});
});
});

View File

@@ -0,0 +1,410 @@
/**
* Crypto tests
*/
const fs = require('fs').promises;
const path = require('path');
const { assert } = require('chai');
const spec = require('./spec');
const { crypto } = require('./../');
const emptyBodyChain1 = `
-----BEGIN TEST-----
dGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZw==
-----END TEST-----
-----BEGIN TEST-----
dGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZw==
-----END TEST-----
-----BEGIN TEST-----
-----END TEST-----
-----BEGIN TEST-----
dGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZw==
-----END TEST-----
`;
const emptyBodyChain2 = `
-----BEGIN TEST-----
-----END TEST-----
-----BEGIN TEST-----
-----END TEST-----
-----BEGIN TEST-----
dGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZw==
-----END TEST-----
-----BEGIN TEST-----
dGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZw==
-----END TEST-----
-----BEGIN TEST-----
dGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZ3Rlc3Rpbmd0ZXN0aW5ndGVzdGluZw==
-----END TEST-----
`;
describe('crypto', () => {
const testCsrDomain = 'example.com';
const testSanCsrDomains = ['example.com', 'test.example.com', 'abc.example.com'];
const testKeyPath = path.join(__dirname, 'fixtures', 'private.key');
const testCertPath = path.join(__dirname, 'fixtures', 'certificate.crt');
const testSanCertPath = path.join(__dirname, 'fixtures', 'san-certificate.crt');
/**
* Key types
*/
Object.entries({
rsa: {
createKeyFns: {
s1024: () => crypto.createPrivateRsaKey(1024),
s2048: () => crypto.createPrivateRsaKey(),
s4096: () => crypto.createPrivateRsaKey(4096),
},
jwkSpecFn: spec.jwk.rsa,
},
ecdsa: {
createKeyFns: {
p256: () => crypto.createPrivateEcdsaKey(),
p384: () => crypto.createPrivateEcdsaKey('P-384'),
p521: () => crypto.createPrivateEcdsaKey('P-521'),
},
jwkSpecFn: spec.jwk.ecdsa,
},
}).forEach(([name, { createKeyFns, jwkSpecFn }]) => {
describe(name, () => {
const testPrivateKeys = {};
const testPublicKeys = {};
/**
* Iterate through all generator variations
*/
Object.entries(createKeyFns).forEach(([n, createFn]) => {
let testCsr;
let testSanCsr;
let testNonCnCsr;
let testNonAsciiCsr;
let testAlpnCertificate;
/**
* Keys and JWK
*/
it(`${n}/should generate private key`, async () => {
testPrivateKeys[n] = await createFn();
assert.isTrue(Buffer.isBuffer(testPrivateKeys[n]));
});
it(`${n}/should get public key`, () => {
testPublicKeys[n] = crypto.getPublicKey(testPrivateKeys[n]);
assert.isTrue(Buffer.isBuffer(testPublicKeys[n]));
});
it(`${n}/should get public key from string`, () => {
testPublicKeys[n] = crypto.getPublicKey(testPrivateKeys[n].toString());
assert.isTrue(Buffer.isBuffer(testPublicKeys[n]));
});
it(`${n}/should get jwk from private key`, () => {
const jwk = crypto.getJwk(testPrivateKeys[n]);
jwkSpecFn(jwk);
});
it(`${n}/should get jwk from public key`, () => {
const jwk = crypto.getJwk(testPublicKeys[n]);
jwkSpecFn(jwk);
});
it(`${n}/should get jwk from string`, () => {
const jwk = crypto.getJwk(testPrivateKeys[n].toString());
jwkSpecFn(jwk);
});
/**
* Certificate Signing Request
*/
it(`${n}/should generate a csr`, async () => {
const [key, csr] = await crypto.createCsr({
commonName: testCsrDomain,
}, testPrivateKeys[n]);
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
testCsr = csr;
});
it(`${n}/should generate a san csr`, async () => {
const [key, csr] = await crypto.createCsr({
commonName: testSanCsrDomains[0],
altNames: testSanCsrDomains.slice(1, testSanCsrDomains.length),
}, testPrivateKeys[n]);
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
testSanCsr = csr;
});
it(`${n}/should generate a csr without common name`, async () => {
const [key, csr] = await crypto.createCsr({
altNames: testSanCsrDomains,
}, testPrivateKeys[n]);
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
testNonCnCsr = csr;
});
it(`${n}/should generate a non-ascii csr`, async () => {
const [key, csr] = await crypto.createCsr({
commonName: testCsrDomain,
organization: '大安區',
organizationUnit: '中文部門',
}, testPrivateKeys[n]);
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
testNonAsciiCsr = csr;
});
it(`${n}/should generate a csr with key as string`, async () => {
const [key, csr] = await crypto.createCsr({
commonName: testCsrDomain,
}, testPrivateKeys[n].toString());
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
});
it(`${n}/should throw with invalid key`, async () => {
await assert.isRejected(crypto.createCsr({
commonName: testCsrDomain,
}, testPublicKeys[n]));
});
/**
* Domain and info resolver
*/
it(`${n}/should resolve domains from csr`, () => {
const result = crypto.readCsrDomains(testCsr);
spec.crypto.csrDomains(result);
assert.strictEqual(result.commonName, testCsrDomain);
assert.deepStrictEqual(result.altNames, [testCsrDomain]);
});
it(`${n}/should resolve domains from san csr`, () => {
const result = crypto.readCsrDomains(testSanCsr);
spec.crypto.csrDomains(result);
assert.strictEqual(result.commonName, testSanCsrDomains[0]);
assert.deepStrictEqual(result.altNames, testSanCsrDomains);
});
it(`${n}/should resolve domains from csr without common name`, () => {
const result = crypto.readCsrDomains(testNonCnCsr);
spec.crypto.csrDomains(result);
assert.isNull(result.commonName);
assert.deepStrictEqual(result.altNames, testSanCsrDomains);
});
it(`${n}/should resolve domains from non-ascii csr`, () => {
const result = crypto.readCsrDomains(testNonAsciiCsr);
spec.crypto.csrDomains(result);
assert.strictEqual(result.commonName, testCsrDomain);
assert.deepStrictEqual(result.altNames, [testCsrDomain]);
});
it(`${n}/should resolve domains from csr string`, () => {
[testCsr, testSanCsr, testNonCnCsr, testNonAsciiCsr].forEach((csr) => {
const result = crypto.readCsrDomains(csr.toString());
spec.crypto.csrDomains(result);
});
});
/**
* ALPN
*/
it(`${n}/should generate alpn certificate`, async () => {
const authz = { identifier: { value: 'test.example.com' } };
const [key, cert] = await crypto.createAlpnCertificate(authz, 'super-secret.12345', await createFn());
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(cert));
testAlpnCertificate = cert;
});
it(`${n}/should generate alpn certificate with key as string`, async () => {
const k = await createFn();
const authz = { identifier: { value: 'test.example.com' } };
const [key, cert] = await crypto.createAlpnCertificate(authz, 'super-secret.12345', k.toString());
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(cert));
});
it(`${n}/should not validate invalid alpn certificate key authorization`, () => {
assert.isFalse(crypto.isAlpnCertificateAuthorizationValid(testAlpnCertificate, 'aaaaaaa'));
assert.isFalse(crypto.isAlpnCertificateAuthorizationValid(testAlpnCertificate, 'bbbbbbb'));
assert.isFalse(crypto.isAlpnCertificateAuthorizationValid(testAlpnCertificate, 'ccccccc'));
});
it(`${n}/should validate valid alpn certificate key authorization`, () => {
assert.isTrue(crypto.isAlpnCertificateAuthorizationValid(testAlpnCertificate, 'super-secret.12345'));
});
it(`${n}/should validate valid alpn certificate with cert as string`, () => {
assert.isTrue(crypto.isAlpnCertificateAuthorizationValid(testAlpnCertificate.toString(), 'super-secret.12345'));
});
});
});
});
/**
* Common functionality
*/
describe('common', () => {
let testPemKey;
let testCert;
let testSanCert;
it('should read private key fixture', async () => {
testPemKey = await fs.readFile(testKeyPath);
assert.isTrue(Buffer.isBuffer(testPemKey));
});
it('should read certificate fixture', async () => {
testCert = await fs.readFile(testCertPath);
assert.isTrue(Buffer.isBuffer(testCert));
});
it('should read san certificate fixture', async () => {
testSanCert = await fs.readFile(testSanCertPath);
assert.isTrue(Buffer.isBuffer(testSanCert));
});
/**
* CSR with auto-generated key
*/
it('should generate a csr with default key', async () => {
const [key, csr] = await crypto.createCsr({
commonName: testCsrDomain,
});
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(csr));
});
/**
* Certificate
*/
it('should read certificate info', () => {
const info = crypto.readCertificateInfo(testCert);
spec.crypto.certificateInfo(info);
assert.strictEqual(info.domains.commonName, testCsrDomain);
assert.strictEqual(info.domains.altNames.length, 0);
});
it('should read certificate info with san', () => {
const info = crypto.readCertificateInfo(testSanCert);
spec.crypto.certificateInfo(info);
assert.strictEqual(info.domains.commonName, testSanCsrDomains[0]);
assert.deepEqual(info.domains.altNames, testSanCsrDomains.slice(1, testSanCsrDomains.length));
});
it('should read certificate info from string', () => {
[testCert, testSanCert].forEach((cert) => {
const info = crypto.readCertificateInfo(cert.toString());
spec.crypto.certificateInfo(info);
});
});
/**
* ALPN
*/
it('should generate alpn certificate with default key', async () => {
const authz = { identifier: { value: 'test.example.com' } };
const [key, cert] = await crypto.createAlpnCertificate(authz, 'abc123');
assert.isTrue(Buffer.isBuffer(key));
assert.isTrue(Buffer.isBuffer(cert));
});
/**
* PEM utils
*/
it('should get pem body as b64u', () => {
[testPemKey, testCert, testSanCert].forEach((pem) => {
const body = crypto.getPemBodyAsB64u(pem);
assert.isString(body);
assert.notInclude(body, '\r');
assert.notInclude(body, '\n');
assert.notInclude(body, '\r\n');
});
});
it('should get pem body as b64u from string', () => {
[testPemKey, testCert, testSanCert].forEach((pem) => {
const body = crypto.getPemBodyAsB64u(pem.toString());
assert.isString(body);
assert.notInclude(body, '\r');
assert.notInclude(body, '\n');
assert.notInclude(body, '\r\n');
});
});
it('should split pem chain', () => {
[testPemKey, testCert, testSanCert].forEach((pem) => {
const chain = crypto.splitPemChain(pem);
assert.isArray(chain);
assert.isNotEmpty(chain);
chain.forEach((c) => assert.isString(c));
});
});
it('should split pem chain from string', () => {
[testPemKey, testCert, testSanCert].forEach((pem) => {
const chain = crypto.splitPemChain(pem.toString());
assert.isArray(chain);
assert.isNotEmpty(chain);
chain.forEach((c) => assert.isString(c));
});
});
it('should split pem chain with empty bodies', () => {
const c1 = crypto.splitPemChain(emptyBodyChain1);
const c2 = crypto.splitPemChain(emptyBodyChain2);
assert.strictEqual(c1.length, 3);
assert.strictEqual(c2.length, 3);
});
});
});

View File

@@ -0,0 +1,569 @@
/**
* ACME client tests
*/
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai');
const cts = require('./challtestsrv');
const getCertIssuers = require('./get-cert-issuers');
const spec = require('./spec');
const acme = require('./../');
const domainName = process.env.ACME_DOMAIN_NAME || 'example.com';
const directoryUrl = process.env.ACME_DIRECTORY_URL || acme.directory.letsencrypt.staging;
const capEabEnabled = (('ACME_CAP_EAB_ENABLED' in process.env) && (process.env.ACME_CAP_EAB_ENABLED === '1'));
const capMetaTosField = !(('ACME_CAP_META_TOS_FIELD' in process.env) && (process.env.ACME_CAP_META_TOS_FIELD === '0'));
const capUpdateAccountKey = !(('ACME_CAP_UPDATE_ACCOUNT_KEY' in process.env) && (process.env.ACME_CAP_UPDATE_ACCOUNT_KEY === '0'));
const capAlternateCertRoots = !(('ACME_CAP_ALTERNATE_CERT_ROOTS' in process.env) && (process.env.ACME_CAP_ALTERNATE_CERT_ROOTS === '0'));
const clientOpts = {
directoryUrl,
backoffAttempts: 5,
backoffMin: 1000,
backoffMax: 5000,
};
if (capEabEnabled && process.env.ACME_EAB_KID && process.env.ACME_EAB_HMAC_KEY) {
clientOpts.externalAccountBinding = {
kid: process.env.ACME_EAB_KID,
hmacKey: process.env.ACME_EAB_HMAC_KEY,
};
}
describe('client', () => {
const testDomain = `${uuid()}.${domainName}`;
const testDomainAlpn = `${uuid()}.${domainName}`;
const testDomainWildcard = `*.${testDomain}`;
const testContact = `mailto:test-${uuid()}@nope.com`;
/**
* Pebble CTS required
*/
before(function () {
if (!cts.isEnabled()) {
this.skip();
}
});
/**
* Key types
*/
Object.entries({
rsa: {
createKeyFn: () => acme.crypto.createPrivateRsaKey(),
createKeyAltFns: {
s1024: () => acme.crypto.createPrivateRsaKey(1024),
s4096: () => acme.crypto.createPrivateRsaKey(4096),
},
jwkSpecFn: spec.jwk.rsa,
},
ecdsa: {
createKeyFn: () => acme.crypto.createPrivateEcdsaKey(),
createKeyAltFns: {
p384: () => acme.crypto.createPrivateEcdsaKey('P-384'),
p521: () => acme.crypto.createPrivateEcdsaKey('P-521'),
},
jwkSpecFn: spec.jwk.ecdsa,
},
}).forEach(([name, { createKeyFn, createKeyAltFns, jwkSpecFn }]) => {
describe(name, () => {
let testIssuers;
let testAccountKey;
let testAccountSecondaryKey;
let testClient;
let testAccount;
let testAccountUrl;
let testOrder;
let testOrderAlpn;
let testOrderWildcard;
let testAuthz;
let testAuthzAlpn;
let testAuthzWildcard;
let testChallenge;
let testChallengeAlpn;
let testChallengeWildcard;
let testKeyAuthorization;
let testKeyAuthorizationAlpn;
let testKeyAuthorizationWildcard;
let testCsr;
let testCsrAlpn;
let testCsrWildcard;
let testCertificate;
let testCertificateAlpn;
let testCertificateWildcard;
/**
* Fixtures
*/
it('should generate a private key', async () => {
testAccountKey = await createKeyFn();
assert.isTrue(Buffer.isBuffer(testAccountKey));
});
it('should create a second private key', async () => {
testAccountSecondaryKey = await createKeyFn();
assert.isTrue(Buffer.isBuffer(testAccountSecondaryKey));
});
it('should generate certificate signing request', async () => {
[, testCsr] = await acme.crypto.createCsr({ commonName: testDomain }, await createKeyFn());
[, testCsrAlpn] = await acme.crypto.createCsr({ altNames: [testDomainAlpn] }, await createKeyFn());
[, testCsrWildcard] = await acme.crypto.createCsr({ altNames: [testDomainWildcard] }, await createKeyFn());
});
it('should resolve certificate issuers [ACME_CAP_ALTERNATE_CERT_ROOTS]', async function () {
if (!capAlternateCertRoots) {
this.skip();
}
testIssuers = await getCertIssuers();
assert.isArray(testIssuers);
assert.isTrue(testIssuers.length > 1);
testIssuers.forEach((i) => {
assert.isString(i);
assert.strictEqual(1, testIssuers.filter((c) => (c === i)).length);
});
});
/**
* Initialize clients
*/
it('should initialize client', () => {
testClient = new acme.Client({
...clientOpts,
accountKey: testAccountKey,
});
});
it('should produce a valid jwk', () => {
const jwk = testClient.http.getJwk();
jwkSpecFn(jwk);
});
/**
* Terms of Service
*/
it('should produce tos url [ACME_CAP_META_TOS_FIELD]', async function () {
if (!capMetaTosField) {
this.skip();
}
const tos = await testClient.getTermsOfServiceUrl();
assert.isString(tos);
});
it('should not produce tos url [!ACME_CAP_META_TOS_FIELD]', async function () {
if (capMetaTosField) {
this.skip();
}
const tos = await testClient.getTermsOfServiceUrl();
assert.isNull(tos);
});
/**
* Create account
*/
it('should refuse account creation without tos [ACME_CAP_META_TOS_FIELD]', async function () {
if (!capMetaTosField) {
this.skip();
}
await assert.isRejected(testClient.createAccount());
});
it('should refuse account creation without eab [ACME_CAP_EAB_ENABLED]', async function () {
if (!capEabEnabled) {
this.skip();
}
const client = new acme.Client({
...clientOpts,
accountKey: testAccountKey,
externalAccountBinding: null,
});
await assert.isRejected(client.createAccount({
termsOfServiceAgreed: true,
}));
});
it('should create an account', async () => {
testAccount = await testClient.createAccount({
termsOfServiceAgreed: true,
});
spec.rfc8555.account(testAccount);
assert.strictEqual(testAccount.status, 'valid');
});
it('should produce an account url', () => {
testAccountUrl = testClient.getAccountUrl();
assert.isString(testAccountUrl);
});
/**
* Create account with alternate key sizes
*/
Object.entries(createKeyAltFns).forEach(([k, altKeyFn]) => {
it(`should create account with key=${k}`, async () => {
const client = new acme.Client({
...clientOpts,
accountKey: await altKeyFn(),
});
const account = await client.createAccount({
termsOfServiceAgreed: true,
});
spec.rfc8555.account(account);
assert.strictEqual(account.status, 'valid');
});
});
/**
* Find existing account using secondary client
*/
it('should throw when trying to find account using invalid account key', async () => {
const client = new acme.Client({
...clientOpts,
accountKey: testAccountSecondaryKey,
});
await assert.isRejected(client.createAccount({
onlyReturnExisting: true,
}));
});
it('should find existing account using account key', async () => {
const client = new acme.Client({
...clientOpts,
accountKey: testAccountKey,
});
const account = await client.createAccount({
onlyReturnExisting: true,
});
spec.rfc8555.account(account);
assert.strictEqual(account.status, 'valid');
assert.deepStrictEqual(account.key, testAccount.key);
});
/**
* Account URL
*/
it('should refuse invalid account url', async () => {
const client = new acme.Client({
...clientOpts,
accountKey: testAccountKey,
accountUrl: 'https://acme-staging-v02.api.letsencrypt.org/acme/acct/1',
});
await assert.isRejected(client.updateAccount());
});
it('should find existing account using account url', async () => {
const client = new acme.Client({
...clientOpts,
accountKey: testAccountKey,
accountUrl: testAccountUrl,
});
const account = await client.createAccount({
onlyReturnExisting: true,
});
spec.rfc8555.account(account);
assert.strictEqual(account.status, 'valid');
assert.deepStrictEqual(account.key, testAccount.key);
});
/**
* Update account contact info
*/
it('should update account contact info', async () => {
const data = { contact: [testContact] };
const account = await testClient.updateAccount(data);
spec.rfc8555.account(account);
assert.strictEqual(account.status, 'valid');
assert.deepStrictEqual(account.key, testAccount.key);
assert.isArray(account.contact);
assert.include(account.contact, testContact);
});
/**
* Change account private key
*/
it('should change account private key [ACME_CAP_UPDATE_ACCOUNT_KEY]', async function () {
if (!capUpdateAccountKey) {
this.skip();
}
await testClient.updateAccountKey(testAccountSecondaryKey);
const account = await testClient.createAccount({
onlyReturnExisting: true,
});
spec.rfc8555.account(account);
assert.strictEqual(account.status, 'valid');
assert.notDeepEqual(account.key, testAccount.key);
});
/**
* Create new certificate order
*/
it('should create new order', async () => {
const data1 = { identifiers: [{ type: 'dns', value: testDomain }] };
const data2 = { identifiers: [{ type: 'dns', value: testDomainAlpn }] };
const data3 = { identifiers: [{ type: 'dns', value: testDomainWildcard }] };
testOrder = await testClient.createOrder(data1);
testOrderAlpn = await testClient.createOrder(data2);
testOrderWildcard = await testClient.createOrder(data3);
[testOrder, testOrderAlpn, testOrderWildcard].forEach((item) => {
spec.rfc8555.order(item);
assert.strictEqual(item.status, 'pending');
});
});
/**
* Get status of existing certificate order
*/
it('should get existing order', async () => {
await Promise.all([testOrder, testOrderAlpn, testOrderWildcard].map(async (existing) => {
const result = await testClient.getOrder(existing);
spec.rfc8555.order(result);
assert.deepStrictEqual(existing, result);
}));
});
/**
* Get identifier authorization
*/
it('should get identifier authorization', async () => {
const orderAuthzCollection = await testClient.getAuthorizations(testOrder);
const alpnAuthzCollection = await testClient.getAuthorizations(testOrderAlpn);
const wildcardAuthzCollection = await testClient.getAuthorizations(testOrderWildcard);
[orderAuthzCollection, alpnAuthzCollection, wildcardAuthzCollection].forEach((collection) => {
assert.isArray(collection);
assert.isNotEmpty(collection);
collection.forEach((authz) => {
spec.rfc8555.authorization(authz);
assert.strictEqual(authz.status, 'pending');
});
});
testAuthz = orderAuthzCollection.pop();
testAuthzAlpn = alpnAuthzCollection.pop();
testAuthzWildcard = wildcardAuthzCollection.pop();
testAuthz.challenges.concat(testAuthzAlpn.challenges).concat(testAuthzWildcard.challenges).forEach((item) => {
spec.rfc8555.challenge(item);
assert.strictEqual(item.status, 'pending');
});
});
/**
* Generate challenge key authorization
*/
it('should get challenge key authorization', async () => {
testChallenge = testAuthz.challenges.find((c) => (c.type === 'http-01'));
testChallengeAlpn = testAuthzAlpn.challenges.find((c) => (c.type === 'tls-alpn-01'));
testChallengeWildcard = testAuthzWildcard.challenges.find((c) => (c.type === 'dns-01'));
testKeyAuthorization = await testClient.getChallengeKeyAuthorization(testChallenge);
testKeyAuthorizationAlpn = await testClient.getChallengeKeyAuthorization(testChallengeAlpn);
testKeyAuthorizationWildcard = await testClient.getChallengeKeyAuthorization(testChallengeWildcard);
[testKeyAuthorization, testKeyAuthorizationAlpn, testKeyAuthorizationWildcard].forEach((k) => assert.isString(k));
});
/**
* Deactivate identifier authorization
*/
it('should deactivate identifier authorization', async () => {
const order = await testClient.createOrder({
identifiers: [
{ type: 'dns', value: `${uuid()}.${domainName}` },
{ type: 'dns', value: `${uuid()}.${domainName}` },
],
});
const authzCollection = await testClient.getAuthorizations(order);
const results = await Promise.all(authzCollection.map(async (authz) => {
spec.rfc8555.authorization(authz);
assert.strictEqual(authz.status, 'pending');
return testClient.deactivateAuthorization(authz);
}));
results.forEach((authz) => {
spec.rfc8555.authorization(authz);
assert.strictEqual(authz.status, 'deactivated');
});
});
/**
* Verify satisfied challenge
*/
it('should verify challenge', async () => {
await cts.assertHttpChallengeCreateFn(testAuthz, testChallenge, testKeyAuthorization);
await cts.assertTlsAlpnChallengeCreateFn(testAuthzAlpn, testChallengeAlpn, testKeyAuthorizationAlpn);
await cts.assertDnsChallengeCreateFn(testAuthzWildcard, testChallengeWildcard, testKeyAuthorizationWildcard);
await testClient.verifyChallenge(testAuthz, testChallenge);
await testClient.verifyChallenge(testAuthzAlpn, testChallengeAlpn);
await testClient.verifyChallenge(testAuthzWildcard, testChallengeWildcard);
});
/**
* Complete challenge
*/
it('should complete challenge', async () => {
await Promise.all([testChallenge, testChallengeAlpn, testChallengeWildcard].map(async (challenge) => {
const result = await testClient.completeChallenge(challenge);
spec.rfc8555.challenge(result);
assert.strictEqual(challenge.url, result.url);
}));
});
/**
* Wait for valid challenge
*/
it('should wait for valid challenge status', async () => {
await Promise.all([testChallenge, testChallengeAlpn, testChallengeWildcard].map(async (c) => testClient.waitForValidStatus(c)));
});
/**
* Finalize order
*/
it('should finalize order', async () => {
const finalize = await testClient.finalizeOrder(testOrder, testCsr);
const finalizeAlpn = await testClient.finalizeOrder(testOrderAlpn, testCsrAlpn);
const finalizeWildcard = await testClient.finalizeOrder(testOrderWildcard, testCsrWildcard);
[finalize, finalizeAlpn, finalizeWildcard].forEach((f) => spec.rfc8555.order(f));
assert.strictEqual(testOrder.url, finalize.url);
assert.strictEqual(testOrderAlpn.url, finalizeAlpn.url);
assert.strictEqual(testOrderWildcard.url, finalizeWildcard.url);
});
/**
* Wait for valid order
*/
it('should wait for valid order status', async () => {
await Promise.all([testOrder, testOrderAlpn, testOrderWildcard].map(async (o) => testClient.waitForValidStatus(o)));
});
/**
* Get certificate
*/
it('should get certificate', async () => {
testCertificate = await testClient.getCertificate(testOrder);
testCertificateAlpn = await testClient.getCertificate(testOrderAlpn);
testCertificateWildcard = await testClient.getCertificate(testOrderWildcard);
[testCertificate, testCertificateAlpn, testCertificateWildcard].forEach((cert) => {
assert.isString(cert);
acme.crypto.readCertificateInfo(cert);
});
});
it('should get alternate certificate chain [ACME_CAP_ALTERNATE_CERT_ROOTS]', async function () {
if (!capAlternateCertRoots) {
this.skip();
}
await Promise.all(testIssuers.map(async (issuer) => {
const cert = await testClient.getCertificate(testOrder, issuer);
const rootCert = acme.crypto.splitPemChain(cert).pop();
const info = acme.crypto.readCertificateInfo(rootCert);
assert.strictEqual(issuer, info.issuer.commonName);
}));
});
it('should get default chain with invalid preference [ACME_CAP_ALTERNATE_CERT_ROOTS]', async function () {
if (!capAlternateCertRoots) {
this.skip();
}
const cert = await testClient.getCertificate(testOrder, uuid());
const rootCert = acme.crypto.splitPemChain(cert).pop();
const info = acme.crypto.readCertificateInfo(rootCert);
assert.strictEqual(testIssuers[0], info.issuer.commonName);
});
/**
* Revoke certificate
*/
it('should revoke certificate', async () => {
await testClient.revokeCertificate(testCertificate);
await testClient.revokeCertificate(testCertificateAlpn, { reason: 0 });
await testClient.revokeCertificate(testCertificateWildcard, { reason: 4 });
});
it('should not allow getting revoked certificate', async () => {
await assert.isRejected(testClient.getCertificate(testOrder));
await assert.isRejected(testClient.getCertificate(testOrderAlpn));
await assert.isRejected(testClient.getCertificate(testOrderWildcard));
});
/**
* Deactivate account
*/
it('should deactivate account', async () => {
const data = { status: 'deactivated' };
const account = await testClient.updateAccount(data);
spec.rfc8555.account(account);
assert.strictEqual(account.status, 'deactivated');
});
/**
* Verify that no new orders can be made
*/
it('should not allow new orders from deactivated account', async () => {
const data = { identifiers: [{ type: 'dns', value: 'nope.com' }] };
await assert.isRejected(testClient.createOrder(data));
});
});
});
});

View File

@@ -0,0 +1,438 @@
/**
* ACME client.auto tests
*/
const { randomUUID: uuid } = require('crypto');
const { assert } = require('chai');
const cts = require('./challtestsrv');
const getCertIssuers = require('./get-cert-issuers');
const spec = require('./spec');
const acme = require('./../');
const domainName = process.env.ACME_DOMAIN_NAME || 'example.com';
const directoryUrl = process.env.ACME_DIRECTORY_URL || acme.directory.letsencrypt.staging;
const capEabEnabled = (('ACME_CAP_EAB_ENABLED' in process.env) && (process.env.ACME_CAP_EAB_ENABLED === '1'));
const capAlternateCertRoots = !(('ACME_CAP_ALTERNATE_CERT_ROOTS' in process.env) && (process.env.ACME_CAP_ALTERNATE_CERT_ROOTS === '0'));
const clientOpts = {
directoryUrl,
backoffAttempts: 5,
backoffMin: 1000,
backoffMax: 5000,
};
if (capEabEnabled && process.env.ACME_EAB_KID && process.env.ACME_EAB_HMAC_KEY) {
clientOpts.externalAccountBinding = {
kid: process.env.ACME_EAB_KID,
hmacKey: process.env.ACME_EAB_HMAC_KEY,
};
}
describe('client.auto', () => {
const testDomain = `${uuid()}.${domainName}`;
const testHttpDomain = `${uuid()}.${domainName}`;
const testHttpsDomain = `${uuid()}.${domainName}`;
const testDnsDomain = `${uuid()}.${domainName}`;
const testAlpnDomain = `${uuid()}.${domainName}`;
const testWildcardDomain = `${uuid()}.${domainName}`;
const testSanDomains = [
`${uuid()}.${domainName}`,
`${uuid()}.${domainName}`,
`${uuid()}.${domainName}`,
];
/**
* Pebble CTS required
*/
before(function () {
if (!cts.isEnabled()) {
this.skip();
}
});
/**
* Key types
*/
Object.entries({
rsa: {
createKeyFn: () => acme.crypto.createPrivateRsaKey(),
createKeyAltFns: {
s1024: () => acme.crypto.createPrivateRsaKey(1024),
s4096: () => acme.crypto.createPrivateRsaKey(4096),
},
},
ecdsa: {
createKeyFn: () => acme.crypto.createPrivateEcdsaKey(),
createKeyAltFns: {
p384: () => acme.crypto.createPrivateEcdsaKey('P-384'),
p521: () => acme.crypto.createPrivateEcdsaKey('P-521'),
},
},
}).forEach(([name, { createKeyFn, createKeyAltFns }]) => {
describe(name, () => {
let testIssuers;
let testClient;
let testCertificate;
let testSanCertificate;
let testWildcardCertificate;
/**
* Fixtures
*/
it('should resolve certificate issuers [ACME_CAP_ALTERNATE_CERT_ROOTS]', async function () {
if (!capAlternateCertRoots) {
this.skip();
}
testIssuers = await getCertIssuers();
assert.isArray(testIssuers);
assert.isTrue(testIssuers.length > 1);
testIssuers.forEach((i) => {
assert.isString(i);
assert.strictEqual(1, testIssuers.filter((c) => (c === i)).length);
});
});
/**
* Initialize client
*/
it('should initialize client', async () => {
testClient = new acme.Client({
...clientOpts,
accountKey: await createKeyFn(),
});
});
/**
* Invalid challenge response
*/
it('should throw on invalid challenge response', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: `${uuid()}.${domainName}`,
}, await createKeyFn());
await assert.isRejected(testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.challengeNoopFn,
challengeRemoveFn: cts.challengeNoopFn,
}), /^authorization not found/i);
});
it('should throw on invalid challenge response with opts.skipChallengeVerification=true', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: `${uuid()}.${domainName}`,
}, await createKeyFn());
await assert.isRejected(testClient.auto({
csr,
termsOfServiceAgreed: true,
skipChallengeVerification: true,
challengeCreateFn: cts.challengeNoopFn,
challengeRemoveFn: cts.challengeNoopFn,
}));
});
/**
* Challenge function exceptions
*/
it('should throw on challengeCreate exception', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: `${uuid()}.${domainName}`,
}, await createKeyFn());
await assert.isRejected(testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.challengeThrowFn,
challengeRemoveFn: cts.challengeNoopFn,
}), /^oops$/);
});
it('should not throw on challengeRemove exception', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: `${uuid()}.${domainName}`,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.challengeCreateFn,
challengeRemoveFn: cts.challengeThrowFn,
});
assert.isString(cert);
});
it('should settle all challenges before rejecting', async () => {
const results = [];
const [, csr] = await acme.crypto.createCsr({
commonName: `${uuid()}.${domainName}`,
altNames: [
`${uuid()}.${domainName}`,
`${uuid()}.${domainName}`,
`${uuid()}.${domainName}`,
`${uuid()}.${domainName}`,
],
}, await createKeyFn());
await assert.isRejected(testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: async (...args) => {
if ([0, 1, 2].includes(results.length)) {
results.push(false);
throw new Error('oops');
}
await new Promise((resolve) => { setTimeout(resolve, 500); });
results.push(true);
return cts.challengeCreateFn(...args);
},
challengeRemoveFn: cts.challengeRemoveFn,
}));
assert.strictEqual(results.length, 5);
assert.deepStrictEqual(results, [false, false, false, true, true]);
});
/**
* Order certificates
*/
it('should order certificate', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: testDomain,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.challengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
});
assert.isString(cert);
testCertificate = cert;
});
it('should order certificate using http-01', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: testHttpDomain,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.assertHttpChallengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
challengePriority: ['http-01'],
});
assert.isString(cert);
});
it('should order certificate using https-01', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: testHttpsDomain,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.assertHttpsChallengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
challengePriority: ['http-01'],
});
assert.isString(cert);
});
it('should order certificate using dns-01', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: testDnsDomain,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.assertDnsChallengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
challengePriority: ['dns-01'],
});
assert.isString(cert);
});
it('should order certificate using tls-alpn-01', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: testAlpnDomain,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.assertTlsAlpnChallengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
challengePriority: ['tls-alpn-01'],
});
assert.isString(cert);
});
it('should order san certificate', async () => {
const [, csr] = await acme.crypto.createCsr({
altNames: testSanDomains,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.challengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
});
assert.isString(cert);
testSanCertificate = cert;
});
it('should order wildcard certificate', async () => {
const [, csr] = await acme.crypto.createCsr({
altNames: [testWildcardDomain, `*.${testWildcardDomain}`],
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.challengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
});
assert.isString(cert);
testWildcardCertificate = cert;
});
it('should order certificate with opts.skipChallengeVerification=true', async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: `${uuid()}.${domainName}`,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
skipChallengeVerification: true,
challengeCreateFn: cts.challengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
});
assert.isString(cert);
});
it('should order alternate certificate chain [ACME_CAP_ALTERNATE_CERT_ROOTS]', async function () {
if (!capAlternateCertRoots) {
this.skip();
}
await Promise.all(testIssuers.map(async (issuer) => {
const [, csr] = await acme.crypto.createCsr({
commonName: `${uuid()}.${domainName}`,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
preferredChain: issuer,
challengeCreateFn: cts.challengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
});
const rootCert = acme.crypto.splitPemChain(cert).pop();
const info = acme.crypto.readCertificateInfo(rootCert);
assert.strictEqual(issuer, info.issuer.commonName);
}));
});
it('should get default chain with invalid preference [ACME_CAP_ALTERNATE_CERT_ROOTS]', async function () {
if (!capAlternateCertRoots) {
this.skip();
}
const [, csr] = await acme.crypto.createCsr({
commonName: `${uuid()}.${domainName}`,
}, await createKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
preferredChain: uuid(),
challengeCreateFn: cts.challengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
});
const rootCert = acme.crypto.splitPemChain(cert).pop();
const info = acme.crypto.readCertificateInfo(rootCert);
assert.strictEqual(testIssuers[0], info.issuer.commonName);
});
/**
* Order certificate with alternate key sizes
*/
Object.entries(createKeyAltFns).forEach(([k, altKeyFn]) => {
it(`should order certificate with key=${k}`, async () => {
const [, csr] = await acme.crypto.createCsr({
commonName: testDomain,
}, await altKeyFn());
const cert = await testClient.auto({
csr,
termsOfServiceAgreed: true,
challengeCreateFn: cts.challengeCreateFn,
challengeRemoveFn: cts.challengeRemoveFn,
});
assert.isString(cert);
});
});
/**
* Read certificates
*/
it('should read certificate info', () => {
const info = acme.crypto.readCertificateInfo(testCertificate);
spec.crypto.certificateInfo(info);
assert.isNull(info.domains.commonName);
assert.deepStrictEqual(info.domains.altNames, [testDomain]);
});
it('should read san certificate info', () => {
const info = acme.crypto.readCertificateInfo(testSanCertificate);
spec.crypto.certificateInfo(info);
assert.isNull(info.domains.commonName);
assert.deepStrictEqual(info.domains.altNames, testSanDomains);
});
it('should read wildcard certificate info', () => {
const info = acme.crypto.readCertificateInfo(testWildcardCertificate);
spec.crypto.certificateInfo(info);
assert.isNull(info.domains.commonName);
assert.deepStrictEqual(info.domains.altNames, [testWildcardDomain, `*.${testWildcardDomain}`]);
});
});
});
});

View File

@@ -0,0 +1,119 @@
/**
* Pebble Challenge Test Server integration
*/
const { assert } = require('chai');
const axios = require('./../src/axios');
const apiBaseUrl = process.env.ACME_CHALLTESTSRV_URL || null;
const httpsPort = axios.defaults.acmeSettings.httpsChallengePort || 443;
/**
* Send request
*/
async function request(apiPath, data = {}) {
if (!apiBaseUrl) {
throw new Error('No Pebble Challenge Test Server URL found');
}
await axios.request({
url: `${apiBaseUrl}/${apiPath}`,
method: 'post',
data,
});
return true;
}
/**
* State
*/
exports.isEnabled = () => !!apiBaseUrl;
/**
* DNS
*/
exports.addDnsARecord = async (host, addresses) => request('add-a', { host, addresses });
exports.setDnsCnameRecord = async (host, target) => request('set-cname', { host, target });
/**
* Challenge response
*/
async function addHttp01ChallengeResponse(token, content) {
return request('add-http01', { token, content });
}
async function addHttps01ChallengeResponse(token, content, targetHostname) {
await addHttp01ChallengeResponse(token, content);
return request('add-redirect', {
path: `/.well-known/acme-challenge/${token}`,
targetURL: `https://${targetHostname}:${httpsPort}/.well-known/acme-challenge/${token}`,
});
}
async function addDns01ChallengeResponse(host, value) {
return request('set-txt', { host, value });
}
async function addTlsAlpn01ChallengeResponse(host, content) {
return request('add-tlsalpn01', { host, content });
}
exports.addHttp01ChallengeResponse = addHttp01ChallengeResponse;
exports.addHttps01ChallengeResponse = addHttps01ChallengeResponse;
exports.addDns01ChallengeResponse = addDns01ChallengeResponse;
exports.addTlsAlpn01ChallengeResponse = addTlsAlpn01ChallengeResponse;
/**
* Challenge response mock functions
*/
async function assertHttpChallengeCreateFn(authz, challenge, keyAuthorization) {
assert.strictEqual(challenge.type, 'http-01');
return addHttp01ChallengeResponse(challenge.token, keyAuthorization);
}
async function assertHttpsChallengeCreateFn(authz, challenge, keyAuthorization) {
assert.strictEqual(challenge.type, 'http-01');
return addHttps01ChallengeResponse(challenge.token, keyAuthorization, authz.identifier.value);
}
async function assertDnsChallengeCreateFn(authz, challenge, keyAuthorization) {
assert.strictEqual(challenge.type, 'dns-01');
return addDns01ChallengeResponse(`_acme-challenge.${authz.identifier.value}.`, keyAuthorization);
}
async function assertTlsAlpnChallengeCreateFn(authz, challenge, keyAuthorization) {
assert.strictEqual(challenge.type, 'tls-alpn-01');
return addTlsAlpn01ChallengeResponse(authz.identifier.value, keyAuthorization);
}
async function challengeCreateFn(authz, challenge, keyAuthorization) {
if (challenge.type === 'http-01') {
return assertHttpChallengeCreateFn(authz, challenge, keyAuthorization);
}
if (challenge.type === 'dns-01') {
return assertDnsChallengeCreateFn(authz, challenge, keyAuthorization);
}
if (challenge.type === 'tls-alpn-01') {
return assertTlsAlpnChallengeCreateFn(authz, challenge, keyAuthorization);
}
throw new Error(`Unsupported challenge type ${challenge.type}`);
}
exports.challengeRemoveFn = async () => true;
exports.challengeNoopFn = async () => true;
exports.challengeThrowFn = async () => { throw new Error('oops'); };
exports.assertHttpChallengeCreateFn = assertHttpChallengeCreateFn;
exports.assertHttpsChallengeCreateFn = assertHttpsChallengeCreateFn;
exports.assertDnsChallengeCreateFn = assertDnsChallengeCreateFn;
exports.assertTlsAlpnChallengeCreateFn = assertTlsAlpnChallengeCreateFn;
exports.challengeCreateFn = challengeCreateFn;

View File

@@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIFMjCCAxoCCQCVordquLnq8TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQGEwJB
VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0
cyBQdHkgTHRkMRQwEgYDVQQDEwtleGFtcGxlLmNvbTAeFw0xNzA5MTQxNDMzMTRa
Fw0xODA5MTQxNDMzMTRaMFsxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0
YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxFDASBgNVBAMT
C2V4YW1wbGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwi2P
YBNGl1n78niRGDKgcsWK03TcTeVbQ1HztA57Rr1iDHAZNx3Mv4E/Sha8VKbKoshc
mUcOS3AlmbIZX+7+9c7lL2oD+vtUZF1YUR/69fWuO72wk6fKj/eofxH9Ud5KFje8
qrYZdJWKkPMdWlYgjD6qpA5wl60NiuxmUr44ADZDytqHzNThN3wrFruz74PcMfak
cSUMxkh98LuNeGtqHpEAw+wliko3oDD4PanvDvp5mRgiQVKHEGT7dm85Up+W1iJK
J65fkc/j940MaLbdISZYYCT5dtPgCGKCHgVuVrY+OXFJrD3TTm94ILsR/BkS/VSK
NigGVPXg3q8tgIS++k13CzLUO0PNRMuod1RD9j5NEc2CVic9rcH06ugZyHlOcuVv
vRsPGd52BPn+Jf1aePKPPQHxT9i5GOs80CJw0eduZCDZB32biRYNwUtjFkHbu8ii
2IGkvhnWonjd4w5wOldG+RPr+XoFCIaHp5TszQ+HnUTLIXKtBgzzCKjK4eZqrck7
xpo5B5m5V7EUxBze2LYVky+GsDsqL8CggQqJL4ZKuZVoxgPwhnDy5nMs057NCU9E
nXcauMW9UEqEHu5NXnmGJrCvQ56wjYN3lgvCHEtmIpsRjCCWaBJYiawu1J5ZAf1y
GTVNh8pEvO//zL9ImUxrSfOGUeFiN1tzSFlTfbcCAwEAATANBgkqhkiG9w0BAQUF
AAOCAgEAdZZpgWv79CgF5ny6HmMaYgsXJKJyQE9RhJ1cmzDY8KAF+nzT7q4Pgt3W
bA9bpdji7C0WqKjX7hLipqhgFnqb8qZcodEKhX788qBj4X45+4nT6QipyJlz5x6K
cCn/v9gQNKks7U+dBlqquiVfbXaa1EAKMeGtqinf+Y51nR/fBcr/P9TBnSJqH61K
DO3qrE5KGTwHQ9VXoeKyeppGt5sYf8G0vwoHhtPTOO8TuLEIlFcXtzbC3zAtmQj6
Su//fI5yjuYTkiayxMx8nCGrQhQSXdC8gYpYd0os7UY01DVu4BTCXEvf0GYXtiGJ
eG8lQT/eu7WdK83uJ93U/BMYzoq4lSVcqY4LNxlfAQXKhaAbioA5XyT7co7FQ0g+
s2CGBUKa11wPDe8M2GVLPsxT2bXDQap5DQyVIuTwjtgL0tykGxPJPAnL2zuUy6T3
/YzrWaJ9Os+6mUCVdLnXtDgZ10Ujel7mq6wo9Ns+u07grXZkXpmJYnJXBrwOsY8K
Za5vFwgJrDXhWe+Fmgt1EP5VIqRCQAxH2iYvAaELi8udbN/ZiUU3K9t79MP/M3U/
tEWAubHXsaAv03jRy43X0VjlZHmagU/4dU7RBWfyuwRarYIXLNT2FCd2z4kd3fsL
3rB5iI+RH0uoNuOa1+UApfFCv0O65TYkp5jEWSlU8PhKYD43nXA=
-----END CERTIFICATE-----

Some files were not shown because too many files have changed in this diff Show More