Added support for Linode DNS API.
							parent
							
								
									ca24d1762e
								
							
						
					
					
						commit
						38f2334360
					
				| 
						 | 
				
			
			@ -266,6 +266,7 @@ You don't have to do anything manually!
 | 
			
		|||
1. aliyun.com(阿里云) API
 | 
			
		||||
1. ISPConfig 3.1 API
 | 
			
		||||
1. Alwaysdata.com API
 | 
			
		||||
1. Linode.com API
 | 
			
		||||
 | 
			
		||||
**More APIs coming soon...**
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -257,6 +257,25 @@ acme.sh --issue --dns dns_ad -d example.com -d www.example.com
 | 
			
		|||
The `AD_API_KEY` will be saved in `~/.acme.sh/account.conf` and will be reused
 | 
			
		||||
when needed.
 | 
			
		||||
 | 
			
		||||
## 14. Use Linode domain API
 | 
			
		||||
 | 
			
		||||
You will need to install the Linode CLI and set it up accordingly.
 | 
			
		||||
 | 
			
		||||
[https://www.linode.com/docs/platform/linode-cli](https://www.linode.com/docs/platform/linode-cli)
 | 
			
		||||
 | 
			
		||||
Follow the installation instructions appropriate for your platform and then run the configuration.
 | 
			
		||||
 | 
			
		||||
```linode configure
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Make sure Linode CLI is working correctly before proceeding.
 | 
			
		||||
 | 
			
		||||
Due to the reload time of any changes in the DNS records, we have to use the `dnssleep` option to wait at least 15 minutes for the changes to take effect.
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
acme.sh --issue --dns dns_linode --dnssleep 900 -d example.com -d www.example.com
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# Use custom API
 | 
			
		||||
 | 
			
		||||
If your API is not supported yet, you can write your own DNS API.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,60 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
linode_cmd="/usr/bin/linode"
 | 
			
		||||
 | 
			
		||||
########  Public functions #####################
 | 
			
		||||
 | 
			
		||||
#Usage: dns_linode_add   _acme-challenge.www.domain.com   "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
 | 
			
		||||
dns_linode_add() {
 | 
			
		||||
  fulldomain="${1}"
 | 
			
		||||
  txtvalue="${2}"
 | 
			
		||||
 | 
			
		||||
  _info "Using Linode"
 | 
			
		||||
  _debug "Calling: dns_linode_add() '${fulldomain}' '${txtvalue}'"
 | 
			
		||||
 | 
			
		||||
  domain=$(printf "%s" "${fulldomain}" | cut -d . -f 3-999)
 | 
			
		||||
  name=$(printf "%s" "${fulldomain}" | cut -d . -f 1-2)
 | 
			
		||||
  _debug name "${name}"
 | 
			
		||||
  _debug domain "${domain}"
 | 
			
		||||
 | 
			
		||||
  _Linode_CLI && _Linode_addTXT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#Usage: dns_linode_rm   _acme-challenge.www.domain.com
 | 
			
		||||
dns_linode_rm() {
 | 
			
		||||
  fulldomain="${1}"
 | 
			
		||||
 | 
			
		||||
  _info "Using Linode"
 | 
			
		||||
  _debug "Calling: dns_linode_rm() '${fulldomain}'"
 | 
			
		||||
 | 
			
		||||
  domain=$(printf "%s" "${fulldomain}" | cut -d . -f 3-999)
 | 
			
		||||
  name=$(printf "%s" "${fulldomain}" | cut -d . -f 1-2)
 | 
			
		||||
  _debug name "${name}"
 | 
			
		||||
  _debug domain "${domain}"
 | 
			
		||||
 | 
			
		||||
  _Linode_CLI && _Linode_rmTXT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
####################  Private functions below ##################################
 | 
			
		||||
 | 
			
		||||
_Linode_CLI() {
 | 
			
		||||
  if [ ! -f "${linode_cmd}" ]; then
 | 
			
		||||
    _err "Please install the Linode CLI package and set it up accordingly before using this DNS API."
 | 
			
		||||
    return 1
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_Linode_addTXT() {
 | 
			
		||||
  _debug "$linode_cmd domain record-update ${domain} TXT ${name} --target ${txtvalue}"
 | 
			
		||||
  $linode_cmd domain record-update ${domain} TXT ${name} --target ${txtvalue}
 | 
			
		||||
 | 
			
		||||
  if [ $? -ne 0 ]; then
 | 
			
		||||
    _debug "$linode_cmd domain record-create ${domain} TXT ${name} ${txtvalue}"
 | 
			
		||||
    $linode_cmd domain record-create ${domain} TXT ${name} ${txtvalue}
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_Linode_rmTXT() {
 | 
			
		||||
  _debug "$linode_cmd domain record-delete ${domain} TXT ${name}"
 | 
			
		||||
  $linode_cmd domain record-delete ${domain} TXT ${name}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue