Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
ab497961
Commit
ab497961
authored
Jan 30, 2016
by
neil
Browse files
how to use cloudflare api and create custom api
parent
a28b3a65
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
ab497961
...
@@ -139,9 +139,6 @@ Support the latest dns-01 challenge.
...
@@ -139,9 +139,6 @@ Support the latest dns-01 challenge.
le issue dns aa.com www.aa.com,user.aa.com
le issue dns aa.com www.aa.com,user.aa.com
```
```
Use domain api to automatically add dns record is not finished yet.
So, you must manually add the txt record to finish verifying.
You will get the output like bellow:
You will get the output like bellow:
```
```
Add the following txt record:
Add the following txt record:
...
@@ -165,6 +162,48 @@ Ok, it's finished.
...
@@ -165,6 +162,48 @@ Ok, it's finished.
# Use CloudFlare domain api to automatically issue cert
For now, we support clourflare integeration.
First you need to login to your clourflare account to get you apikey.
Then open
`~/.le/dnsapi/dns-cf.sh`
, and fill your api key and email there:
and uncomment the lines:
```
CF_Key="sdfsdfsdfljlbjkljlkjsdfoiwje"
CF_Email="xxxx@sss.com"
```
Ok, let's issue cert now:
```
le.sh issue dns-cf aa.com www.aa.com
```
More api integerations are coming. Godaddy, Dnspod, etc....
# Use custom api
If your api is not supported yet, you can write your own dns api.
Let's assume you want to name it 'myapi',
1.
Create a bash script named
`~/.le/dns-myapi.sh`
,
2.
In the scrypt, you must have a function named
`dns-myapi-add()`
. Which will be called by le.sh to add dns records.
3.
Then you can use your api to issue cert like:
```
le.sh issue dns-myapi aa.com www.aa.com
```
For more details, please check our sample script:
`dnsapi/dns-myapi.sh`
#Under the Hood
#Under the Hood
Speak ACME language with bash directly to Let's encrypt.
Speak ACME language with bash directly to Let's encrypt.
...
...
dnsapi/dns-cf.sh
View file @
ab497961
...
@@ -16,6 +16,12 @@ dns-cf-add() {
...
@@ -16,6 +16,12 @@ dns-cf-add() {
fulldomain
=
$1
fulldomain
=
$1
txtvalue
=
$2
txtvalue
=
$2
if
[
-z
"
$CF_Key
"
]
||
[
-z
"
$CF_Email
"
]
;
then
_err
"You don't specify cloudflare api key and email yet."
_err
"Please create you key and try again."
return
1
fi
_debug
"First detect the root zone"
_debug
"First detect the root zone"
if
!
_get_root
$fulldomain
;
then
if
!
_get_root
$fulldomain
;
then
_err
"invalid domain"
_err
"invalid domain"
...
...
dnsapi/dns-myapi.sh
0 → 100644
View file @
ab497961
#!/bin/bash
#Here is a sample custom api script.
#This file name is "dhs-myapi.sh"
#So, here must be a method dhs-myapi-add()
#Which will be called by le.sh to add the txt record to your api system.
#returns 0 meanst success, otherwise error.
######## Public functions #####################
#Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns-myapi-add
()
{
fulldomain
=
$1
txtvalue
=
$2
_err
"Not implemented!"
return
1
;
}
#################### Private functions bellow ##################################
_debug
()
{
if
[
-z
"
$DEBUG
"
]
;
then
return
fi
if
[
-z
"
$2
"
]
;
then
echo
$1
else
echo
"
$1
"
=
"
$2
"
fi
}
_info
()
{
if
[
-z
"
$2
"
]
;
then
echo
"
$1
"
else
echo
"
$1
"
=
"
$2
"
fi
}
_err
()
{
if
[
-z
"
$2
"
]
;
then
echo
"
$1
"
>
&2
else
echo
"
$1
"
=
"
$2
"
>
&2
fi
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment