alterator-bind-0.1/000075500000000000000000000000001063447220700142645ustar00rootroot00000000000000alterator-bind-0.1/Makefile000064400000000000000000000010361063447220700157240ustar00rootroot00000000000000NAME=bind DESCRIPTION="DNS Server" INSTALL=/usr/bin/install HELPER_DIR=$(prefix)/libexec/alterator-bind all: clean: install: install-backend install-tools install-po install-html install-ui include /usr/share/alterator/build/po.mak include /usr/share/alterator/build/ui2.mak include /usr/share/alterator/build/backend.mak include /usr/share/alterator/build/fbi.mak include /usr/share/alterator/build/html-messages.mak install-tools: for i in helpers/*;do \ [ -x $$i ] && $(INSTALL) -Dpm 755 $$i $(HELPER_DIR)/`basename $$i`; \ done alterator-bind-0.1/applications/000075500000000000000000000000001063447220700167525ustar00rootroot00000000000000alterator-bind-0.1/applications/bind-options.desktop000064400000000000000000000004001063447220700227440ustar00rootroot00000000000000[Desktop Entry] Encoding=UTF-8 Type=Application Categories=X-Alterator-Servers Icon=bind-options Terminal=false Name=DNS server (general options) Name[ru_RU]=DNS cервер (общие параметры) X-Alterator-URI=/bind-options X-Alterator-UI=html alterator-bind-0.1/backend3/000075500000000000000000000000001063447220700157365ustar00rootroot00000000000000alterator-bind-0.1/backend3/bind-options000075500000000000000000000071011063447220700202700ustar00rootroot00000000000000#!/bin/sh BIND_CONF="/var/lib/bind/etc/options.conf" PATH="/usr/libexec/alterator-bind/:$PATH" _() { LANG=${in_language%%;*}.utf8 gettext "alterator-bind" "$1" } ### forwarders / allow-query / allow-recursion avail_objects() { sed -nr "/^[[:space:]]*$1/ {s,.*\{([^\}]*)\}.*,\1,;p}" "$BIND_CONF"| tr ';' '\n'| sed -r 's,[[:space:]]*([/a-z0-9\.]+).*,\1, /^[[:space:]]*$/ d' } delete_objects() { sed -r "s,^([[:space:]]*$1.*)[[:space:]]*$2[[:space:]]*;(.*),\1\2," -i "$BIND_CONF" } new_objects() { sed -r "s,^([[:space:]]*//[[:space:]]*$1)[[:space:]]*.*,\1 {};," -i "$BIND_CONF" sed -r "s,^([[:space:]]*)(//)?([[:space:]]*$1)[[:space:]]*\{([^}]*)\},\1\3 {\4$2;}," -i "$BIND_CONF" } ### forward read_forward() { sed -nr '/^[[:space:]]*forward[[:space:]]/ {s,^[[:space:]]*forward[[:space:]]+([a-z]+).*,\1,;p}' "$BIND_CONF" } avail_forward() { echo '("first") ("only")' } write_forward() { sed -r "s,^([[:space:]]*)(//)?forward[[:space:]]+.*,\1forward $1;," -i "$BIND_CONF" } ### config normalization fix_config() { #try to fix config if we need it normalize_config "$BIND_CONF" >"$BIND_CONF.new" if cmp "$BIND_CONF" "$BIND_CONF.new" >&2 ;then rm -f "$BIND_CONF.new" else chown root:named "$BIND_CONF.new" chmod 640 "$BIND_CONF.new" mv -f "$BIND_CONF.new" "$BIND_CONF" fi } ### initial actions fix_config #turn off auto expansion set -f . /usr/share/alterator/build/backend3.sh ipregexp="([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])([.]([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9+]|25[0-5])){3}" maskregexp="(/[0-9]|/[12][0-9]|/3[0-2])?" netregexp="^($ipregexp$maskregexp|none|localhost|any|localnets)$" net_required() { if [ "$in_orig_action" = "new" ] && [ "$in_type" = "allow-query" -o "$in_type" = "allow-recursion" ] ;then echo "#t" else echo "#f" fi } on_message() { case "$in_action" in constraints) echo '(' printf 'ip_name (required %s label "%s" ipv4-address #t)' \ "$([ "$in_orig_action" = "new" -a "$in_type" = "forwarders" ] && echo "#t" || echo "#f")" \ "`_ "IP address"`" printf 'net_name (required %s label "%s" match ("%s" "%s"))' \ "$(net_required)" \ "`_ "Network address"`" \ "$netregexp" \ "`_ "Invalid network address"`" printf 'forwarders (label "%s")' "`_ "Forwarding servers"`" printf 'allow-query (label "%s")' "`_ "Networks are allowed to make simple queries"`" printf 'allow-recursion (label "%s")' "`_ "Networks are allowed to make recursive queries"`" printf 'forward (label "%s")' "`_ "Forwarding mode"`" printf 'forwarders_length (exclude (0 forward))' echo ')' ;; list) echo '(' case "$in__objects" in forwarders|allow-query|allow-recursion) avail_objects "$in__objects"|sed 's,.*,("&"),' ;; forward) avail_forward ;; esac echo ')' ;; read) echo '(' printf ' forwarders_length %s' "$(avail_objects "forwarders"|wc -l)" printf ' forward "%s"' "$(read_forward)" echo ')' ;; write) [ -n "$in_forward" ] && write_forward "$in_forward" service bind reload >&2 echo '()' ;; new) local name="${in_ip_name:-$in_net_name}" if avail_objects "$in_type"|grep -qs "^$name$"; then printf '(error "%s")' "`_ "Same IP/Network already exists"`" else [ -n "$name" -a -n "$in_type" ] && new_objects "$in_type" "$name" service bind reload >&2 echo '()' fi ;; delete) delete_objects "${in__objects%%/*}" "${in__objects#*/}" service bind reload >&2 echo '()' ;; *) echo '#f' ;; esac } message_loop alterator-bind-0.1/backend3/template-bind-options000075500000000000000000000011351063447220700221020ustar00rootroot00000000000000#!/bin/sh #turn off auto expansion set -f _() { LANG=${in_language%%;*}.utf8 gettext "alterator-bind" "$1" } . /usr/share/alterator/build/backend3.sh on_message() { case "$in_action" in #information for renderer template) echo '(' echo ' template "form"' echo ' url "bind-options.html"' echo ' help "bind-options.html"' echo ' translate "alterator-bind"' echo ')' ;; info) echo '(' printf ' title "%s"' "`_ "DNS server"`" printf ' description "%s"' "`_ "DNS server administration: common options"`" echo ')' ;; *) echo '#f' ;; esac } message_loop alterator-bind-0.1/helpers/000075500000000000000000000000001063447220700157265ustar00rootroot00000000000000alterator-bind-0.1/helpers/normalize_config000075500000000000000000000013151063447220700212010ustar00rootroot00000000000000#!/bin/gawk -f BEGIN { forwarders = 0; } #C style comments detection /(^|[[:space:]]+)\/\*([[:space:]]+|$)/ { comment = 1; } /(^|[[:space:]]+)\*\/([[:space:]]+|$)/ { comment = 0; } #join forwarders option into one string /(^|[[:space:]]+)(forwarders|allow-query|allow-recursion)([[:space:]]+|$)/ { if (!comment) { line=$0; forwarders=1; foundat=FNR; } } /{/ { if (forwarders && FNR != foundat) { line = line $0; foundat=FNR; } } /}/ { if (forwarders) { if (FNR != foundat) line = line $0; print line; forwarders = 0; next; } } #default action { if (forwarders) { if (FNR != foundat) line = line $0; foundat = FNR; } else print $0; } alterator-bind-0.1/html/000075500000000000000000000000001063447220700152305ustar00rootroot00000000000000alterator-bind-0.1/html/fbi/000075500000000000000000000000001063447220700157705ustar00rootroot00000000000000alterator-bind-0.1/html/fbi/bind-options.html000064400000000000000000000063211063447220700212650ustar00rootroot00000000000000 DNS server - ALT Linux Console

DNS server

start, stop or restart service