吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1870|回复: 7
上一主题 下一主题
收起左侧

已有阿里云的ddns,现在换成华为云,求帮忙修改sh文件

[复制链接]
跳转到指定楼层
楼主
gzwking 发表于 2020-10-23 22:48 回帖奖励
30吾爱币
本帖最后由 gzwking 于 2020-10-28 17:20 编辑
用来访问群辉的,原先用的是别人写好的阿里云的ddns.sh。现在阿里云到期了就换成华为云了 但是这个ddns.sh文件不会改啊,高手给改一改吧
原先阿里云的ddns.sh文件https://pan.baidu.com/share/init?surl=zNHFaSSq5Sz2o2vaj6YbHA提取码:c91u
我是照着人家的文章做的,https://post.smzdm.com/p/a4w0z2gk/;https://post.smzdm.com/p/adwrq56p/;https://post.smzdm.com/p/ax027ww9/
大佬可以参考下


在网上找到了一个华为云的ddns,但是看到还得输入账号密码,那个大神能给看看有什么问题没?
https://github.com/iLay1678/huaweicloud_ddns/tree/ipv6

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

沙发
 楼主| gzwking 发表于 2020-10-24 10:42 |楼主
没有熟悉编程的大佬在吗?
3#
 楼主| gzwking 发表于 2020-10-24 18:15 |楼主
4#
 楼主| gzwking 发表于 2020-10-28 17:16 |楼主
本帖最后由 gzwking 于 2020-10-28 17:21 编辑
在网上找到了一个华为云的ddns,但是看到还得输入账号密码,那个大神能给看看有什么问题没?
https://github.com/iLay1678/huaweicloud_ddns/tree/ipv6
5#
 楼主| gzwking 发表于 2020-10-29 08:11 |楼主
哎 大佬们都不高群辉吗?还是说都有公网IP了,ipv6还是可以的啊
6#
chinawbf 发表于 2020-12-1 22:27
本帖最后由 chinawbf 于 2020-12-1 22:43 编辑

按照说明修改,华为的ipv6可以解析的


#!/bin/bash
stty erase ^h
clear
# Author LVCS
# https://github.com/lllvcs/huaweicloud_ddns
# https://gitee.com/lvcs/huaweicloud_ddns
# 在运行此脚本之前,请先在DNS管理控制台内添加对应域名AAAA记录!
# Please add the corresponding domain name record in the DNS management console before running this shell script!
# 一般来说用户名和账户名相同

#用户名
username="用户名"
#账户名
accountname="同上"
#密码
password="密码"

#域名
domain="xxx.top"
#主机名
host="www"    #云解析控制台的域名

#获取ip地址网址
GETIPURL="ipv6.ip.sb"
#GETIPURL="api.myip.la"
#GETIPURL="http://v6.ip.zxinc.org/getip"
#GETIPURL="https://v6.yinghualuo.cn"
#GETIPURL="https://ip.lsy.cn/getip"
#GETIPURL="https://www.ipqi.co"

#从外网api获取ip地址(开启1/关闭0 默认开启)
REMOTE_RESOLVE=1

#从网卡获取ip地址(填写网卡名 如eth0 ens3 he-ipv6)
#并请根据实际情况填写sed行数(第96 98行处)
INTERFACE="ovs_eth0" #群晖的不用改了

TARGET_IP=""

#End Point 终端地址 请根据地域选择
iam="iam.myhuaweicloud.com"
#iam="iam.ap-southeast-1.myhuaweicloud.com"
#iam="iam.ap-southeast-3.myhuaweicloud.com"

dns="dns.myhuaweicloud.com"
#dns="dns.ap-southeast-1.myhuaweicloud.com"
#dns="dns.ap-southeast-3.myhuaweicloud.com"


token_X="$(
    curl -L -k -s -D - -X POST \
        "https://$iam/v3/auth/tokens" \
        -H 'content-type: application/json' \
        -d '{
    "auth": {
        "identity": {
            "methods": ["password"],
            "password": {
                "user": {
                    "name": "'$username'",
                    "password": "'$password'",
                    "domain": {
                        "name": "'$accountname'"
                    }
                }
            }
        },
        "scope": {
            "domain": {
                "name": "'$accountname'"
            }
        }
    }
  }' | grep X-Subject-Token
)"

token="$(echo $token_X | awk -F ' ' '{print $2}')"

recordsets="$(
    curl -L -k -s -D - \
        "https://$dns/v2/recordsets?name=$host.$domain." \
        -H 'content-type: application/json' \
        -H 'X-Auth-Token: '$token | grep -o "id\":\"[0-9a-z]*\"" | awk -F : '{print $2}' | grep -o "[a-z0-9]*"
)"

RECORDSET_ID=$( echo $recordsets | cut -d ' ' -f 1)
ZONE_ID=$(echo $recordsets | cut -d ' ' -f 2 | cut -d ' ' -f 2)

if [ -z $TARGET_IP ]; then
    if [ $REMOTE_RESOLVE -eq 1 ]; then
        if [ $INTERFACE ]; then
            TARGET_IP=$(curl -s -6 --interface $INTERFACE $GETIPURL)
        else
            TARGET_IP=$(curl -s -6 $GETIPURL)
        fi
    else
        if [ $INTERFACE ]; then
            TARGET_IP=$(ifconfig $INTERFACE | grep 'inet6 ' | cut -d 't' -f 2 | cut -d ' ' -f 2 | sed -n 2p)
        else
            TARGET_IP=$(ifconfig | grep 'inet6 ' | cut -d 't' -f 2 | cut -d ' ' -f 2 | sed -n 2p)
        fi
    fi
fi

curl -X PUT -L -k -s \
    "https://$dns/v2/zones/$ZONE_ID/recordsets/$RECORDSET_ID" \
    -H "Content-Type: application/json" \
    -H "X-Auth-Token: $token" \
    -d "{ \"records\" : [\" $TARGET_IP \"], \"ttl\" : 1}"
7#
 楼主| gzwking 发表于 2020-12-17 22:27 |楼主
chinawbf 发表于 2020-12-1 22:27
按照说明修改,华为的ipv6可以解析的

我照着您的改了  可是不能解析啊?能给详细说说嘛?从华为云下载的credentials表格里有User Name和Access Key Id。用户名是不是填User Name,账户名是不是填这个accountname?还有华为云的控制台跟阿里的也不大一样啊!
8#
 楼主| gzwking 发表于 2020-12-17 22:28 |楼主
chinawbf 发表于 2020-12-1 22:27
按照说明修改,华为的ipv6可以解析的

这是群辉计划任务的运行日志
stty: standard input: Inappropriate ioctl for device
{"error_msg":"Incorrect IAM authentication information: x-auth-token not found","error_code":"APIGW.0301","request_id":"610c897739162fba72059d088ab2cf08"}
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-14 13:28

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表