https://github.com/takuya/php-ddns-api-server
php cloudflare ddns api server by lumen
https://github.com/takuya/php-ddns-api-server
Last synced: 24 days ago
JSON representation
php cloudflare ddns api server by lumen
- Host: GitHub
- URL: https://github.com/takuya/php-ddns-api-server
- Owner: takuya
- Created: 2024-11-24T17:23:19.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-21T11:08:29.000Z (over 1 year ago)
- Last Synced: 2025-03-20T23:28:40.573Z (about 1 year ago)
- Language: PHP
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## ddns api
cloudflare を ddns で使うためのセット
## 使い方
cloudflare の api を通して DNSのAレコードを更新するAPIを呼び出す。
```shell
HOST=my-ddns.example.tld
domain=random.example.tld
ip=1.1.1.1
app_token=abc # config('app.token')を使う。
##
curl https://${HOST}/ddns/${domain}/${op}?token=${app_token}
```
## 設定
`.env`を使って設定する。
```shell
CF_TOKEN_PATH=storage/credentials/cloudflare_token.json.enc
APP_TOKEN=xxxx.xxxx.xxxx
```
storage/credentials/cloudflare_token.json
```json
[
{
"domain": "example.tld",
"key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
{
"domain": "example.gtd",
"key": "xxxxxxxxxxxxxxxxxxxxx"
}
]
```
ファイルを暗号化して保存して使う場合
```shell
i=$(( 1000* 1000 ))
file_in=storage/credentials/cloudflare_token.json
file_out=storage/credentials/cloudflare_token.json.enc
passphrase="my_strong_password"
openssl enc -e -aes-256-cbc \
-pbkdf2 -iter "${i}" \
-in "${file_in}" -out "${file_out}" \
-k "${passphrase}"\
-base64 \
;
```
```php
$str = openssl_equivalent_decrypt($token_path, config('app.token'));
```