slitaz-forge rev 583
Add http://ns.slitaz.org/
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Dec 06 14:45:30 2014 +0100 (2014-12-06) |
parents | deb56a2d3e63 |
children | 55d3d10d8b93 |
files | ns/bind/by.slitaz.org ns/bind/named.conf.local ns/web/index.cgi |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ns/bind/by.slitaz.org Sat Dec 06 14:45:30 2014 +0100 1.3 @@ -0,0 +1,12 @@ 1.4 +$ORIGIN . 1.5 +$TTL 86400 ; 1 day 1.6 +by.slitaz.org IN SOA ns.slitaz.org. postmaster.slitaz.org. ( 1.7 + 2013120204 ; serial 1.8 + 10800 ; refresh (3 hours) 1.9 + 1800 ; retry (30 minutes) 1.10 + 604800 ; expire (1 week) 1.11 + 86400 ; minimum (1 day) 1.12 + ) 1.13 + NS ns.slitaz.org. 1.14 +$ORIGIN by.slitaz.org. 1.15 +$TTL 900 ; 15 minutes
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/ns/bind/named.conf.local Sat Dec 06 14:45:30 2014 +0100 2.3 @@ -0,0 +1,14 @@ 2.4 +// 2.5 +// Do any local configuration here 2.6 +// 2.7 + 2.8 +// Consider adding the 1918 zones here, if they are not used in your 2.9 +// organization 2.10 +//include "/etc/bind/zones.rfc1918"; 2.11 + 2.12 +zone "by.slitaz.org" IN { 2.13 + type master; 2.14 + file "/etc/bind/by.slitaz.org"; 2.15 + allow-update { 127.0.0.1; 5.135.85.160; key rndc-key; }; 2.16 + allow-query { any; }; 2.17 +};
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/ns/web/index.cgi Sat Dec 06 14:45:30 2014 +0100 3.3 @@ -0,0 +1,153 @@ 3.4 +#!/bin/sh 3.5 + 3.6 +# Get parameters with GET, POST and FILE functions 3.7 +. /usr/bin/httpd_helper.sh 3.8 + 3.9 +OWNERFILE=name.users 3.10 +ip="$(GET ip)" 3.11 +[ "$ip" ] || ip=$REMOTE_ADDR 3.12 +name="$(GET name)" 3.13 +name="${name%.by.slitaz.org}" 3.14 +if [ "$name" -a "$REMOTE_USER" ]; then 3.15 + if grep -qs ^$name $OWNERFILE ; then 3.16 + owner="$(sed "/^$name /!d;s/.* //" $OWNERFILE)" 3.17 + if [ "$owner" != "$REMOTE_USER" ]; then 3.18 + echo "$name is already used by $owner. Abort." 3.19 + exit 1 3.20 + fi 3.21 + else 3.22 + echo "$name $REMOTE_USER" >> $OWNERFILE 3.23 + fi 3.24 + addip=yes 3.25 + case " $(GET) " in 3.26 + *\ remove\ *|*\ delete\ *|*\ wipe\ *) 3.27 + addip= 3.28 + sed -i "/^$name /d" $OWNERFILE 3.29 + esac 3.30 + req="server 127.0.0.1 3.31 +update delete $name.by.slitaz.org A" 3.32 + [ "$addip" ] && req="$req 3.33 +update add $name.by.slitaz.org 900 A $ip" 3.34 + case " $(GET) " in 3.35 + *\ mx\ *) 3.36 + mx="$(GET mx)" 3.37 + [ "$mx" ] || mx=$ip 3.38 + req="$req 3.39 +update delete $name.by.slitaz.org MX" 3.40 + [ "$addip" ] && req="$req 3.41 +update add $name.by.slitaz.org 900 MX 10 $mx" 3.42 + esac 3.43 + echo "$req 3.44 +send" | nsupdate 3.45 +else 3.46 + #header "text/html; charset=utf-8" 3.47 + cat <<EOT 3.48 +<!DOCTYPE html> 3.49 +<html xmlns="http://www.w3.org/1999/xhtml"> 3.50 +<head> 3.51 + <title>SliTaz Name Server</title> 3.52 + <meta charset="utf-8" /> 3.53 + <link rel="shortcut icon" href="favicon.ico" /> 3.54 + <link rel="stylesheet" type="text/css" href="style.css" /> 3.55 + <style type="text/css"> 3.56 + #header h1 { 3.57 + margin: 0; 3.58 + padding: 8px 0 0 42px; 3.59 + width: 250px; 3.60 + } 3.61 + #logo { 3.62 + background: url(/images/logo.png) no-repeat left; 3.63 + position: absolute; 3.64 + float: left; 3.65 + left: 0px; 3.66 + top: 0px; 3.67 + width: 40px; 3.68 + height: 40px; 3.69 + } 3.70 + pre { font-size: 100%; } 3.71 + </style> 3.72 +</head> 3.73 +<body> 3.74 + 3.75 +<div id="header"> 3.76 + <div id="logo"></div> 3.77 + <div id="network"> 3.78 + <a href="http://www.slitaz.org/">Home</a> 3.79 + <a href="http://bugs.slitaz.org/">Bugs</a> 3.80 + <a href="http://hg.slitaz.org/wok/">Hg</a> 3.81 + <a href="http://forum.slitaz.org/">Forum</a> 3.82 + <a href="http://roadmap.slitaz.org/">Roadmap</a> 3.83 + <a href="http://pizza.slitaz.me/">Pizza</a> 3.84 + <a href="http://tank.slitaz.org/">Tank</a> 3.85 + </div> 3.86 + <h1><a href="./">SliTaz Name Server</a></h1> 3.87 +</div> 3.88 + 3.89 +<!-- Content --> 3.90 +<div id="content"> 3.91 +EOT 3.92 + if grep -qs " $REMOTE_USER$" $OWNERFILE; then 3.93 + cat <<EOT 3.94 +<h3>Status</h3> 3.95 +$REMOTE_USER has $(grep " $REMOTE_USER$" $OWNERFILE | wc -l) names 3.96 +the in by.slitaz.org domain. 3.97 +<pre> 3.98 +EOT 3.99 + for i in $(grep " $REMOTE_USER$" $OWNERFILE | sed 's/ .*//'); do 3.100 + grep "^$i " /etc/bind/by.slitaz.org 3.101 + done 3.102 + cat <<EOT 3.103 +</pre> 3.104 + 3.105 +Your current IP address is $REMOTE_ADDR 3.106 +EOT 3.107 + fi 3.108 + cat <<EOT 3.109 +<h3>Usage</h3> 3.110 +<pre> 3.111 +wget -O - "http://user:pass@ns.slitaz.org/?name=<name>[&remove][&ip=<ip1>][&mx[=<ip2>]]" 3.112 +</pre> 3.113 +<h3>Examples</h3> 3.114 +<ul> 3.115 +<li> 3.116 +Update myblog.by.slitaz.org with my current IP address. 3.117 +<pre> 3.118 +wget -O - "http://user:pass@ns.slitaz.org/?name=myblog" 3.119 +</pre> 3.120 +</li> 3.121 +<li> 3.122 +Update myblog.by.slitaz.org with the IP address 1.2.3.4. 3.123 +<pre> 3.124 +wget -O - "http://user:pass@ns.slitaz.org/?name=myblog&ip=1.2.3.4" 3.125 +</pre> 3.126 +</li> 3.127 +<li> 3.128 +Remove myblog.by.slitaz.org from the name server. 3.129 +<pre> 3.130 +wget -O - "http://user:pass@ns.slitaz.org/?name=myblog&remove" 3.131 +</pre> 3.132 +</li> 3.133 +<li> 3.134 +Update myserver.by.slitaz.org with my current IP address and declare the mail server btw. 3.135 +<pre> 3.136 +wget -O - "http://user:pass@ns.slitaz.org/?name=myserver&mx" 3.137 +</pre> 3.138 +</li> 3.139 +<li> 3.140 +Update myserver.by.slitaz.org with my current IP address and use the mail server at 1.2.3.4. 3.141 +<pre> 3.142 +wget -O - "http://user:pass@ns.slitaz.org/?name=myserver&mx=1.2.3.4" 3.143 +</pre> 3.144 +</li> 3.145 +</ul> 3.146 +</div> 3.147 + 3.148 +<div id="footer"> 3.149 + <a href="http://www.slitaz.org/">SliTaz Website</a> 3.150 + <a href="index.cgi">Name Server</a> 3.151 +</div> 3.152 + 3.153 +</body> 3.154 +</html> 3.155 +EOT 3.156 +fi