Compare commits
823 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67934cdebd | ||
|
|
6765a48706 | ||
|
|
b4252033d5 | ||
|
|
f78ae93eed | ||
|
|
0227155ab4 | ||
|
|
330b84de33 | ||
|
|
f47f86b669 | ||
|
|
95eeb93822 | ||
|
|
367f807313 | ||
|
|
a954629ff9 | ||
|
|
3bbbc41062 | ||
|
|
bf63b0d73f | ||
|
|
5362df55f4 | ||
|
|
59897c4cea | ||
|
|
a9717b9a0d | ||
|
|
680941af11 | ||
|
|
1cf8d4e5e7 | ||
|
|
70ce6be0bf | ||
|
|
9187e87419 | ||
|
|
6ed1e18c7d | ||
|
|
8d27f07213 | ||
|
|
e4f4570b29 | ||
|
|
d86fc9569a | ||
|
|
fa7a983bcb | ||
|
|
9ac908ebee | ||
|
|
6e594ee66e | ||
|
|
c26d3e9c38 | ||
|
|
5db5607faa | ||
|
|
728f27e0a0 | ||
|
|
3d8f329e2d | ||
|
|
351fb70d5d | ||
|
|
b5cbeb9bde | ||
|
|
e7e89b8de7 | ||
|
|
225894d15c | ||
|
|
64ba485b0f | ||
|
|
3a666db36c | ||
|
|
ce7e5a2461 | ||
|
|
b22f94b079 | ||
|
|
3408465df6 | ||
|
|
e97dfb456b | ||
|
|
439c6c8b6c | ||
|
|
afa2b0307a | ||
|
|
56867fa777 | ||
|
|
9c2e33fa39 | ||
|
|
2ca72f838b | ||
|
|
37a9e6aae0 | ||
|
|
6a8a02dae5 | ||
|
|
eaee5db69e | ||
|
|
25d06904c6 | ||
|
|
fa14f87a80 | ||
|
|
4404f99642 | ||
|
|
bafab905b4 | ||
|
|
44d5e54550 | ||
|
|
a23c13d7d9 | ||
|
|
17a7a1432f | ||
|
|
26e8932b85 | ||
|
|
32beb02d40 | ||
|
|
af7177e6bb | ||
|
|
69ac0fd0a8 | ||
|
|
e0998f35e8 | ||
|
|
6d371b38c3 | ||
|
|
587f11138a | ||
|
|
aa936c279e | ||
|
|
5b11d351b2 | ||
|
|
b45b97d3c6 | ||
|
|
338eb3bdfe | ||
|
|
f059e91efc | ||
|
|
1cdf1c433f | ||
|
|
a7b8bac4c8 | ||
|
|
b7b5df0587 | ||
|
|
4060f6ecbc | ||
|
|
7cb5f21444 | ||
|
|
e5da46cfc3 | ||
|
|
eabb3e38b5 | ||
|
|
46140c8efa | ||
|
|
95d071ba56 | ||
|
|
3c9c3ca3b0 | ||
|
|
e7c4ade57d | ||
|
|
ca524657b6 | ||
|
|
bc02559bc7 | ||
|
|
741172fd98 | ||
|
|
83d0209775 | ||
|
|
6693d1acfb | ||
|
|
a2c43b50a6 | ||
|
|
f7fc06e657 | ||
|
|
b9fe3b9c87 | ||
|
|
06be993afc | ||
|
|
b6ef39fb30 | ||
|
|
0b131c00ed | ||
|
|
b6b8661c36 | ||
|
|
7bf19f8f6f | ||
|
|
c9d9c6513b | ||
|
|
4e7b7ae974 | ||
|
|
dfcabc02a4 | ||
|
|
6f2c5674c9 | ||
|
|
2877b9b505 | ||
|
|
e40bb9e14d | ||
|
|
d456ff9830 | ||
|
|
ffddb3b4ac | ||
|
|
a6113f237b | ||
|
|
093520b686 | ||
|
|
3a8d44b8e9 | ||
|
|
72bff652f7 | ||
|
|
9559bdf817 | ||
|
|
5a88b8c24e | ||
|
|
a9ebac82c7 | ||
|
|
cfd8836083 | ||
|
|
e01e59b188 | ||
|
|
d2fd729961 | ||
|
|
5d4ff2e3b7 | ||
|
|
6e5133f6b8 | ||
|
|
a96d5839b2 | ||
|
|
a827bc306a | ||
|
|
d8b3d7a6e0 | ||
|
|
b8f072909b | ||
|
|
fa48f2b2f0 | ||
|
|
019a1fe24e | ||
|
|
427620d34f | ||
|
|
a5a0c1f6e7 | ||
|
|
affef13037 | ||
|
|
4afbf20c1a | ||
|
|
0ef7b036dd | ||
|
|
17ef7b8b9e | ||
|
|
15eba52fad | ||
|
|
f2d894b036 | ||
|
|
d9da27710e | ||
|
|
981bff70c3 | ||
|
|
bb30d6e02f | ||
|
|
b09ccda54d | ||
|
|
a5de8d79ec | ||
|
|
a092a1e843 | ||
|
|
1c6740feff | ||
|
|
79c6e05e02 | ||
|
|
31e2085c16 | ||
|
|
64fda2f1a0 | ||
|
|
a674719a8b | ||
|
|
2f7ef0620b | ||
|
|
153e98b593 | ||
|
|
d62ea41671 | ||
|
|
8fcd9813d3 | ||
|
|
dcbf8c85dd | ||
|
|
ea0eafdb16 | ||
|
|
eda89a057a | ||
|
|
21e6eef1d3 | ||
|
|
54a27c1840 | ||
|
|
a3be0a1618 | ||
|
|
8e19e44f4c | ||
|
|
e5d93bd114 | ||
|
|
47fe3d5826 | ||
|
|
8409f5fd4a | ||
|
|
634a468ec4 | ||
|
|
7ed0544664 | ||
|
|
3d4a046634 | ||
|
|
96954b4aaa | ||
|
|
d77fc11552 | ||
|
|
5bad0bbde8 | ||
|
|
cd85ac611b | ||
|
|
0bc6d0a211 | ||
|
|
b1cd055342 | ||
|
|
303097b835 | ||
|
|
a438028002 | ||
|
|
4813872bcc | ||
|
|
3b19bfb429 | ||
|
|
a917a7bca6 | ||
|
|
86e64af35c | ||
|
|
bf6f1d8137 | ||
|
|
b1688525db | ||
|
|
2fd14430a2 | ||
|
|
bd3d959944 | ||
|
|
390e4853a5 | ||
|
|
485e603b51 | ||
|
|
3ccd7ad95d | ||
|
|
54d9050483 | ||
|
|
6d58c68e9b | ||
|
|
80019d4dc1 | ||
|
|
031df8fc35 | ||
|
|
62419a8212 | ||
|
|
09d93af853 | ||
|
|
b6ab178de9 | ||
|
|
5a08f27d2c | ||
|
|
fe91d94090 | ||
|
|
56ab3269d2 | ||
|
|
c8243c573f | ||
|
|
0b769a1c86 | ||
|
|
a8189a974d | ||
|
|
322875d241 | ||
|
|
ed8a54a2bc | ||
|
|
5ba9831ed1 | ||
|
|
f9c9fce581 | ||
|
|
bc650a32cd | ||
|
|
c6d3e3fe5b | ||
|
|
73acc62af1 | ||
|
|
0d4491f3a0 | ||
|
|
85248044ab | ||
|
|
c532449102 | ||
|
|
970c7fd8a0 | ||
|
|
4656019898 | ||
|
|
7eceabb2d8 | ||
|
|
eade2c2b68 | ||
|
|
6ec950818c | ||
|
|
7058b20df4 | ||
|
|
a09b0e48c1 | ||
|
|
664bb66a91 | ||
|
|
eba333de7a | ||
|
|
f47b35f6d5 | ||
|
|
c04707c0f7 | ||
|
|
22ebcd4dd1 | ||
|
|
d46dab4fdd | ||
|
|
d44849c53c | ||
|
|
dbc5a3c6b3 | ||
|
|
4a5fa767ed | ||
|
|
1b7debc6a4 | ||
|
|
19a6b94680 | ||
|
|
65a72b8d60 | ||
|
|
7f61cab101 | ||
|
|
692e2b5b96 | ||
|
|
37caef38ad | ||
|
|
9cc01db1d5 | ||
|
|
9172440f79 | ||
|
|
e0eb3a4413 | ||
|
|
ae0f16bf35 | ||
|
|
6c9ed162e3 | ||
|
|
3849b52cdf | ||
|
|
9ecfcb5814 | ||
|
|
54ad09f755 | ||
|
|
6ee4dc165b | ||
|
|
8e2eb89696 | ||
|
|
9d397cc8be | ||
|
|
cbfb0755b3 | ||
|
|
d8d127ee9d | ||
|
|
0ed5430e80 | ||
|
|
878c1f52fa | ||
|
|
586d23fc55 | ||
|
|
6900452b49 | ||
|
|
b97e0e512d | ||
|
|
f740ff517f | ||
|
|
e5989fe023 | ||
|
|
4323156fbe | ||
|
|
3c721901c5 | ||
|
|
5c2c50839a | ||
|
|
fd54c2ffac | ||
|
|
7e483e6091 | ||
|
|
80c48e9acd | ||
|
|
b98f1c0dd0 | ||
|
|
b53874a0b8 | ||
|
|
c4c9adb8bf | ||
|
|
eed265faf1 | ||
|
|
3dc6dd403d | ||
|
|
deb9ba0c43 | ||
|
|
fa33ff499d | ||
|
|
2ed4967744 | ||
|
|
ad360e81cb | ||
|
|
f95f5188b4 | ||
|
|
17d1efa395 | ||
|
|
732cbc5e92 | ||
|
|
5d2d0955b1 | ||
|
|
20feacea12 | ||
|
|
575bf2b73b | ||
|
|
934e6e2bd0 | ||
|
|
fbb9a47e8f | ||
|
|
368132daae | ||
|
|
3d54d04017 | ||
|
|
5b1494b3ce | ||
|
|
ebf2a820cc | ||
|
|
9caa4cd1d4 | ||
|
|
91fd80d44f | ||
|
|
f932e553b0 | ||
|
|
0dd4953197 | ||
|
|
aaea6aa1f3 | ||
|
|
ab4a0aea70 | ||
|
|
29f923537e | ||
|
|
24aa416740 | ||
|
|
08e517ff00 | ||
|
|
29f65389bd | ||
|
|
960a1964c7 | ||
|
|
760d54ba85 | ||
|
|
b1b21d3efc | ||
|
|
5acd7f6fb6 | ||
|
|
a31f1c7f5e | ||
|
|
660ae7333b | ||
|
|
6cf699b25f | ||
|
|
7e5dea51a5 | ||
|
|
92446c3399 | ||
|
|
d9eb927b0a | ||
|
|
39ad7597fa | ||
|
|
83d1bda56a | ||
|
|
20bc5aa6c7 | ||
|
|
162e10909b | ||
|
|
0f1ae6ccd9 | ||
|
|
dd730f6beb | ||
|
|
c9d5cda953 | ||
|
|
33fb1a6bf3 | ||
|
|
a1344245cd | ||
|
|
fe2ca6bed3 | ||
|
|
19a3c7874a | ||
|
|
83e40836eb | ||
|
|
4304c9443a | ||
|
|
b72f8e796c | ||
|
|
7c15f52368 | ||
|
|
adf569eb62 | ||
|
|
340801e743 | ||
|
|
80f96b5b26 | ||
|
|
6646ec888f | ||
|
|
e6cab51031 | ||
|
|
3449a4d6af | ||
|
|
588de02be6 | ||
|
|
422e011d31 | ||
|
|
56a1f8158a | ||
|
|
a3c375ede5 | ||
|
|
754e76d9b9 | ||
|
|
feb7bfc724 | ||
|
|
f84dc771c4 | ||
|
|
d8a52c0be3 | ||
|
|
b50739e064 | ||
|
|
f8e320e2bd | ||
|
|
bac74dc650 | ||
|
|
103f28f6ba | ||
|
|
72fb20abf3 | ||
|
|
d9efc3d4d8 | ||
|
|
836d18f07e | ||
|
|
485ae3514c | ||
|
|
2fa6489153 | ||
|
|
e02d9716f5 | ||
|
|
154409b1df | ||
|
|
98177a5b1e | ||
|
|
8d44171875 | ||
|
|
5b576112d1 | ||
|
|
e1b372c33b | ||
|
|
ce49dce8c6 | ||
|
|
09c9b42cab | ||
|
|
370a12e88a | ||
|
|
c2f1f5c549 | ||
|
|
090e03fac1 | ||
|
|
b745712791 | ||
|
|
7ee753ac85 | ||
|
|
eea6b8ab5d | ||
|
|
a135f5742c | ||
|
|
04adbb45d8 | ||
|
|
62efb22f37 | ||
|
|
5e98f05036 | ||
|
|
292a7ecbe3 | ||
|
|
4cea45bd87 | ||
|
|
7f0b075529 | ||
|
|
8c7ff5e0e8 | ||
|
|
afea5a1623 | ||
|
|
c60dd7f151 | ||
|
|
92f9371156 | ||
|
|
c5714ec6d9 | ||
|
|
dd16386317 | ||
|
|
7cf1f75eb9 | ||
|
|
cf28a00ccd | ||
|
|
9e48474f11 | ||
|
|
c327c0c995 | ||
|
|
bb567da8c6 | ||
|
|
960f61d158 | ||
|
|
80cd1bfc8e | ||
|
|
a6bf198604 | ||
|
|
7e8842b452 | ||
|
|
fc9e71bed2 | ||
|
|
3e3373b8c7 | ||
|
|
7d45db89bf | ||
|
|
08c1f338d5 | ||
|
|
18865f0931 | ||
|
|
d22a25d260 | ||
|
|
849c145926 | ||
|
|
36a773df0b | ||
|
|
b2abf1490b | ||
|
|
fd5aa63ef3 | ||
|
|
7e024cbcf7 | ||
|
|
7050ee2354 | ||
|
|
024e97d632 | ||
|
|
61479cd5fb | ||
|
|
aaa322464d | ||
|
|
02bfbd5019 | ||
|
|
282f8b4e02 | ||
|
|
3393bde820 | ||
|
|
2277c87908 | ||
|
|
2ea0c48853 | ||
|
|
28cbefde04 | ||
|
|
4e13843c78 | ||
|
|
a929f8429d | ||
|
|
40f3f06ed3 | ||
|
|
0a79c4c717 | ||
|
|
712d789992 | ||
|
|
8de8b1a32e | ||
|
|
c2f565c73a | ||
|
|
1df036a811 | ||
|
|
9910a4fc7b | ||
|
|
9933afc8b7 | ||
|
|
1d89d4b0bc | ||
|
|
a8a84d58d9 | ||
|
|
80fee524a8 | ||
|
|
4ca2ee52b7 | ||
|
|
6638be81a0 | ||
|
|
6ced0e5e43 | ||
|
|
e36518dbe5 | ||
|
|
70d8bb60e7 | ||
|
|
3c919f6b23 | ||
|
|
0cb566d2f3 | ||
|
|
e137b6baaa | ||
|
|
58faeea838 | ||
|
|
47200e9f35 | ||
|
|
5ad8cc668f | ||
|
|
e7704171f7 | ||
|
|
c43718652a | ||
|
|
461a12e909 | ||
|
|
afb682e3eb | ||
|
|
31384fbce5 | ||
|
|
c7cfd7a8a0 | ||
|
|
717e50fd5c | ||
|
|
2ffc7d19f1 | ||
|
|
d857021df5 | ||
|
|
2ee864ccaf | ||
|
|
018dfed128 | ||
|
|
90e4545210 | ||
|
|
4a4b16b010 | ||
|
|
8701303012 | ||
|
|
9788aefcc1 | ||
|
|
ed08ef1604 | ||
|
|
adce70a5e5 | ||
|
|
d5978f64e1 | ||
|
|
45215debcc | ||
|
|
919eef55a1 | ||
|
|
8c529eed46 | ||
|
|
7909c2cd46 | ||
|
|
b1ac396bf1 | ||
|
|
d5eb4a1900 | ||
|
|
b8eb27441c | ||
|
|
de1494710a | ||
|
|
e3b05ac77f | ||
|
|
32c8e9482c | ||
|
|
4d3c86dba1 | ||
|
|
28449c348e | ||
|
|
bb9cf7b93c | ||
|
|
eb861083ad | ||
|
|
b133505086 | ||
|
|
0f0cae713a | ||
|
|
56cfce86e4 | ||
|
|
e950322232 | ||
|
|
14de21ee64 | ||
|
|
22712eae96 | ||
|
|
86d1033324 | ||
|
|
b4c4dc2c2e | ||
|
|
671f0142bc | ||
|
|
ab4bdc7be6 | ||
|
|
0859e60b23 | ||
|
|
e69c2d8b0c | ||
|
|
186e058f3d | ||
|
|
ed5af59040 | ||
|
|
0da312f755 | ||
|
|
dc646d9a45 | ||
|
|
109e01bb60 | ||
|
|
657fad06fb | ||
|
|
3e014c876d | ||
|
|
d14dd51359 | ||
|
|
70f876c445 | ||
|
|
9d8d51d88d | ||
|
|
57037f20cc | ||
|
|
4f2f509819 | ||
|
|
474fd77970 | ||
|
|
d2fad719fa | ||
|
|
6a3955a1d6 | ||
|
|
dceb33006a | ||
|
|
a096a43c56 | ||
|
|
8114a33d20 | ||
|
|
9f3adddd41 | ||
|
|
05f74ab654 | ||
|
|
0317118cd9 | ||
|
|
461de8d269 | ||
|
|
b258e92620 | ||
|
|
f6148ef1fb | ||
|
|
457da594be | ||
|
|
891a43ae67 | ||
|
|
bc65c0a786 | ||
|
|
3eeb1f77aa | ||
|
|
91be6826b9 | ||
|
|
f87eee3b9f | ||
|
|
b4e17691c4 | ||
|
|
cce372aeba | ||
|
|
b5a8a9e08a | ||
|
|
35632da284 | ||
|
|
02a9b0d16c | ||
|
|
d1809e0f7d | ||
|
|
abb4a7c0f9 | ||
|
|
cd6fa8b15c | ||
|
|
ecfcada802 | ||
|
|
f8ec5ae253 | ||
|
|
832ba5c8fb | ||
|
|
6fda0d6896 | ||
|
|
a8edaf4dfa | ||
|
|
e11b7802c2 | ||
|
|
aa0c5972fb | ||
|
|
fa8e91cdcd | ||
|
|
e5d902663b | ||
|
|
042535536e | ||
|
|
6d3063437c | ||
|
|
3db4d04e4c | ||
|
|
96f9eab5cd | ||
|
|
1e641b83c1 | ||
|
|
3791d92d67 | ||
|
|
2bcab76f5a | ||
|
|
f5493c542b | ||
|
|
68eb4198f1 | ||
|
|
ef94607728 | ||
|
|
4ccadbd2be | ||
|
|
0643063b80 | ||
|
|
d6c6ab932a | ||
|
|
46004d2db8 | ||
|
|
620d1d4092 | ||
|
|
f30afac47e | ||
|
|
1779e34773 | ||
|
|
28f535f41c | ||
|
|
e921f58d2f | ||
|
|
301f6cc273 | ||
|
|
f04e497999 | ||
|
|
8db438d76b | ||
|
|
af75e607ec | ||
|
|
cd4b9527c3 | ||
|
|
ea8dc446ae | ||
|
|
ba6270990b | ||
|
|
df55f1066c | ||
|
|
b562d661db | ||
|
|
aede78a0ec | ||
|
|
7e8c3fbab7 | ||
|
|
6621601155 | ||
|
|
1fbd585a46 | ||
|
|
5a51c14de5 | ||
|
|
27a4c81c6d | ||
|
|
fdc25dc0d7 | ||
|
|
99522fb49a | ||
|
|
671d273e2f | ||
|
|
2851a33eb2 | ||
|
|
937e3fac19 | ||
|
|
47cb00857c | ||
|
|
7904e05b4a | ||
|
|
c4fe19f2e6 | ||
|
|
9db57f0517 | ||
|
|
64afebecd4 | ||
|
|
4c324960e6 | ||
|
|
164b90a22f | ||
|
|
dc735a8aa2 | ||
|
|
f516b0931f | ||
|
|
2297121eff | ||
|
|
0c2684d1cf | ||
|
|
4b4c5dba73 | ||
|
|
7b9d70e093 | ||
|
|
71a289b009 | ||
|
|
ddf98ff593 | ||
|
|
db8043ecb6 | ||
|
|
ea756cf0a4 | ||
|
|
8446a6d813 | ||
|
|
a18aaeacf7 | ||
|
|
58a43b3785 | ||
|
|
dd06f12582 | ||
|
|
d7dcc01c9f | ||
|
|
66f56740b7 | ||
|
|
5bd042d9bc | ||
|
|
60921d9adf | ||
|
|
3a668f1f8b | ||
|
|
609fe5f838 | ||
|
|
e29e528aa2 | ||
|
|
e06c9e07fe | ||
|
|
03ee28c380 | ||
|
|
7474235283 | ||
|
|
4eb6ae92d1 | ||
|
|
0eeba2783b | ||
|
|
8498fa75e3 | ||
|
|
5556bc3a4b | ||
|
|
998200e570 | ||
|
|
420b835b09 | ||
|
|
cc3534cf00 | ||
|
|
062a267a6f | ||
|
|
98ee7fcd8c | ||
|
|
e5ec9f4b62 | ||
|
|
b66bb21777 | ||
|
|
f7e026a132 | ||
|
|
c12e56823e | ||
|
|
042f8e9030 | ||
|
|
9308950550 | ||
|
|
a43c5b0824 | ||
|
|
ebdf9f4b5b | ||
|
|
511be1f3ae | ||
|
|
ceb0454277 | ||
|
|
c553b017af | ||
|
|
c553f63127 | ||
|
|
152cb9b23a | ||
|
|
5eff50e8fe | ||
|
|
cddf01ee68 | ||
|
|
d968c4bbb9 | ||
|
|
1a738403fc | ||
|
|
71428b0181 | ||
|
|
4b538bae97 | ||
|
|
a4bb4fd708 | ||
|
|
99bb7b70e0 | ||
|
|
443f6358c9 | ||
|
|
0bae4851c1 | ||
|
|
66710d33c6 | ||
|
|
73fe1422f3 | ||
|
|
47f3cf7ba5 | ||
|
|
d5ef57542a | ||
|
|
cc3531b9d5 | ||
|
|
95722f46f4 | ||
|
|
5950e1cae7 | ||
|
|
d176ab4886 | ||
|
|
cbccf1024b | ||
|
|
643148d283 | ||
|
|
ac15c8fc0e | ||
|
|
3751fcd4c9 | ||
|
|
02466ea0bd | ||
|
|
6f6606d76d | ||
|
|
59f22ab17e | ||
|
|
2db9343e0f | ||
|
|
36b3a53ab2 | ||
|
|
dc8c42a820 | ||
|
|
2bd5d0bd8e | ||
|
|
8c152371a1 | ||
|
|
f489c59ca3 | ||
|
|
d2897cefaa | ||
|
|
9747d40734 | ||
|
|
e123ec4089 | ||
|
|
f358a0f226 | ||
|
|
003ea9310b | ||
|
|
d602df4c70 | ||
|
|
c9ac5ae963 | ||
|
|
daa990ee96 | ||
|
|
49487419d2 | ||
|
|
0fca7dc3ce | ||
|
|
0a946f55ca | ||
|
|
508fe69cf8 | ||
|
|
3e4a8f230f | ||
|
|
a62230c195 | ||
|
|
1173fb1e90 | ||
|
|
529648a30c | ||
|
|
82b6b9ccb2 | ||
|
|
71244a4eb8 | ||
|
|
32fd424295 | ||
|
|
5746042d68 | ||
|
|
e76fb235aa | ||
|
|
47e13312b1 | ||
|
|
55e05afe0e | ||
|
|
aebce2f241 | ||
|
|
aa3207fca5 | ||
|
|
ce8df34b49 | ||
|
|
8aa8c5d8ae | ||
|
|
e7628bdbdd | ||
|
|
b9dd4a35db | ||
|
|
040b2e8a53 | ||
|
|
af25254628 | ||
|
|
0c673a54cd | ||
|
|
9f1f36774d | ||
|
|
6ec697b010 | ||
|
|
f344c58f26 | ||
|
|
263b0fa455 | ||
|
|
a634c8f2d1 | ||
|
|
336faa46b2 | ||
|
|
52a167c647 | ||
|
|
458756e895 | ||
|
|
76dd23174a | ||
|
|
0ad667b00a | ||
|
|
699ab168c1 | ||
|
|
5ccb4a6f08 | ||
|
|
2c10cedb34 | ||
|
|
3b357ef301 | ||
|
|
f686fb0d95 | ||
|
|
3f739daaea | ||
|
|
c9d415f9db | ||
|
|
51249c304c | ||
|
|
83f9a551e7 | ||
|
|
6c450d3249 | ||
|
|
8b828b3f34 | ||
|
|
146d106991 | ||
|
|
b15b2edcdf | ||
|
|
f08f765529 | ||
|
|
f64ea78c44 | ||
|
|
fbde7cbd93 | ||
|
|
d10e80bf83 | ||
|
|
a269d8374e | ||
|
|
49ea196160 | ||
|
|
ddb1bc87bb | ||
|
|
07a45b4530 | ||
|
|
dcd1023a39 | ||
|
|
52522f27e9 | ||
|
|
e4ec4e1404 | ||
|
|
717d203622 | ||
|
|
c23f6172b5 | ||
|
|
b04d4cb5c5 | ||
|
|
d66bc33761 | ||
|
|
f710c00c0d | ||
|
|
e68862b633 | ||
|
|
6094a4af79 | ||
|
|
146ac49703 | ||
|
|
909b75eb40 | ||
|
|
dcdb25d92d | ||
|
|
3dfdd3c31c | ||
|
|
25d5a99b3d | ||
|
|
e1466737e3 | ||
|
|
370a28c10e | ||
|
|
af919c2f6e | ||
|
|
dc3ab544c8 | ||
|
|
708bebe6e3 | ||
|
|
3722e922ff | ||
|
|
8b5d5a8bf9 | ||
|
|
038b1c9ca4 | ||
|
|
b10ff5b6ee | ||
|
|
6950d779e0 | ||
|
|
4c31db427a | ||
|
|
540981e071 | ||
|
|
ed8b9cd5e9 | ||
|
|
3dea83ce31 | ||
|
|
cfb46a7c2b | ||
|
|
dd2f44bfe9 | ||
|
|
09d0e79bcd | ||
|
|
a9c1ca5c97 | ||
|
|
1af6fb3a58 | ||
|
|
b7bde7b685 | ||
|
|
718028ca62 | ||
|
|
98b2863547 | ||
|
|
b1e60456cf | ||
|
|
a38004c1ed | ||
|
|
5a355b276e | ||
|
|
a52721bd7e | ||
|
|
6df399fe02 | ||
|
|
6d8ede9575 | ||
|
|
7145aa60ca | ||
|
|
b1181c0f9a | ||
|
|
bace2a7c25 | ||
|
|
a70b4373de | ||
|
|
b7c12e6d91 | ||
|
|
6a88dd476e | ||
|
|
5fbd774266 | ||
|
|
bdec010d2e | ||
|
|
05a00b7b78 | ||
|
|
eaf23c3034 | ||
|
|
276a8b35e5 | ||
|
|
466d659f6e | ||
|
|
84e26381b5 | ||
|
|
469b5a5f69 | ||
|
|
ad77ebd2f9 | ||
|
|
b75543c3bc | ||
|
|
0677275742 | ||
|
|
0c3724e0ad | ||
|
|
803083d23c | ||
|
|
f4f8067a12 | ||
|
|
caa9f084d6 | ||
|
|
81407b65d1 | ||
|
|
8a24293fd7 | ||
|
|
8f1886a585 | ||
|
|
0a64e5fa67 | ||
|
|
7a70603971 | ||
|
|
0d5e00e744 | ||
|
|
91ba1433af | ||
|
|
12e56d14f2 | ||
|
|
7326119f52 | ||
|
|
136983cf14 | ||
|
|
105a1b80ae | ||
|
|
b8000ca533 | ||
|
|
c3e374e6e5 | ||
|
|
a9b6e87249 | ||
|
|
61de5422bf | ||
|
|
f96697f619 | ||
|
|
b4560d6370 | ||
|
|
a7bcde8d82 | ||
|
|
34bb4d54c2 | ||
|
|
e0116a1a03 | ||
|
|
12fec7939d | ||
|
|
ff8e02cceb | ||
|
|
8122bed97f | ||
|
|
991c3dbb76 | ||
|
|
399c23623d | ||
|
|
2232f21b48 | ||
|
|
e41c084381 | ||
|
|
520b27e0dc | ||
|
|
ace7e0247a | ||
|
|
9ae414b1c6 | ||
|
|
cb8c8186f1 | ||
|
|
82f86d9556 | ||
|
|
cfb1034450 | ||
|
|
2a07442a85 | ||
|
|
68c1eff81d | ||
|
|
baec15dfc6 | ||
|
|
6eb9817296 | ||
|
|
b9d5d33aaa | ||
|
|
560519894c | ||
|
|
9f434b0968 | ||
|
|
07066dde87 | ||
|
|
074c8f7cd0 | ||
|
|
e9df2355f4 | ||
|
|
45547d6f94 | ||
|
|
4a421d5b14 | ||
|
|
7b9825eb40 | ||
|
|
5cde165f0b | ||
|
|
305824ff1a | ||
|
|
86ddb72227 | ||
|
|
cca33478e4 | ||
|
|
a8f41d3c48 | ||
|
|
a25a15ca6e | ||
|
|
a39dac4dbd | ||
|
|
eab0c3be60 | ||
|
|
b4ee3d0dfc | ||
|
|
2f03e18c59 | ||
|
|
232cd7215e | ||
|
|
86b1e9959b | ||
|
|
fd130f86fd | ||
|
|
2669f509e1 | ||
|
|
d3619ad60f | ||
|
|
c26417d769 | ||
|
|
2942d39dfe | ||
|
|
df65b0509e | ||
|
|
fbde35483b | ||
|
|
7370f8b83b | ||
|
|
8b0ca1da2e | ||
|
|
466f2b1a02 | ||
|
|
f1d6cce88c | ||
|
|
ad7ababb4c | ||
|
|
72fa623674 | ||
|
|
e5d117c134 | ||
|
|
f8944a1331 | ||
|
|
e850855154 | ||
|
|
06eacee90c | ||
|
|
b1e100982e | ||
|
|
8f30158b00 | ||
|
|
576f7db978 | ||
|
|
137e043dfe |
21
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
> 感谢您支持certd,请按如下规范提交issue
|
||||
> 如果有条件,请尽量在[github上提交](https://github.com/certd/certd/issues)
|
||||
|
||||
|
||||
## 一、问题描述
|
||||
`请在此处简要描述你所遇到的问题,必要时请贴出相关截图辅助理解和定位`
|
||||
|
||||
### 复现步骤
|
||||
`请描述复现问题的详细步骤`
|
||||
`如果非示例页面的问题,最好能提供最小复现示例的代码、或者仓库链接`
|
||||
|
||||
|
||||
### 报错截图
|
||||
`请贴出报错日志截图`
|
||||
|
||||
### 效果截图
|
||||
`请贴出效果截图`
|
||||
#### 1. 期望效果
|
||||
|
||||
#### 2. 实际效果
|
||||
|
||||
69
.github/workflows/build-image.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
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
|
||||
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: Build and push
|
||||
uses: docker/build-push-action@v6.5.0
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
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}}
|
||||
55
.github/workflows/deploy-demo.yml
vendored
Normal 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
@@ -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
|
||||
|
||||
38
.gitignore
vendored
@@ -1,11 +1,41 @@
|
||||
./packages/core/lego
|
||||
# IntelliJ project files
|
||||
.vscode/
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
/.idea/
|
||||
*/**/dist
|
||||
*/**/pnpm-lock.yaml
|
||||
*/**/stats.html
|
||||
.idea
|
||||
*.iml
|
||||
out
|
||||
gen
|
||||
node_modules/
|
||||
/test/*.private.*
|
||||
/other/node-acme-client/.idea/
|
||||
|
||||
/*.log
|
||||
/other/certd-run
|
||||
/other/node-acme-client
|
||||
|
||||
/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
|
||||
|
||||
docker/image/workspace
|
||||
/packages/core/lego
|
||||
|
||||
tsconfig.tsbuildinfo
|
||||
test/**/*.js
|
||||
/packages/ui/certd-server/data/db.sqlite
|
||||
/packages/ui/certd-server/data/keys.yaml
|
||||
|
||||
2
.npmrc
Normal file
@@ -0,0 +1,2 @@
|
||||
link-workspace-packages=true
|
||||
prefer-workspace-packages=true
|
||||
7
.prettierrc
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"printWidth": 160,
|
||||
"bracketSpacing": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5",
|
||||
"arrowParens": "avoid"
|
||||
}
|
||||
290
CHANGELOG.md
Normal file
@@ -0,0 +1,290 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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
|
||||
661
LICENSE
Normal file
@@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
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.
|
||||
|
||||
Preamble
|
||||
|
||||
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 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/>.
|
||||
195
README.md
@@ -0,0 +1,195 @@
|
||||
# CertD
|
||||
|
||||
CertD 是一个免费全自动申请和自动部署更新SSL证书的工具。
|
||||
后缀D取自linux守护进程的命名风格,意为证书守护进程。
|
||||
|
||||
关键字:证书自动申请、证书自动更新、证书自动续期、证书自动续签
|
||||
|
||||
## 一、特性
|
||||
本项目不仅支持证书申请过程自动化,还可以自动化部署更新证书,让你的证书永不过期。
|
||||
|
||||
* 全自动申请证书(支持阿里云、腾讯云、华为云、Cloudflare等各种途径注册的域名)
|
||||
* 全自动部署更新证书(目前支持部署到主机、部署到阿里云、腾讯云等)
|
||||
* 支持通配符域名/泛域名,支持多个域名打到一个证书上
|
||||
* 邮件通知
|
||||
* 私有化部署,保障安全
|
||||
* 免费、免费、免费([阿里云单个通配符域名证书最便宜也要1800/年](https://yundun.console.aliyun.com/?p=cas#/certExtend/buy/cn-hangzhou))
|
||||
|
||||
|
||||
## 二、在线体验
|
||||
|
||||
官方Demo地址,自助注册后体验
|
||||
|
||||
https://certd.handsfree.work/
|
||||
|
||||
> 注意数据将不定期清理,生产使用请自行部署
|
||||
> 包含敏感信息,务必自己本地部署进行生产使用
|
||||
|
||||
## 三、使用教程
|
||||
本案例演示,如何配置自动申请证书,并部署到阿里云CDN,然后快要到期前自动更新证书并重新部署
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
||||
-------> [点我查看详细使用步骤演示](./step.md) <--------
|
||||
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
|
||||
|
||||
## 四、私有化部署
|
||||
|
||||
由于证书、授权信息等属于高度敏感数据,请务必私有化部署,保障数据安全
|
||||
|
||||
### 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)
|
||||
|
||||
当前版本号: 
|
||||
|
||||
```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/
|
||||
|
||||
#### 镜像说明:
|
||||
* certd镜像地址:
|
||||
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest`
|
||||
|
||||
* 镜像构建通过`Actions`自动执行,过程公开透明,请放心使用
|
||||
* [点我查看镜像构建日志](https://github.com/certd/certd/actions/workflows/build-image.yml)
|
||||
|
||||

|
||||
|
||||
|
||||
### 3. 访问
|
||||
|
||||
http://your_server_ip:7001
|
||||
默认账号密码:admin/123456
|
||||
记得修改密码
|
||||
|
||||
|
||||
## 五、 升级
|
||||
如果使用固定版本号
|
||||
1. 修改`docker-compose.yaml`中的镜像版本号
|
||||
2. 运行 `docker compose up -d` 即可
|
||||
|
||||
如果使用`latest`版本
|
||||
1. 重新拉取镜像 `docker pull registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest`
|
||||
2. 重新启动容器 `docker compose restart`
|
||||
|
||||
> 数据默认存在`/data/certd`目录下,不用担心数据丢失
|
||||
|
||||
|
||||
更新日志: [CHANGELOG](./CHANGELOG.md)
|
||||
|
||||
|
||||
## 六、一些说明
|
||||
* 本项目ssl证书提供商为letencrypt
|
||||
* 申请过程遵循acme协议
|
||||
* 需要验证域名所有权,一般有两种方式(目前本项目仅支持dns-01)
|
||||
* http-01: 在网站根目录下放置一份txt文件
|
||||
* dns-01: 需要给域名添加txt解析记录,通配符域名只能用这种方式
|
||||
* 证书续期:
|
||||
* 实际上没有办法不改变证书文件本身情况下直接续期或者续签。
|
||||
* 我们所说的续期,其实就是按照全套流程重新申请一份新证书,然后重新部署上去。
|
||||
* 免费证书过期时间90天,以后可能还会缩短,所以自动化部署必不可少
|
||||
* 设置每天自动运行,当证书过期前20天,会自动重新申请证书并部署
|
||||
|
||||
|
||||
## 七、不同平台的设置说明
|
||||
|
||||
* [Cloudflare](./doc/cf/cf.md)
|
||||
* [腾讯云](./doc/tencent/tencent.md)
|
||||
* [windows主机](./doc/host/host.md)
|
||||
|
||||
|
||||
## 八、问题处理
|
||||
### 7.1 忘记管理员密码
|
||||
解决方法如下:
|
||||
1. 修改docker-compose.yaml文件,将环境变量`certd_system_resetAdminPassword`改为`true`
|
||||
```yaml
|
||||
services:
|
||||
certd:
|
||||
environment: # 环境变量
|
||||
- certd_system_resetAdminPassword=false
|
||||
```
|
||||
2. 重启容器
|
||||
```shell
|
||||
docker compose up -d
|
||||
docker logs -f --tail 500 certd
|
||||
# 观察日志,当日志中输出“重置1号管理员用户的密码完成”,即可操作下一步
|
||||
```
|
||||
3. 修改docker-compose.yaml,将`certd_system_resetAdminPassword`改回`false`
|
||||
4. 再次重启容器
|
||||
```shell
|
||||
docker compose up -d
|
||||
```
|
||||
5. 使用`admin/123456`登录系统,请及时修改管理员密码
|
||||
|
||||
## 九、联系作者
|
||||
如有疑问,欢迎加入群聊(请备注certd)
|
||||
* QQ群:141236433
|
||||
* 微信群:
|
||||

|
||||
|
||||
|
||||
加作者好友
|
||||
<p align="center">
|
||||
<img height="230" src="./doc/images/me.png">
|
||||
</p>
|
||||
|
||||
## 十、捐赠
|
||||
媳妇儿说:“一天到晚搞开源,也不管管老婆孩子!😡😡😡”
|
||||
拜托各位捐赠支持一下,让媳妇儿开心开心,我也能有更多时间进行开源项目,感谢🙏🙏🙏
|
||||
<p align="center">
|
||||
<img height="380" src="./doc/images/donate.png">
|
||||
</p>
|
||||
|
||||
|
||||
## 十一、贡献代码
|
||||
|
||||
[贡献插件教程](./plugin.md)
|
||||
|
||||
|
||||
## 十二、我的其他项目(求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
@@ -0,0 +1 @@
|
||||
22:33
|
||||
106
deploy.js
Normal 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
@@ -0,0 +1 @@
|
||||
5
|
||||
15
doc/cf/cf.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Cloudflare
|
||||
|
||||
|
||||
## CF Token申请
|
||||
|
||||
### 申请地址:
|
||||
https://dash.cloudflare.com/profile/api-tokens
|
||||
|
||||
### 权限设置:
|
||||
需要设置权限和资源范围
|
||||
权限包括:Zone.Zone.edit, Zone.DNS.edit
|
||||
资源范围:要包含对应域名,推荐直接设置为All Zones
|
||||
最终效果如下,可以切换语言为英文对比如下图检查
|
||||
|
||||

|
||||
BIN
doc/cf/cf_token.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
24
doc/host/host.md
Normal 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/1-add.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
doc/images/10-1-log.png
Normal file
|
After Width: | Height: | Size: 124 KiB |
BIN
doc/images/11-1-error.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
doc/images/11-2-error.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
doc/images/12-1-log-success.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
doc/images/12-2-skip-log.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
doc/images/13-1-result.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
doc/images/13-2-result.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
doc/images/13-3-download.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
doc/images/14-timer.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
doc/images/15-1-email.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
doc/images/15-2-email.png
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
doc/images/2-access-provider.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
doc/images/3-add-access.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
doc/images/4-add-success.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
doc/images/5-view.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
doc/images/6-1-add-task.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
doc/images/6-2-add-task.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
doc/images/6-3-add-task.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
doc/images/7-1-add-host-task.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
doc/images/7-2-add-host-task.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
doc/images/7-3-add-host-task.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
doc/images/8-1-add-host-task.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
doc/images/8-2-add-host-task.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
doc/images/8-4-add-host-task.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
doc/images/8-5-add-host-task.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
doc/images/9-start.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
doc/images/action-build.jpg
Normal file
|
After Width: | Height: | Size: 109 KiB |
BIN
doc/images/donate.png
Normal file
|
After Width: | Height: | Size: 169 KiB |
BIN
doc/images/me.png
Normal file
|
After Width: | Height: | Size: 374 KiB |
8
doc/server/free.md
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
# 免费服务器部署
|
||||
|
||||
## 1. 注册koyeb账号
|
||||
|
||||
https://app.koyeb.com/
|
||||
|
||||
## 2. 创建应用
|
||||
BIN
doc/tencent/dnspod-token.png
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
doc/tencent/tencent-access.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
16
doc/tencent/tencent.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# 腾讯云
|
||||
|
||||
|
||||
## DNSPOD 授权设置
|
||||
目前腾讯云管理的域名的dns暂时只支持从DNSPOD进行设置
|
||||
打开 https://console.dnspod.cn/account/token/apikey
|
||||
然后按如下方式获取DNSPOD的授权
|
||||

|
||||
|
||||
|
||||
## 腾讯云API密钥设置
|
||||
|
||||
腾讯云其他部署需要API密钥,需要在腾讯云控制台进行设置
|
||||
打开 https://console.cloud.tencent.com/cam/capi
|
||||
然后按如下方式获取腾讯云的API密钥
|
||||

|
||||
33
docker/run/docker-compose.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
certd:
|
||||
# 镜像 # ↓↓↓↓↓ --- 1、 镜像版本号,建议改成固定版本号【可选】
|
||||
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
|
||||
container_name: certd # 容器名
|
||||
restart: unless-stopped # 自动重启
|
||||
volumes:
|
||||
# ↓↓↓↓↓ ------------------------------------------------------- 2、 数据库以及证书存储路径,默认存在宿主机的/data/certd/目录下【可选】
|
||||
- /data/certd:/app/data
|
||||
ports: # 端口映射
|
||||
# ↓↓↓↓ ----------------------------------------------------------3、如果端口有冲突,可以修改第一个7001为其他不冲突的端口号【可选】
|
||||
- "7001:7001"
|
||||
dns:
|
||||
# 如果出现getaddrinfo ENOTFOUND等错误,可以尝试修改或注释dns配置
|
||||
- 223.5.5.5
|
||||
- 223.6.6.6
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
environment: # 环境变量
|
||||
- TZ=Asia/Shanghai
|
||||
- certd_system_resetAdminPassword=false
|
||||
# ↑↑↑↑↑---------------------------4、如果忘记管理员密码,可以设置为true,重启之后,管理员密码将改成123456,然后请及时修改回false【可选】
|
||||
- certd_cron_immediateTriggerOnce=false
|
||||
# ↑↑↑↑↑---------------------------5、如果设置为true,启动后所有配置了cron的流水线任务都将被立即触发一次【可选】
|
||||
- VITE_APP_ICP_NO=
|
||||
# ↑↑↑↑↑ -----------------------------------------6、这里可以设置备案号【可选】
|
||||
# 设置环境变量即可自定义certd配置
|
||||
# 服务端配置项见: packages/ui/certd-server/src/config/config.default.ts
|
||||
# 服务端配置规则: certd_ + 配置项, 点号用_代替
|
||||
|
||||
# 客户端配置项见: packages/ui/certd-client/.env
|
||||
# 按实际名称配置环境变量即可,如: VITE_APP_API=http://localhost:7001
|
||||
15
lerna.json
@@ -1,6 +1,13 @@
|
||||
{
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "0.1.10"
|
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||
"useWorkspaces": true,
|
||||
"command": {
|
||||
"bootstrap": {
|
||||
"npmClientArgs": [
|
||||
"--no-package-lock"
|
||||
]
|
||||
}
|
||||
},
|
||||
"npmClient": "pnpm",
|
||||
"version": "1.22.8"
|
||||
}
|
||||
|
||||
27
package.json
@@ -1,15 +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": {
|
||||
"submodule": "git submodule update --init --recursive"
|
||||
"start": "lerna bootstrap --hoist",
|
||||
"i-all": "lerna link && lerna exec npm install ",
|
||||
"publish": "npm run prepublishOnly1 && 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/core/pipeline && 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": "^4.17.20"
|
||||
}
|
||||
"axios": "^1.7.2",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/**"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "standard",
|
||||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.test.js", "*.spec.js"],
|
||||
"rules": {
|
||||
"no-unused-expressions": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
2468
packages/api/package-lock.json
generated
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "@certd/api",
|
||||
"version": "0.1.7",
|
||||
"description": "",
|
||||
"main": "./src/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Greper",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"dayjs": "^1.9.7",
|
||||
"lodash-es": "^4.17.20",
|
||||
"log4js": "^6.3.0",
|
||||
"qs": "^6.9.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^7.15.0",
|
||||
"eslint-config-standard": "^16.0.2",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"mocha": "^8.2.1"
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import _ from 'lodash-es'
|
||||
import logger from '../utils/util.log.js'
|
||||
export class AbstractDnsProvider {
|
||||
constructor () {
|
||||
this.logger = logger
|
||||
}
|
||||
|
||||
async createRecord ({ fullRecord, type, value }) {
|
||||
throw new Error('请实现 createRecord 方法')
|
||||
}
|
||||
|
||||
async removeRecord ({ fullRecord, type, value, record }) {
|
||||
throw new Error('请实现 removeRecord 方法')
|
||||
}
|
||||
|
||||
async getDomainList () {
|
||||
throw new Error('请实现 getDomainList 方法')
|
||||
}
|
||||
|
||||
async matchDomain (dnsRecord, domainPropName) {
|
||||
const list = await this.getDomainList()
|
||||
let domain = null
|
||||
for (const item of list) {
|
||||
if (_.endsWith(dnsRecord, item[domainPropName])) {
|
||||
domain = item
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!domain) {
|
||||
throw new Error('找不到域名,请检查域名是否正确:' + dnsRecord)
|
||||
}
|
||||
return domain
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
export { AbstractDnsProvider } from './dns-provider/index.js'
|
||||
export { Store } from './store/store.js'
|
||||
export { util } from './utils/index.js'
|
||||
export { AbstractPlugin } from './plugin/index.js'
|
||||
@@ -1,72 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import logger from '../utils/util.log.js'
|
||||
import dayjs from 'dayjs'
|
||||
import Sleep from '../utils/util.sleep.js'
|
||||
export class AbstractPlugin {
|
||||
constructor ({ accessProviders }) {
|
||||
this.logger = logger
|
||||
this.accessProviders = accessProviders
|
||||
}
|
||||
|
||||
appendTimeSuffix (name) {
|
||||
if (name == null) {
|
||||
name = 'certd'
|
||||
}
|
||||
return name + '-' + dayjs().format('YYYYMMDD-HHmmss')
|
||||
}
|
||||
|
||||
async executeFromContextFile (options = {}) {
|
||||
const { contextPath } = options
|
||||
const contextJson = fs.readFileSync(contextPath)
|
||||
const context = JSON.parse(contextJson)
|
||||
options.context = context
|
||||
await this.doExecute(options)
|
||||
fs.writeFileSync(JSON.stringify(context))
|
||||
}
|
||||
|
||||
async doExecute (options) {
|
||||
try {
|
||||
return await this.execute(options)
|
||||
} catch (e) {
|
||||
logger.error('插件执行出错:', e)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行
|
||||
* @param options
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async execute (options) {
|
||||
console.error('请实现此方法,context:', options.context)
|
||||
}
|
||||
|
||||
async doRollback (options) {
|
||||
try {
|
||||
return await this.rollback(options)
|
||||
} catch (e) {
|
||||
logger.error('插件rollback出错:', e)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 回退,如有必要
|
||||
* @param options
|
||||
*/
|
||||
async rollback (options) {
|
||||
console.error('请实现此方法,rollback:', options.context)
|
||||
}
|
||||
|
||||
getAccessProvider (accessProvider, accessProviders = this.accessProviders) {
|
||||
if (typeof accessProvider === 'string' && accessProviders) {
|
||||
accessProvider = accessProviders[accessProvider]
|
||||
}
|
||||
return accessProvider
|
||||
}
|
||||
|
||||
async sleep (time) {
|
||||
await Sleep(time)
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
export class Store {
|
||||
set (key, value) {
|
||||
|
||||
}
|
||||
|
||||
get (key) {
|
||||
|
||||
}
|
||||
|
||||
buildKey (...keyItem) {
|
||||
|
||||
}
|
||||
|
||||
linkExists (linkPath) {
|
||||
|
||||
}
|
||||
|
||||
link (targetPath, linkPath) {
|
||||
|
||||
}
|
||||
|
||||
unlink (linkPath) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 全路径
|
||||
* @param key
|
||||
*/
|
||||
getActualKey (key) {
|
||||
// return 前缀+key
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import logger from './util.log.js'
|
||||
import path from './util.path.js'
|
||||
import { request } from './util.request.js'
|
||||
import sleep from './util.sleep.js'
|
||||
export const util = {
|
||||
logger, path, request, sleep
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import log4js from 'log4js'
|
||||
log4js.configure({
|
||||
appenders: { std: { type: 'stdout' } },
|
||||
categories: { default: { appenders: ['std'], level: 'info' } }
|
||||
})
|
||||
const logger = log4js.getLogger('certd')
|
||||
export default logger
|
||||
@@ -1,9 +0,0 @@
|
||||
import path from 'path'
|
||||
|
||||
function getUserBasePath () {
|
||||
const userHome = process.env.USERPROFILE || process.env.HOME
|
||||
return path.resolve(userHome, './.certd')
|
||||
}
|
||||
export default {
|
||||
getUserBasePath
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
export default function (timeout) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve()
|
||||
}, timeout)
|
||||
})
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "standard",
|
||||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.test.js", "*.spec.js"],
|
||||
"rules": {
|
||||
"no-unused-expressions": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
2361
packages/certd/package-lock.json
generated
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "@certd/certd",
|
||||
"version": "0.1.7",
|
||||
"description": "",
|
||||
"main": "./src/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Greper",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@certd/acme-client": "^0.1.6",
|
||||
"@certd/api": "^0.1.7",
|
||||
"@certd/providers": "^0.1.7",
|
||||
"dayjs": "^1.9.7",
|
||||
"lodash-es": "^4.17.20",
|
||||
"node-forge": "^0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^7.15.0",
|
||||
"eslint-config-standard": "^16.0.2",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"mocha": "^8.2.1"
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
import acme from '@certd/acme-client'
|
||||
import _ from 'lodash-es'
|
||||
import { util } from '@certd/api'
|
||||
const logger = util.logger
|
||||
export class AcmeService {
|
||||
constructor (store) {
|
||||
this.store = store
|
||||
}
|
||||
|
||||
async getAccountConfig (email) {
|
||||
let conf = this.store.get(this.buildAccountPath(email))
|
||||
if (conf == null) {
|
||||
conf = {}
|
||||
} else {
|
||||
conf = JSON.parse(conf)
|
||||
}
|
||||
return conf
|
||||
}
|
||||
|
||||
buildAccountPath (email) {
|
||||
return this.store.buildKey(email, 'account.json')
|
||||
}
|
||||
|
||||
saveAccountConfig (email, conf) {
|
||||
this.store.set(this.buildAccountPath(email), JSON.stringify(conf))
|
||||
}
|
||||
|
||||
async getAcmeClient (email, isTest) {
|
||||
const conf = await this.getAccountConfig(email)
|
||||
if (conf.key == null) {
|
||||
conf.key = await this.createNewKey()
|
||||
this.saveAccountConfig(email, conf)
|
||||
}
|
||||
if (isTest == null) {
|
||||
isTest = process.env.CERTD_MODE === 'test'
|
||||
}
|
||||
const client = new acme.Client({
|
||||
directoryUrl: isTest ? acme.directory.letsencrypt.staging : acme.directory.letsencrypt.production,
|
||||
accountKey: conf.key,
|
||||
accountUrl: conf.accountUrl,
|
||||
backoffAttempts: 20,
|
||||
backoffMin: 5000,
|
||||
backoffMax: 10000
|
||||
})
|
||||
|
||||
if (conf.accountUrl == null) {
|
||||
const accountPayload = { termsOfServiceAgreed: true, contact: [`mailto:${email}`] }
|
||||
await client.createAccount(accountPayload)
|
||||
conf.accountUrl = client.getAccountUrl()
|
||||
this.saveAccountConfig(email, conf)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
async createNewKey () {
|
||||
const key = await acme.forge.createPrivateKey()
|
||||
return key.toString()
|
||||
}
|
||||
|
||||
async challengeCreateFn (authz, challenge, keyAuthorization, dnsProvider) {
|
||||
logger.info('Triggered challengeCreateFn()')
|
||||
|
||||
/* http-01 */
|
||||
if (challenge.type === 'http-01') {
|
||||
const filePath = `/var/www/html/.well-known/acme-challenge/${challenge.token}`
|
||||
const fileContents = keyAuthorization
|
||||
|
||||
logger.info(`Creating challenge response for ${authz.identifier.value} at path: ${filePath}`)
|
||||
|
||||
/* Replace this */
|
||||
logger.info(`Would write "${fileContents}" to path "${filePath}"`)
|
||||
// await fs.writeFileAsync(filePath, fileContents);
|
||||
} else if (challenge.type === 'dns-01') {
|
||||
/* dns-01 */
|
||||
const dnsRecord = `_acme-challenge.${authz.identifier.value}`
|
||||
const recordValue = keyAuthorization
|
||||
|
||||
logger.info(`Creating TXT record for ${authz.identifier.value}: ${dnsRecord}`)
|
||||
|
||||
/* Replace this */
|
||||
logger.info(`Would create TXT record "${dnsRecord}" with value "${recordValue}"`)
|
||||
|
||||
return await dnsProvider.createRecord({
|
||||
fullRecord: dnsRecord,
|
||||
type: 'TXT',
|
||||
value: recordValue
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to remove an ACME challenge response
|
||||
*
|
||||
* @param {object} authz Authorization object
|
||||
* @param {object} challenge Selected challenge
|
||||
* @param {string} keyAuthorization Authorization key
|
||||
* @param recordItem challengeCreateFn create record item
|
||||
* @param dnsProvider dnsProvider
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
async challengeRemoveFn (authz, challenge, keyAuthorization, recordItem, dnsProvider) {
|
||||
logger.info('Triggered challengeRemoveFn()')
|
||||
|
||||
/* http-01 */
|
||||
if (challenge.type === 'http-01') {
|
||||
const filePath = `/var/www/html/.well-known/acme-challenge/${challenge.token}`
|
||||
|
||||
logger.info(`Removing challenge response for ${authz.identifier.value} at path: ${filePath}`)
|
||||
|
||||
/* Replace this */
|
||||
logger.info(`Would remove file on path "${filePath}"`)
|
||||
// await fs.unlinkAsync(filePath);
|
||||
} else if (challenge.type === 'dns-01') {
|
||||
const dnsRecord = `_acme-challenge.${authz.identifier.value}`
|
||||
const recordValue = keyAuthorization
|
||||
|
||||
logger.info(`Removing TXT record for ${authz.identifier.value}: ${dnsRecord}`)
|
||||
|
||||
/* Replace this */
|
||||
logger.info(`Would remove TXT record "${dnsRecord}" with value "${recordValue}"`)
|
||||
await dnsProvider.removeRecord({
|
||||
fullRecord: dnsRecord,
|
||||
type: 'TXT',
|
||||
value: keyAuthorization,
|
||||
record: recordItem
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async order ({ email, domains, dnsProvider, dnsProviderCreator, csrInfo, isTest }) {
|
||||
const client = await this.getAcmeClient(email, isTest)
|
||||
|
||||
let accountUrl
|
||||
try {
|
||||
accountUrl = client.getAccountUrl()
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
/* Create CSR */
|
||||
const { commonName, altNames } = this.buildCommonNameByDomains(domains)
|
||||
|
||||
const [key, csr] = await acme.forge.createCsr({
|
||||
commonName,
|
||||
...csrInfo,
|
||||
altNames
|
||||
})
|
||||
if (dnsProvider == null && dnsProviderCreator) {
|
||||
dnsProvider = await dnsProviderCreator()
|
||||
}
|
||||
if (dnsProvider == null) {
|
||||
throw new Error('dnsProvider 不能为空')
|
||||
}
|
||||
/* 自动申请证书 */
|
||||
const crt = await client.auto({
|
||||
csr,
|
||||
email: email,
|
||||
termsOfServiceAgreed: true,
|
||||
challengePriority: ['dns-01'],
|
||||
challengeCreateFn: async (authz, challenge, keyAuthorization) => {
|
||||
return await this.challengeCreateFn(authz, challenge, keyAuthorization, dnsProvider)
|
||||
},
|
||||
challengeRemoveFn: async (authz, challenge, keyAuthorization, recordItem) => {
|
||||
return await this.challengeRemoveFn(authz, challenge, keyAuthorization, recordItem, dnsProvider)
|
||||
}
|
||||
})
|
||||
|
||||
// 保存账号url
|
||||
if (!accountUrl) {
|
||||
try {
|
||||
accountUrl = client.getAccountUrl()
|
||||
this.setAccountUrl(email, accountUrl)
|
||||
} catch (e) {
|
||||
logger.warn('保存accountUrl出错', e)
|
||||
}
|
||||
}
|
||||
/* Done */
|
||||
logger.debug(`CSR:\n${csr.toString()}`)
|
||||
logger.debug(`Certificate:\n${crt.toString()}`)
|
||||
logger.info('证书申请成功')
|
||||
return { key, crt, csr }
|
||||
}
|
||||
|
||||
buildCommonNameByDomains (domains) {
|
||||
if (typeof domains === 'string') {
|
||||
domains = domains.split(',')
|
||||
}
|
||||
if (domains.length === 0) {
|
||||
throw new Error('domain can not be empty')
|
||||
}
|
||||
const ret = {
|
||||
commonName: domains[0]
|
||||
}
|
||||
if (domains.length > 1) {
|
||||
ret.altNames = _.slice(domains, 1)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
import { util, Store } from '@certd/api'
|
||||
import { AcmeService } from './acme.js'
|
||||
import { FileStore } from './store/file-store.js'
|
||||
import { CertStore } from './store/cert-store.js'
|
||||
import { DnsProviderFactory } from '@certd/providers'
|
||||
import dayjs from 'dayjs'
|
||||
import forge from 'node-forge'
|
||||
const logger = util.logger
|
||||
export class Certd {
|
||||
constructor (options) {
|
||||
this.options = options
|
||||
this.email = options.cert.email
|
||||
this.domains = options.cert.domains
|
||||
this.domain = this.getMainDomain(options.cert.domains)
|
||||
|
||||
if (!(options.store instanceof Store)) {
|
||||
this.store = new FileStore(options.store || {})
|
||||
}
|
||||
this.certStore = new CertStore({
|
||||
store: this.store,
|
||||
email: options.cert.email,
|
||||
domain: this.domain
|
||||
})
|
||||
this.acme = new AcmeService(this.store)
|
||||
}
|
||||
|
||||
getMainDomain (domains) {
|
||||
if (domains == null) {
|
||||
return null
|
||||
}
|
||||
if (typeof domains === 'string') {
|
||||
return domains
|
||||
}
|
||||
if (domains.length > 0) {
|
||||
return domains[0]
|
||||
}
|
||||
}
|
||||
//
|
||||
// buildDomainFileName (domains) {
|
||||
// const domain = this.getMainDomain(domains)
|
||||
// return domain.replace(/\*/g, '_')
|
||||
// }
|
||||
//
|
||||
// buildCertDir (email, domains) {
|
||||
// const domainFileName = this.buildDomainFileName(domains)
|
||||
// return path.join(email, '/certs/', domainFileName)
|
||||
// }
|
||||
|
||||
async certApply () {
|
||||
let oldCert
|
||||
try {
|
||||
oldCert = await this.readCurrentCert()
|
||||
} catch (e) {
|
||||
logger.warn('读取cert失败:', e)
|
||||
}
|
||||
|
||||
if (oldCert == null) {
|
||||
logger.info('还未申请过,准备申请新证书')
|
||||
} else {
|
||||
const ret = this.isWillExpire(oldCert.expires, this.options.cert.renewDays)
|
||||
if (!ret.isWillExpire) {
|
||||
logger.info('证书还未过期:', oldCert.expires, ',剩余', ret.leftDays, '天')
|
||||
if (this.options.args.forceCert) {
|
||||
logger.info('准备强制更新证书')
|
||||
} else {
|
||||
logger.info('暂不更新证书')
|
||||
|
||||
oldCert.isNew = false
|
||||
return oldCert
|
||||
}
|
||||
} else {
|
||||
logger.info('即将过期,准备更新证书')
|
||||
}
|
||||
}
|
||||
|
||||
// 执行证书申请步骤
|
||||
return await this.doCertApply()
|
||||
}
|
||||
|
||||
async doCertApply () {
|
||||
const options = this.options
|
||||
const dnsProvider = this.createDnsProvider(options)
|
||||
const cert = await this.acme.order({
|
||||
email: options.cert.email,
|
||||
domains: options.cert.domains,
|
||||
dnsProvider,
|
||||
csrInfo: options.cert.csrInfo,
|
||||
isTest: options.args.test
|
||||
})
|
||||
|
||||
await this.writeCert(cert)
|
||||
const certRet = await this.readCurrentCert()
|
||||
certRet.isNew = true
|
||||
return certRet
|
||||
}
|
||||
|
||||
createDnsProvider (options) {
|
||||
const accessProviders = options.accessProviders
|
||||
const providerOptions = accessProviders[options.cert.dnsProvider]
|
||||
return DnsProviderFactory.createByType(providerOptions.providerType, providerOptions)
|
||||
}
|
||||
|
||||
async writeCert (cert) {
|
||||
const newPath = await this.certStore.writeCert(cert)
|
||||
return {
|
||||
realPath: this.certStore.store.getActualKey(newPath),
|
||||
currentPath: this.certStore.store.getActualKey(this.certStore.currentRootPath)
|
||||
}
|
||||
}
|
||||
|
||||
async readCurrentCert () {
|
||||
const cert = await this.certStore.readCert()
|
||||
if (cert == null) {
|
||||
return null
|
||||
}
|
||||
const { detail, expires } = this.getCrtDetail(cert.crt)
|
||||
const domain = this.getMainDomain(this.options.cert.domains)
|
||||
return {
|
||||
...cert, detail, expires, domain, domains: this.domains, email: this.email
|
||||
}
|
||||
}
|
||||
|
||||
getCrtDetail (crt) {
|
||||
const pki = forge.pki
|
||||
const detail = pki.certificateFromPem(crt.toString())
|
||||
const expires = detail.validity.notAfter
|
||||
return { detail, expires }
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否过期,默认提前20天
|
||||
* @param expires
|
||||
* @param maxDays
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isWillExpire (expires, maxDays = 20) {
|
||||
if (expires == null) {
|
||||
throw new Error('过期时间不能为空')
|
||||
}
|
||||
// 检查有效期
|
||||
const leftDays = dayjs(expires).diff(dayjs(), 'day')
|
||||
return {
|
||||
isWillExpire: leftDays < maxDays,
|
||||
leftDays
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
import dayjs from 'dayjs'
|
||||
export class CertStore {
|
||||
constructor ({ store, email, domain }) {
|
||||
this.store = store
|
||||
this.email = email
|
||||
this.domain = domain
|
||||
this.safetyDomain = this.getSafetyDomain(this.domain)
|
||||
|
||||
this.certsRootPath = this.store.buildKey(this.email, 'certs')
|
||||
|
||||
this.currentRootPath = this.store.buildKey(this.certsRootPath, this.safetyDomain, 'current')
|
||||
}
|
||||
|
||||
// getAccountConfig () {
|
||||
// return this.store.get(this.accountConfigKey)
|
||||
// }
|
||||
//
|
||||
// setAccountConfig (email, account) {
|
||||
// return this.store.set(this.accountConfigKey, account)
|
||||
// }
|
||||
|
||||
buildNewCertRootPath (dir) {
|
||||
if (dir == null) {
|
||||
dir = dayjs().format('YYYY.MM.DD.HHmmss')
|
||||
}
|
||||
return this.store.buildKey(this.certsRootPath, this.safetyDomain, dir)
|
||||
}
|
||||
|
||||
formatCert (pem) {
|
||||
pem = pem.replace(/\r/g, '')
|
||||
pem = pem.replace(/\n\n/g, '\n')
|
||||
pem = pem.replace(/\n$/g, '')
|
||||
return pem
|
||||
}
|
||||
|
||||
async writeCert (cert) {
|
||||
const newDir = this.buildNewCertRootPath()
|
||||
|
||||
const crtKey = this.buildKey(newDir, this.safetyDomain + '.crt')
|
||||
const priKey = this.buildKey(newDir, this.safetyDomain + '.key')
|
||||
const csrKey = this.buildKey(newDir, this.safetyDomain + '.csr')
|
||||
await this.store.set(crtKey, this.formatCert(cert.crt.toString()))
|
||||
await this.store.set(priKey, this.formatCert(cert.key.toString()))
|
||||
await this.store.set(csrKey, cert.csr.toString())
|
||||
|
||||
await this.store.link(newDir, this.currentRootPath)
|
||||
|
||||
return newDir
|
||||
}
|
||||
|
||||
async readCert (dir) {
|
||||
if (dir == null) {
|
||||
dir = this.currentRootPath
|
||||
}
|
||||
const crtKey = this.buildKey(dir, this.safetyDomain + '.crt')
|
||||
const priKey = this.buildKey(dir, this.safetyDomain + '.key')
|
||||
const csrKey = this.buildKey(dir, this.safetyDomain + '.csr')
|
||||
const crt = await this.store.get(crtKey)
|
||||
if (crt == null) {
|
||||
return null
|
||||
}
|
||||
const key = await this.store.get(priKey)
|
||||
const csr = await this.store.get(csrKey)
|
||||
|
||||
return {
|
||||
crt: this.formatCert(crt),
|
||||
key: this.formatCert(key),
|
||||
csr,
|
||||
crtPath: this.store.getActualKey(crtKey),
|
||||
keyPath: this.store.getActualKey(priKey),
|
||||
certDir: this.store.getActualKey(dir)
|
||||
}
|
||||
}
|
||||
|
||||
buildKey (...keyItem) {
|
||||
return this.store.buildKey(...keyItem)
|
||||
}
|
||||
|
||||
getSafetyDomain (domain) {
|
||||
return domain.replace(/\*/g, '_')
|
||||
}
|
||||
|
||||
getCurrentFile (file) {
|
||||
const key = this.buildKey(this.currentRootPath, file)
|
||||
return this.store.get(key)
|
||||
}
|
||||
|
||||
setCurrentFile (file, value) {
|
||||
const key = this.buildKey(this.currentRootPath, file)
|
||||
return this.store.set(key, value)
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
import { Store, util } from '@certd/api'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
const logger = util.logger
|
||||
export class FileStore extends Store {
|
||||
constructor (opts) {
|
||||
super()
|
||||
if (opts.rootDir != null) {
|
||||
this.rootDir = opts.rootDir
|
||||
} else {
|
||||
this.rootDir = util.path.getUserBasePath()
|
||||
}
|
||||
if (opts.test) {
|
||||
this.rootDir = path.join(this.rootDir, '/test/')
|
||||
}
|
||||
}
|
||||
|
||||
getActualKey (key) {
|
||||
// return 前缀+key
|
||||
return this.getPathByKey(key)
|
||||
}
|
||||
|
||||
buildKey (...keyItem) {
|
||||
return path.join(...keyItem)
|
||||
}
|
||||
|
||||
getPathByKey (key) {
|
||||
return path.join(this.rootDir, key)
|
||||
}
|
||||
|
||||
set (key, value) {
|
||||
const filePath = this.getPathByKey(key)
|
||||
const dir = path.dirname(filePath)
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
}
|
||||
fs.writeFileSync(filePath, value)
|
||||
return filePath
|
||||
}
|
||||
|
||||
get (key) {
|
||||
const filePath = this.getPathByKey(key)
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return null
|
||||
}
|
||||
return fs.readFileSync(filePath).toString()
|
||||
}
|
||||
|
||||
link (targetPath, linkPath) {
|
||||
targetPath = this.getPathByKey(targetPath)
|
||||
linkPath = this.getPathByKey(linkPath)
|
||||
if (fs.existsSync(linkPath)) {
|
||||
try {
|
||||
fs.unlinkSync(linkPath)
|
||||
} catch (e) {
|
||||
logger.error('unlink error:', e)
|
||||
}
|
||||
}
|
||||
fs.symlinkSync(targetPath, linkPath, 'dir')
|
||||
}
|
||||
|
||||
unlink (linkPath) {
|
||||
linkPath = this.getPathByKey(linkPath)
|
||||
fs.unlinkSync(linkPath)
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import pkg from 'chai'
|
||||
import { createOptions } from '../../../../test/options.js'
|
||||
import { Certd } from '../../src/index.js'
|
||||
const { expect } = pkg
|
||||
describe('AliyunDnsProvider', function () {
|
||||
it('#申请证书-aliyun', async function () {
|
||||
this.timeout(300000)
|
||||
const options = createOptions()
|
||||
options.args = { forceCert: true, test: false }
|
||||
const certd = new Certd(options)
|
||||
const cert = await certd.certApply()
|
||||
expect(cert).ok
|
||||
expect(cert.crt).ok
|
||||
expect(cert.key).ok
|
||||
expect(cert.detail).ok
|
||||
expect(cert.expires).ok
|
||||
})
|
||||
})
|
||||
@@ -1,20 +0,0 @@
|
||||
import pkg from 'chai'
|
||||
import { Certd } from '../../src/index.js'
|
||||
import { createOptions } from '../../../../test/options.js'
|
||||
const { expect } = pkg
|
||||
describe('DnspodDnsProvider', function () {
|
||||
it('#申请证书', async function () {
|
||||
this.timeout(300000)
|
||||
const options = createOptions()
|
||||
options.cert.domains = ['*.certd.xyz', '*.test.certd.xyz', '*.base.certd.xyz', 'certd.xyz']
|
||||
options.cert.dnsProvider = 'dnspod'
|
||||
options.args = { forceCert: true }
|
||||
const certd = new Certd(options)
|
||||
const cert = await certd.certApply()
|
||||
expect(cert).ok
|
||||
expect(cert.crt).ok
|
||||
expect(cert.key).ok
|
||||
expect(cert.detail).ok
|
||||
expect(cert.expires).ok
|
||||
})
|
||||
})
|
||||
13
packages/core/acme-client/.editorconfig
Normal 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
|
||||
16
packages/core/acme-client/.eslintrc.yml
Normal 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
|
||||
61
packages/core/acme-client/.github/scripts/tests-install-coredns.sh
vendored
Normal 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
|
||||
15
packages/core/acme-client/.github/scripts/tests-install-cts.sh
vendored
Normal 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
|
||||
35
packages/core/acme-client/.github/scripts/tests-install-pebble.sh
vendored
Normal 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
|
||||
27
packages/core/acme-client/.github/scripts/tests-wait-for-ca.sh
vendored
Normal 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
|
||||
91
packages/core/acme-client/.github/workflows/tests.yml
vendored
Normal 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
|
||||
6
packages/core/acme-client/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
.actrc
|
||||
.vscode/
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
package-lock.json
|
||||
/.idea/
|
||||
319
packages/core/acme-client/CHANGELOG.md
Normal file
@@ -0,0 +1,319 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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
|
||||
|
||||
* `added` Directory URLs for [Google](https://cloud.google.com/certificate-manager/docs/overview) ACME provider
|
||||
* `fixed` Invalidate ACME directory cache after 24 hours
|
||||
|
||||
## 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 generation and parsing
|
||||
* `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
|
||||
21
packages/core/acme-client/LICENSE
Normal 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.
|
||||
241
packages/core/acme-client/README.md
Normal file
@@ -0,0 +1,241 @@
|
||||
# acme-client [](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)
|
||||
1
packages/core/acme-client/build.md
Normal file
@@ -0,0 +1 @@
|
||||
20:55
|
||||
518
packages/core/acme-client/docs/client.md
Normal 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.<(string\|null)></code>
|
||||
* [.getAccountUrl()](#AcmeClient+getAccountUrl) ⇒ <code>string</code>
|
||||
* [.createAccount([data])](#AcmeClient+createAccount) ⇒ <code>Promise.<object></code>
|
||||
* [.updateAccount([data])](#AcmeClient+updateAccount) ⇒ <code>Promise.<object></code>
|
||||
* [.updateAccountKey(newAccountKey, [data])](#AcmeClient+updateAccountKey) ⇒ <code>Promise.<object></code>
|
||||
* [.createOrder(data)](#AcmeClient+createOrder) ⇒ <code>Promise.<object></code>
|
||||
* [.getOrder(order)](#AcmeClient+getOrder) ⇒ <code>Promise.<object></code>
|
||||
* [.finalizeOrder(order, csr)](#AcmeClient+finalizeOrder) ⇒ <code>Promise.<object></code>
|
||||
* [.getAuthorizations(order)](#AcmeClient+getAuthorizations) ⇒ <code>Promise.<Array.<object>></code>
|
||||
* [.deactivateAuthorization(authz)](#AcmeClient+deactivateAuthorization) ⇒ <code>Promise.<object></code>
|
||||
* [.getChallengeKeyAuthorization(challenge)](#AcmeClient+getChallengeKeyAuthorization) ⇒ <code>Promise.<string></code>
|
||||
* [.verifyChallenge(authz, challenge)](#AcmeClient+verifyChallenge) ⇒ <code>Promise</code>
|
||||
* [.completeChallenge(challenge)](#AcmeClient+completeChallenge) ⇒ <code>Promise.<object></code>
|
||||
* [.waitForValidStatus(item)](#AcmeClient+waitForValidStatus) ⇒ <code>Promise.<object></code>
|
||||
* [.getCertificate(order, [preferredChain])](#AcmeClient+getCertificate) ⇒ <code>Promise.<string></code>
|
||||
* [.revokeCertificate(cert, [data])](#AcmeClient+revokeCertificate) ⇒ <code>Promise</code>
|
||||
* [.auto(opts)](#AcmeClient+auto) ⇒ <code>Promise.<string></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.<(string\|null)></code>
|
||||
Get Terms of Service URL if available
|
||||
|
||||
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
|
||||
**Returns**: <code>Promise.<(string\|null)></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.<object></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.<object></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.<object></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.<object></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.<object></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.<object></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.<object></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.<object></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.<object></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.<object></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.<object></code>
|
||||
Finalize order
|
||||
|
||||
https://datatracker.ietf.org/doc/html/rfc8555#section-7.4
|
||||
|
||||
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
|
||||
**Returns**: <code>Promise.<object></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.<Array.<object>></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.<Array.<object>></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.<object></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.<object></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.<string></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.<string></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.<object></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.<object></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.<object></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.<object></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.<string></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.<string></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.<string></code>
|
||||
Auto mode
|
||||
|
||||
**Kind**: instance method of [<code>AcmeClient</code>](#AcmeClient)
|
||||
**Returns**: <code>Promise.<string></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.<string></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
|
||||
316
packages/core/acme-client/docs/crypto.md
Normal 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.<buffer></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.<buffer></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.<string></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.<Array.<buffer>></code></dt>
|
||||
<dd><p>Create a Certificate Signing Request</p>
|
||||
</dd>
|
||||
<dt><a href="#createAlpnCertificate">createAlpnCertificate(authz, keyAuthorization, [keyPem])</a> ⇒ <code>Promise.<Array.<buffer>></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.<buffer></code>
|
||||
Generate a private RSA key
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<buffer></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.<buffer></code>
|
||||
Generate a private ECDSA key
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<buffer></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.<string></code>
|
||||
Split chain of PEM encoded objects from string into array
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Array.<string></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.<Array.<buffer>></code>
|
||||
Create a Certificate Signing Request
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<Array.<buffer>></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.<string></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.<Array.<buffer>></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.<Array.<buffer>></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 |
|
||||
|
||||
258
packages/core/acme-client/docs/forge.md
Normal 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.<buffer></code></dt>
|
||||
<dd><p>Generate a private RSA key</p>
|
||||
</dd>
|
||||
<dt><a href="#createPublicKey">createPublicKey(key)</a> ⇒ <code>Promise.<buffer></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.<string></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.<buffer></code></dt>
|
||||
<dd><p>Get modulus</p>
|
||||
</dd>
|
||||
<dt><a href="#getPublicExponent">getPublicExponent(input)</a> ⇒ <code>Promise.<buffer></code></dt>
|
||||
<dd><p>Get public exponent</p>
|
||||
</dd>
|
||||
<dt><a href="#readCsrDomains">readCsrDomains(csr)</a> ⇒ <code>Promise.<object></code></dt>
|
||||
<dd><p>Read domains from a Certificate Signing Request</p>
|
||||
</dd>
|
||||
<dt><a href="#readCertificateInfo">readCertificateInfo(cert)</a> ⇒ <code>Promise.<object></code></dt>
|
||||
<dd><p>Read information from a certificate</p>
|
||||
</dd>
|
||||
<dt><a href="#createCsr">createCsr(data, [key])</a> ⇒ <code>Promise.<Array.<buffer>></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.<buffer></code>
|
||||
Generate a private RSA key
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<buffer></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.<buffer></code>
|
||||
Create public key from a private RSA key
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<buffer></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.<string></code>
|
||||
Split chain of PEM encoded objects from buffer or string into array
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Array.<string></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.<buffer></code>
|
||||
Get modulus
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<buffer></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.<buffer></code>
|
||||
Get public exponent
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<buffer></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.<object></code>
|
||||
Read domains from a Certificate Signing Request
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<object></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.<object></code>
|
||||
Read information from a certificate
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<object></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.<Array.<buffer>></code>
|
||||
Create a Certificate Signing Request
|
||||
|
||||
**Kind**: global function
|
||||
**Returns**: <code>Promise.<Array.<buffer>></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.<string></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);
|
||||
93
packages/core/acme-client/docs/upgrade-v5.md
Normal 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);
|
||||
```
|
||||
19
packages/core/acme-client/examples/README.md
Normal 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?
|
||||
148
packages/core/acme-client/examples/api.js
Normal 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()}`);
|
||||
};
|
||||
114
packages/core/acme-client/examples/auto.js
Normal 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()}`);
|
||||
};
|
||||
21
packages/core/acme-client/examples/dns-01/README.md
Normal 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)
|
||||
88
packages/core/acme-client/examples/dns-01/dns-01.js
Normal 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);
|
||||
}
|
||||
})();
|
||||
19
packages/core/acme-client/examples/fallback.crt
Normal 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-----
|
||||
28
packages/core/acme-client/examples/fallback.key
Normal 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-----
|
||||
21
packages/core/acme-client/examples/http-01/README.md
Normal 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)
|
||||
168
packages/core/acme-client/examples/http-01/http-01.js
Normal 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);
|
||||
}
|
||||
})();
|
||||
44
packages/core/acme-client/examples/tls-alpn-01/README.md
Normal 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)
|
||||
23
packages/core/acme-client/examples/tls-alpn-01/haproxy.cfg
Normal 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
|
||||