[NAS] Synology DSM에서 DNSEVER 의 DDNS 갱신하기

DSM에서 제어판>터미널에서 SSH서비스 활성화를 체크해서 SSH서비스를 시작한다. putty로 NAS에 root 사용자로 접속하여 작업을 한다.
※ 작업이 완료되거나 혹은 ssh를 사용하지 않으면은 사용후에 꼭 해제해주시기 바랍니다.

(root는 admin사용자와 password가 같다.)

# /etc.defaults/ddns_provider.conf 파일 편집
# Input:
    #    1. DynDNS style request:
    #       modulepath = DynDNS
    #       queryurl = [Update URL]?[Query Parameters]
    #
    #    2. Self-defined module:
    #       modulepath = /sbin/xxxddns
    #       
    #       Our service will assign parameters in the following order when calling module:
    #           ($1=username, $2=password, $3=hostname, $4=ip)
    #
    # Output:
    #    When you write your own module, you can use the following words to tell user what happen by print it.  
    #    You can use your own message, but there is no multiple-language support.
    #
    #       good -  Update successfully.
    #       nochg - Update successfully but the IP address have not changed.
    #       nohost - The hostname specified does not exist in this user account.
    #       abuse - The hostname specified is blocked for update abuse.
    #       notfqdn - The hostname specified is not a fully-qualified domain name.
    #       badauth - Authenticate failed.
    #       911 - There is a problem or scheduled maintenance on provider side
    #       badagent - The user agent sent bad request(like HTTP method/parameters is not permitted)
    #       badresolv - Failed to connect to  because failed to resolve provider address.
    #       badconn - Failed to connect to provider because connection timeout.
    #
    [DYNDNS.org]
            modulepath=DynDNS
            queryurl=members.dyndns.org/nic/update?hostname=__HOSTNAME__&myip=__MYIP__&system=dyndns&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
    [TwoDNS.de]
            modulepath=DynDNS
            queryurl=update.twodns.de/update.php?hostname=__HOSTNAME__&myip=__MYIP__
    [NoIP.com]
            modulepath=DynDNS   
            queryurl=dynupdate.no-ip.com/nic/update?hostname=__HOSTNAME__&myip=__MYIP__
    [able.or.kr]
            modulepath=DynDNS
            queryurl=able.or.kr/ddns/src/update.php?hostname=__HOSTNAME__&myip=__MYIP__&ddnsuser=__USERNAME__&pwd=__PASSWORD__
    [3322.org]
            modulepath=DynDNS                 
            queryurl=www.3322.org/dyndns/update?hostname=__HOSTNAME__&system=dyndns
    [selfHOST.de]
            modulepath=DynDNS
            queryurl=carol.selfhost.de/nic/update?hostname=__HOSTNAME__&myip=__MYIP__
    [Dynamic DO!.jp]
            modulepath=Ddojp
            queryurl=free.ddo.jp/dnsupdate.php?dn=__HOSTNAME__&pw=__PASSWORD__&ip=__MYIP__
    [ChangeIP.com]
            modulepath=DynDNS
            queryurl=nic.ChangeIP.com/nic/update?hostname=__HOSTNAME__&myip=__MYIP__&system=dyndns
    [DNSPod.com]
            modulepath=DNSPod
            queryurl=dnsapi.cn/Record.Modify?login_email=__USERNAME__&login_password=__PASSWORD__&format=xml&domain_id=__DOMAINID__&record_id=__RECORDID__&sub_domain=__SUBDOMAIN__&record_type=A&record_line=__RECORDLINE__&value=__MYIP__&mx=__MX__&ttl=__TTL__
    [Zoneedit.com]
            modulepath=Zoneedit
            queryurl=dynamic.zoneedit.com/auth/dynamic.html?host=__HOSTNAME__&dnsto=__MYIP__
    [Freedns.org]
            modulepath=Freedns
            queryurl=freedns.afraid.org/dynamic/update.php?user=__FreednsSHA1__&host=__HOSTNAME__&address=__MYIP__
    [Oray.com]
            modulepath=DynDNS
            queryurl=ddns.oray.com/ph/update?hostname=__HOSTNAME__&myip=__MYIP__
    [Synology]
            modulepath=Synology
            queryurl=myds.synology.com
            register_module=synology
<span style="color: #ff0000;">    [DNSEver]</span>
<span style="color: #ff0000;">                modulepath=/sbin/dnseverddns.sh</span>
<span style="color: #ff0000;">               queryurl=kr.dnsever.com</span>

붉은색으로 된 부분을 추가해주면 됩니다.

# /sbin/dnseverddns.sh 파일 생성
#!/bin/sh
    logfile="/volume1/homes/admin/dnsever.log"
    eval set -- "$@"
      
    echo -e "$(date)\tParameter($@) : $1, $2, $3, $4" >> $logfile
      
    wget=$(wget -O - --user=$1 --password=$2 \
            http://dyna.dnsever.com/update.php?host[$3]=$4)
      
    result=$(echo $wget | sed -n 's/.*host.*code=\"\([^\"]\+\).*/\1/p')
      
    if ["$result" == ""]; then
            result=$(echo $wget | sed -n 's/.*code=\"\([^\"]\+\).*/\1/p')
    fi
      
    case "$result" in
    700|701|720)
            echo "good";;
    721)
            echo "nochg";;
    201)
            echo "nohost";;
    320)
            echo "abuse";;
    202|301|304)
            echo "notfqdn";;
    101|102|103|104)
            echo $wget >> $logfile
            echo "badauth";;
    203)
            echo "911";;
    302|303|305)
            echo "badagent";;
    esac
      
    echo -e "\tResult : $result\r\n" >> $logfile