dnsmasq/0000755000000000000000000000000010512645440011223 5ustar rootrootdnsmasq/config.info0000644000000000000000000000013210505663743013351 0ustar rootrootconfig_file=Full path to DNSmasq config file,0 restart=Shell script to re-start DNSmasq,0 dnsmasq/config0000644000000000000000000000006110505663767012426 0ustar rootrootconfig_file=/etc/dnsmasq.conf restart=restart.sh dnsmasq/images/0000755000000000000000000000000010506375201012466 5ustar rootrootdnsmasq/images/icon.gif0000644000000000000000000000061610505632635014116 0ustar rootrootGIF89a00ccc,00I8k;`xqBY~b vq*W^9\HCG!ŏD?+ -p P j:@o1~9~mz{~}my|D-@VQb,P'VOr^Vjxz;[f^zøȰܞħL}1O`By {{H@0E1F,D)~dH!%̑rґYm_61ɓgw4+3&,;\ZTEL{Z 5jS?Έ;dnsmasq/images/template.gif0000644000000000000000000000356006771443034015005 0ustar rootrootGIF89a0UUU999rrr!Made with GIMP,0 8AZdiӠhksh߶L|G,rY̥q0 Ԓ0-]%6AkX=Q}~T{Moa-W~~x,vuc&$xa4eSyu`g$bͽ~ʣ `lˁj\QԸꪀ>"{9ۗFḃYWͳ?QdƌJf)hcv'w+#1|XgO-ahB (`DZڄU.EbP FKD[B< [Ŝ" JÞi0*a -VI@ \( I /*!0@*>Lhp20:v6V.᧲.Ԛa& 9M$bE\ d"uKw;_a_J]6㰣'yDt3WA3i6In:&Q,~tj'-W{!ϵ 71w^w P 8hY 2T\mS|FG]څGEvM1%!U.#pGDeV+.ע>>Y68duZ&8\GM}gMY{U.٢XX&#)kpKL(XF1M\Jh#Ma&qrYF*]AhF9hT)L\]1lfj`\㩝pyV*M֪|8tY.$>\)(vJ:(܆N۬n/{'^yySU洦gj5ۃ-,䮳%K5;[~,|ӌJ:uzA࠿d^8)W1ʩz)nj. zÇ9scm%Z[=Sy\ So]5E_]K[+uO5Sn3 bM Ēܶэ5rmBN!-?58Ŕ hOk~ }3^Q8Yκi{=8'r;+pڛͻz*r4[0k&<#/$q;֜tŅ" C Mtv0_+PI 7 >⁲$*F,N|H}t>YxT7s=X!ZÓJsؿd ;v尋F`%-xG#6. .O8xdH!D춨XjXϢV>q7c @<2_V1X^F p\2)Ѹ'OEf'$Gce˲eҐٛD/rI4ڥ@,+'6dlT T(7!@*:!,&ɴ< }h&iRUiџ ηibkCfPM~O('%Sfxy:5v*_I6m =Hn$z4Z(Q\e >5 DnRۘj4 W百5%&Gi:fXJQ-IXq" :xFS|`H ɔj--{ DGjRv-[rzhhGKҚiWֺ6{lgKڢ ͭnwk\ pEr=ߒ:}t+R5.K;dnsmasq/images/up.gif0000644000000000000000000000014710506373750013612 0ustar rootrootGIF89arrr!Made with GIMP! ,& |'Io|b%eRG;Ssf;dnsmasq/images/down.gif0000644000000000000000000000015410506373750014133 0ustar rootrootGIF89arrr!Made with GIMP! ,+@"IUieJbA I m.dN;dnsmasq/images/gap.gif0000644000000000000000000000011110506375201013715 0ustar rootrootGIF89a!Made with GIMP! ,ڋ>;dnsmasq/module.info0000644000000000000000000000014210501433425013356 0ustar rootrootname=DNSMasq desc=DNSMasq integrated DNS & DHCP servers os_support= depends=0.77 category=servers dnsmasq/index.cgi0000755000000000000000000000753110512641067013030 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - index.cgi; basic DNS config # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks &header($text{'index_title'}, "", "intro", 1, 1, undef, "Written by Neil Fisher
Author
Home://page"); # uses the index_title entry from ./lang/en or appropriate ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure # output as web page &header( "DNSMasq settings", "" ); &parse_config_file( \%config, \$config_file ); print "
\n"; if( $config{errors} > 0 ) { print "

WARNING: found "; print $config{errors}; print "errors in config file!


\n"; } print &ui_form_start( 'basic_apply.cgi', "post" ); print "
\n"; print "

$text{'DNS_settings'}

"; print "

\n"; print $text{'local_domain'}; print &ui_textbox( "local_domain", $config{domain}{domain}, 32 ); print "

\n"; print $text{'domain_needed'}; print &ui_yesno_radio( "domain_needed", ($config{domain_needed}{used})?1:0 ); print "

\n"; print $text{'expand_hosts'}; print &ui_yesno_radio( "expand_hosts", ($config{expand_hosts}{used})?1:0 ); print "

\n"; print $text{'bogus_priv'}; print &ui_yesno_radio( "bogus_priv", ($config{bogus_priv}{used})?0:1 ); print "

\n"; print $text{'filterwin2k'}; print &ui_yesno_radio( "filterwin2k", ($config{filterwin2k}{used})?1:0 ); print "

\n"; print $text{'hosts'}; print &ui_yesno_radio( "hosts", ($config{no_hosts}{used}?0:1) ); print "
\n"; print $text{'xhosts'}; print &ui_yesno_radio( "xhosts", ($config{addn_hosts}{used}?1:0) ); print "
\n"; print $text{'xhostsfile'}; print &ui_textbox( "addn_hosts", $config{addn_hosts}{file}, 40 ); print "

\n"; print $text{'neg_cache'}; print &ui_yesno_radio( "neg_cache", ($config{neg_cache}{used}?0:1) ); print "

\n"; print $text{'cache_size'}; print &ui_yesno_radio( "cache_size", ($config{cache_size}{used}?1:0) ); print "
\n"; print $text{'cust_cache_size'}; print &ui_textbox( "cust_cache_size", $config{cache_size}{size}, 40 ); print "

\n"; print $text{'log_queries'}; print &ui_yesno_radio( "log_queries", ($config{log_queries}{used}?1:0) ); print "

\n"; print $text{'local_ttl'}; print &ui_yesno_radio( "local_ttl", ($config{local_ttl}{used}?1:0) ); print "
\n"; print $text{'ttl'}; print &ui_textbox( "ttl", $config{local_ttl}{ttl}, 40 ); print "

\n"; print &ui_submit( $text{'save_button'} ); print &ui_form_end( ); print "
"; print ""; print $text{'servers_config'}; print "
"; print ""; print $text{'iface_config'}; print "
"; print ""; print $text{'alias_config'}; print "
"; print "
"; print ""; print $text{'DHCP_config'}; print "
"; print "
"; print ""; print $text{'restart'}; print "
"; &footer("/", $text{'index'}); # uses the index entry in /lang/en ## if subroutines are not in an extra file put them here ### END of index.cgi ###. dnsmasq/acl_security.pl0000644000000000000000000000056107000420647014246 0ustar rootroot # acl_security_form(&options) # Output HTML for editing security options for the apache module sub acl_security_form { ## Here you have to fill in the code for output } # acl_security_save(&options) # Parse the form for security options for the apache module sub acl_security_save { ## here you have to fill in the handling code for the saving the ACL } ### END.dnsmasq/lang/0000755000000000000000000000000010512641175012145 5ustar rootrootdnsmasq/lang/en0000644000000000000000000000766610512637344012514 0ustar rootroot lang=en author=Neil Fisher module_author=Neil Fisher homepage=www.nonexistent.invalid copyright=(C) 2006 by Neil Fisher license=GPL index_title=DNSMasq - integrated DNS and DHCP servers DNS_settings=Basic DNS settings DHCP_settings=DHCP settings DNS_servers=DNS Upstream Servers Configuration iface_settings=Network Interface Settings alias_settings=Alias / Redirect Settings local_domain=Local domain name domain_needed=Only forward names with a domain part expand_hosts=Add local domain name to DHCP leases & hosts in /etc/hosts bogus_priv=Allow unresolved reverse lookups on local network to propogate out filterwin2k=Prevent windows SOA & SRV requests propogating out resolv=Read /etc/resolv.conf poll=poll resolv.conf file resolv_file_explicit=Use non-standard resolv.conf file resolv_file=non-standard resolv.conf file to use strict_order=Always use nameservers in order provided hosts=Read /etc/hosts file xhosts=Use additional hosts file xhostsfile=File to use for additional hosts neg_cache=Cache negative responses log_queries=Log each DNS lookup cache_size=Use custom cache size cust_cache_size=Custom cache size to use local_ttl=Use specified local Time-To-Live ttl=Local TTL dynamic=Defined in resolv.conf file domain=For domain address=IP address in_use=In use used=In Use not_used=Defined only (not used) in_file=Defined in config file new_dns_serv=Add new upstream server to config file save_button=Save servers_config=Configure upstream DNS Servers alias_config=Configure Forced Domains and Alias responses iface_config=Configure network interfaces DHCP_config=Configure DHCP restart=Restart DNSmasq restarting=Trying to restart DNSmasq. Script messages are: srv_edit=Edit upstream DNS server srv_named=For specific domain srv_name=Specific domain srv_addr=Server address delet=Delete iface=Interface xiface=Except Interface listen=Listen on new_iface=Add new interface iface_listen=Interface to listen on xiface_listen=Except interfaces listen_addr=Listen Address new_addr=Add new address edit_iface=Edit interface iface_name=Interface name edit_xiface=Edit except interface listen_name=Listen address edit_listen=Edit listen address xiface_name=Except interface name bind_iface=Bind to individual interfaces instead of wildcard address forced=Forced domain responses nx=Forced NXDOMAIN IP addresses alias=Aliased IP addresses forced_domain=Domain name forced_ip=To IP address forced_from=From IP address forced_mask=Netmask forced_mask_used=Use a netmask forced_add=Add new forced domain alias_add=Add new alias nx_add=Add new forced NXDOMAIN forced_edit=Edit forced domain reponse alias_edit=Edit IP address alias nx_edit=Edit Forced NXDOMAIN response net_id=Network/Client ID timed=Use a lease time leasetime=Lease time dhcp_range=DHCP IP address ranges range_edit=Edit DHCP range range_add=Add new DHCP range ided=Network ID id=Network ID to use hosts=Specific Hosts host_add=Add a new host specification vendor_classes=Vendor Class Specification user_classes=User Class Specification vendor=Vendor user=User class=Class vend_add=Add new vendor class user_add=Add new user class read_ethers=Read /etc/ethers for lease info misc=Miscellaneous DHCP options dhcp_options=Non-standard DHCP options dhcp_option=Option dhcp_add=Add new option edit_host=Edit DHCP host specification edit_opt=Edit DHCP options opt_spec=DHCP option specification use_bootp=Use BOOTP (network boot) bootp_host=Hostname bootp_file=File bootp_address=IP Address max_leases=Maximum number of leases to grant leasefile=Use a nonstandard lease file lfikletouse=Nonstandard leasefile to use error_heading=Warning - ERROR!!!! err_line=Error in line: err_type=Type of error is: err_help=Try going back and retyping the offending information err_notip=Not a valid IP address err_notmask=Not a valid netmask err_nottime=not a valid time err_configbad=Configuration file has an error err_filebad=Bad file name err_hostbad=Bad host name err_numbbad=Bad number err_domainbad=Bad domain err_namebad=Bad name dnsmasq/lang/en~0000644000000000000000000000034407076651262012702 0ustar rootroot lang=en author=Name of language file author here module_author=Writers name here homepage=modules homepage url here copyright=(C) YYYY by author license=GPL your_message=here you have to write your messages dnsmasq/.index.cgi.swp0000644000000000000000000003000010475225557013710 0ustar rootrootb0VIM 6.3R+DB#staffupstairs.localnet~staff/template/index.cgi3210#"! UtpIad$\ IV U R Q = 7    ] B A 5 4   ~ z w u t _ E C   x w v \ ### END of### END of index.cgi ###.## if subroutines are not in an extra file put them here# uses the index entry in /lang/en&footer("/", $text{'index'});&header( "DNSmasq configuration", "" );} print "$key = $config{$key}
";{foreach my $key (%config)# output as web page} } } $config{"$line"}=1; { else } $config{"$1"}=$2; { if ($line =~ /(.*)\=(.*)/) next if( $line =~ /^\#/ ); { if (defined ($line)){foreach my $line (@$config_file)my %config;# pass into data structure$config_file = &read_file_lines( "/etc/dnsmasq.conf" );# read config file## Insert Output code here# uses the index_title entry from ./lang/en or appropriate "Written by Neil Fisher
Author
Home://page");&header($text{'index_title'}, "", "intro", 1, 1, undef,## sanity checks## put in ACL checks here if needed%access=&get_module_acl;&init_config("MODULENAME");$|=1;do '../web-lib.pl';# This module inherited from the Webmin Module Template 0.79.1 by tn## GNU General Public License for more details.# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# but WITHOUT ANY WARRANTY; without even the implied warranty of# This program is distributed in the hope that it will be useful,## (at your option) any later version.# the Free Software Foundation; either version 2 of the License, or# it under the terms of the GNU General Public License as published by# This program is free software; you can redistribute it and/or modify# # Copyright (C) 2006 by Neil Fisher# DNSMasq Webmin Module ##!/usr/bin/perldnsmasq/srv_edit.cgi0000755000000000000000000000450310512323643013531 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - dns_edit.cgi; upstream server edit # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{srv_edit}."

"; print &ui_form_start( "srv_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{servers}[$in{idx}]{used})?1:0 ); print "
".$text{srv_named}.&ui_yesno_radio( "named", ($config{servers}[$in{idx}]{domain_used})?1:0 ); print "
".$text{srv_name}; print &ui_textbox( "name", $config{servers}[$in{idx}]{domain}, 50 ); print "
".$text{srv_addr}; print &ui_textbox( "addr", $config{servers}[$in{idx}]{address}, 18 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; #print "".$text{delet}.""; print "
".$text{servers_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of dns_edit.cgi ###. dnsmasq/dnsmasq-lib.pl0000755000000000000000000003354710512631060014002 0ustar rootroot# # dnsmasq-lib.pl # # dnsmasq webmin module library module # # # the config hash holds the parsed config file # my %config = { errors => 0, mx_host => { used => 0, line => 0, host => "" }, mx_target => { used => 0, line => 0, host => "" }, selfmx => { used => 0, line => 0 }, localmx => { used => 0, line => 0 }, domain_needed => { line => 0, used => 0 }, bogus_priv => { line =>0, used => 0 }, filterwin2k => { line => 0, used => 0 }, resolv_file => { line => 0, used => 0, filename => "/etc/hosts" }, strict_order => { line => 0, used => 0 }, no_resolv => { line => 0, used => 0 }, no_poll => { line => 0, used => 0 }, servers => [], locals => [], forced => [], bogus => [], user => { used => 0, user =>"" }, group => { used => 0, group => "" }, interface => [], ex_interface => [], listen_on => [], alias => [], bind_interfaces => { used => 0, line => 0 }, no_hosts => { used => 0, line => 0 }, addn_hosts => { used => 0, line => 0, file => "" }, expand_hosts => { used => 0, line => 0 }, domain => { used => 0, line => 0, domain => "" }, cache_size => { used => 0, line =>0, size => 0 }, neg_cache => { used => 0, line => 0 }, local_ttl => { used => 0, line => 0, ttl => 0 }, log_queries => { used => 0, line => 0 }, dhcp_range => [], dhcp_host => [], vendor_class => [], user_class => [], dhcp_option => [], dhcp_boot => { used => 0, line => 0, file => "", host => "", address => "" }, dhcp_leasemax => { used => 0, line => 0, max => 0 }, dhcp_leasefile => { used => 0, line => 0, file => "" }, dhcp_ethers => { used => 0, line => 0 } }; # # parse the configuration file and populate the %config structure # sub parse_config_file { my $lineno; my $config = shift; my $config_file = shift; $IPADDR = "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"; $NAME = "[a-zA-Z\_\.][0-9a-zA-Z\_\.]*"; $TIME = "[0-9}+[h|m]*"; $FILE = "[0-9a-zA-Z\_\-\.\/]+"; $NUMBER="[0-9]+"; $lineno=-1; foreach my $line (@$$config_file) { my $subline; my %temp; $lineno++; if (defined ($line)) { # # we always use regexp starting with # ^[\#]*[\s]* # because that allows for a commented out line with # possibly space(s) between the comment marker and keyword # while rejecting any comments that carry our keyword # # reject lines blank at start! next if ($line !~ /^[0-9a-zA-Z\_\-\#]/); # MX records server? if ( $line =~ /(^[\#]*[\s]*mx-host)\=([0-9a-zA-Z\.\-]*)/ ) { } elsif ($line =~ /(^[\#]*[\s]*mx-target)\=([0-9a-zA-Z\.\-]*)/ ) { } elsif ($line =~ /^[\#]*[\s]*selfmx/ ) { $$config{selfmx}{line}=$lineno; $$config{selfmx}{used}=($line !~ /^\#/); } elsif ($line =~ /^[\#]*[\s]*localmx/ ) { $$config{localmx}{line}=$lineno; $$config{localmx}{used}=($line !~ /^\#/); } # forward names witout a domain? elsif ($line =~ /^[\#]*[\s]*domain-needed/ ) { $$config{domain_needed}{used}=($line!~/^\#/); $$config{domain_needed}{line}=$lineno; } #forward names in nonrouted address space? elsif ($line =~ /^[\#]*[\s]*bogus-priv/ ) { $$config{bogus_priv}{used}=($line!~/^\#/); $$config{bogus_priv}{line}=$lineno; } # filter windows wierdo names? elsif ($line =~ /^[\#]*[\s]*filterwin2k/ ) { $$config{filterwin2k}{used}=($line!~/^\#/); $$config{filterwin2k}{line}=$lineno; } # resolv.conf file elsif ($line =~ /(^[\#]*[\s]*resolv-file\=)([0-9a-zA-Z\/\.\-]*)/ ) { $$config{resolv_file}{filename}=$2; $$config{resolv_file}{line}=$lineno; $$config{resolv_file}{used}=($line!~/^\#/); } # any resolv.conf file at all? elsif ($line =~ /^[\#]*[\s]*no-resolv/ ) { $$config{no_resolv}{used}=($line!~/^\#/); $$config{no_resolv}{line}=$lineno; } # upstream servers in order? elsif ($line =~ /^[\#]*[\s]*strict-order/ ) { $$config{strict_order}{used}=($line!~/^\#/); $$config{strict_order}{line}=$lineno; } # check resolv. conf regularly? elsif ($line =~ /^[\#]*[\s]*no-poll/ ) { $$config{no_poll}{used}=($line!~/^\#/); $$config{no_poll}{line}=$lineno; } # extra name servers? elsif ($line =~ /(^[\#]*[\s]*server\=)([0-9a-zA-Z\.\-\/]*)/ ) { $subline=$2; %temp = {}; if( $subline =~ /\/($NAME)\/($IPADDR)/ ) { $temp{domain}=$1; $temp{domain_used}=1; $temp{address}=$2; $temp{line}=$lineno; $temp{used}= ($line !~ /^\#/); push @{ $$config{servers} }, { %temp }; } elsif( $subline =~ /($IPADDR)/ ) { $temp{domain}=""; $temp{domain_used}=0; $temp{address}=$1; $temp{line}=$lineno; $temp{used}= ($line !~ /^\#/); push @{ $$config{servers} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } # local-only domains elsif ($line =~ /(^[\#]*[\s]*local\=)([0-9a-zA-Z\.\-\/]*)/ ) { $subline=$2; %temp={}; if( $subline =~ /\/($NAME)\// ) { $temp{domain}=$1; $temp{lineno}=$lineno; $temp{used}=($line !~ /^\#/); push @{ $$config{locals} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } # force lookups to addresses elsif ($line =~ /(^[\#]*[\s]*address\=)([0-9a-zA-Z\.\-\/]*)/ ) { $subline=$2; %temp = {}; if( $subline =~ /\/($NAME)\/($IPADDR)/ ) { $temp{line}=$lineno; $temp{domain}=$1; $temp{addr}=$2; $temp{used}=($line !~ /^\#/); push @{ $$config{forced} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } # deprecated /etc/ppp/resolv.conf permissions elsif ($line =~ /(^[\#]*[\s]*user\=)([0-9a-zA-Z\.\-\/]*)/ ) { } elsif ($line =~ /(^[\#]*[\s]*group\=)([0-9a-zA-Z\.\-\/]*)/ ) { } # where and how do we listen? elsif ($line =~ /(^[\#]*[\s]*listen-address\=)([0-9\.]*)/ ) { $subline=$2; %temp = {}; if( $subline =~ /($IPADDR)/ ) { $temp{line}=$lineno; $temp{address}=$1; $temp{used}= ($line !~ /^\#/); push @{ $$config{listen_on} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } elsif ($line =~ /(^[\#]*[\s]*except-interface\=)([0-9a-zA-Z\.\-\/]*)/ ) { $subline=$2; %temp = {}; if( $subline =~ /($NAME)/ ) { $temp{line}=$lineno; $temp{iface}=$1; $temp{used}= ($line !~ /^\#/); push @{ $$config{ex_interface} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } elsif ($line =~ /(^[\#]*[\s]*interface\=)([0-9a-zA-Z\.\-\/]*)/ ) { $subline=$2; %temp = {}; if( $subline =~ /($NAME)/ ) { $temp{line}=$lineno; $temp{iface}=$1; $temp{used}= ($line !~ /^\#/); push @{ $$config{interface} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } elsif ($line =~ /^[\#]*[\s]*bind-interfaces/ ) { $$config{bind_interfaces}{used}=($line!~/^\#/); $$config{bind_interfaces}{line}=$lineno; } # hosts file elsif ($line =~ /^[\#]*[\s]*no-hosts/ ) { $$config{no_hosts}{used}=($line!~/^\#/); $$config{no_hosts}{line}=$lineno; } elsif ($line =~ /(^[\#]*[\s]*addn-hosts\=)([0-9a-zA-Z\_\.\-\/]*)/ ) { $$config{addn_hosts}{line}=$lineno; $$config{addn_hosts}{file}=$2; $$config{addn_hosts}{used}=($line!~/^\#/); } # add domain to hosts file? elsif ($line =~ /^[\#]*[\s]*expand-hosts/ ) { $$config{expand_hosts}{used}=($line!~/^\#/); $$config{expand_hosts}{line}=$lineno; } # translate wild-card responses to NXDOMAIN elsif ($line =~ /(^[\#]*[\s]*bogus-nxdomain\=)([0-9\.]*)/ ) { $subline=$2; %temp = {}; if( $subline =~ /($IPADDR)/ ) { $temp{line}=$lineno; $temp{addr}=$1; $temp{used}= ($line !~ /^\#/); push @{ $$config{bogus} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } # local domain elsif ($line =~ /(^[\#]*[\s]*domain\=)([0-9a-zA-Z\.\-\/]*)/ ) { $$config{domain}{line}=$lineno; $$config{domain}{domain}=$2; $$config{domain}{used}=($line!~/^\#/); } # cache size elsif ($line =~ /(^[\#]*[\s]*cache-size\=)([0-9]*)/ ) { $$config{cache_size}{line}=$lineno; $$config{cache_size}{size}=$2; $$config{cache_size}{used}=($line !~/^\#/); } # negative cache elsif ($line =~ /(^[\#]*[\s]*no-negcache)/ ) { $$config{neg_cache}{line}=$lineno; $$config{neg_cache}{used}=($line !~/^\#/); } # local ttl elsif ($line =~ /(^[\#]*[\s]*local-ttl\=)([0-9]*)/ ) { $$config{local_ttl}{line}=$lineno; $$config{local_ttl}{ttl}=$2; $$config{local_ttl}{used}=($line !~/^\#/); } # log requests? elsif ($line =~ /(^[\#]*[\s]*log-queries)/ ) { $$config{log_queries}{line}=$lineno; $$config{log_queries}{used}=($line !~/^\#/); } # alias IP addresses elsif ($line =~ /(^[\#]*[\s]*alias\=)([0-9\.\,]*)/ ) { $subline=$2; %temp = {}; if( $subline =~ /($IPADDR)\,($IPADDR)\,($IPADDR)/ ) { # with netmask $temp{line}=$lineno; $temp{from}=$1; $temp{to}=$2; $temp{netmask}=$3; $temp{netmask_used}=1; $temp{used}= ($line !~ /^\#/); push @{ $$config{alias} }, { %temp }; } elsif( $subline =~ /($IPADDR)\,($IPADDR)/ ) { # no netmask $temp{line}=$lineno; $temp{from}=$1; $temp{to}=$2; $temp{netmask}=0; $temp{netmask_used}=0; $temp{used}= ($line !~ /^\#/); push @{ $$config{alias} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } # DHCP # address range to use elsif ($line =~ /(^[\#]*[\s]*dhcp-range\=)([0-9a-zA-Z\.\,\-\_]*)/ ) { %temp={}; $subline=$2; $temp{line}=$lineno; $temp{used}=($line !~/^\#/); if ($subline =~ /^($NAME)\,($IPADDR)\,($IPADDR)\,($IPADDR)(\,*)(\d*[mh]*)/ ) { # network id, start, end, netmask, time (optionally) $temp{id}=$1; $temp{id_used}=1; $temp{start}=$2; $temp{end}=$3; $temp{mask}=$4; $temp{mask_used}=1; $temp{leasetime}=$6; $temp{time_used}=($6 =~ /^\d/); $temp{used} =( $line !~ /^\#/ ); push @{ $$config{dhcp_range} }, { %temp }; } elsif ($subline =~ /^($NAME)\,($IPADDR)\,($IPADDR)(\,*)(\d*[mh]*)/ ) { # network id, start, end, time (optionally) $temp{id}=$1; $temp{id_used}=1; $temp{start}=$2; $temp{end}=$3; $temp{mask}=""; $temp{mask_used}=0; $temp{leasetime}=$5; $temp{time_used}=($5 =~ /^\d/); $temp{used} =( $line !~ /^\#/ ); push @{ $$config{dhcp_range} }, { %temp }; } elsif ($subline =~ /^($IPADDR)\,($IPADDR)\,($IPADDR)(\,*)(\d*[mh]*)/ ) { # start, end, netmask, time (optionally) $temp{id}=""; $temp{id_used}=0; $temp{start}=$1; $temp{end}=$2; $temp{mask}=$3; $temp{mask_used}=1; $temp{leasetime}=$5; $temp{time_used}=($5 =~ /^\d/); $temp{used} =( $line !~ /^\#/ ); push @{ $$config{dhcp_range} }, { %temp }; } elsif ($subline =~ /^($IPADDR)\,($IPADDR)(\,*)(\d*[mh]*)/ ) { # start, end, time (optionally) $temp{id}=""; $temp{id_used}=0; $temp{start}=$1; $temp{end}=$2; $temp{mask}=""; $temp{mask_used}=0; $temp{leasetime}=$4; $temp{time_used}=($4 =~ /^\d/); $temp{used} =( $line !~ /^\#/ ); push @{ $$config{dhcp_range} }, { %temp }; } else { print "Error in line $lineno!"; $$config{errors}++; } } # specify hosts elsif ($line =~ /(^[\#]*[\s]*dhcp-host\=)([0-9a-zA-Z\.\:\,\*]*)/) { # too many to classify - all as string! %temp = {}; $temp{line}=$lineno; $temp{option}=$2; $temp{used}=($line !~/^\#/); push @{ $$config{dhcp_host} }, { %temp }; } # vendor class elsif ($line =~ /(^[\#]*[\s]*dhcp-vendorclass\=)($NAME)\,($NAME)/ ) { %temp = {}; $temp{line}=$lineno; $temp{class}=$2; $temp{vendor}=$3; $temp{used}=($line !~/^\#/); push @{ $$config{vendor_class} }, { %temp }; } # user class elsif ($line =~ /(^[\#]*[\s]*dhcp-userclass\=)($NAME)\,($NAME)/ ) { %temp = {}; $temp{line}=$lineno; $temp{class}=$2; $temp{user}=$3; $temp{used}=($line !~/^\#/); push @{ $$config{user_class} }, { %temp }; } # /etc/ethers? elsif ($line =~ /(^[\#]*[\s]*read-ethers)/ ) { $$config{dhcp_ethers}{line}=$lineno; $$config{dhcp_ethers}{used}=($line !~/^\#/); } # dchp options elsif ($line =~ /(^[\#]*[\s]*dhcp-option\=)([0-9a-zA-Z\,\_\.]*)/ ) { # too many to classify - all as string! %temp = {}; $temp{line}=$lineno; $temp{option}=$2; $temp{used}=($line !~/^\#/); push @{ $$config{dhcp_option} }, { %temp }; } # lease time elsif ($line =~ /(^[\#]*[\s]*dhcp-lease-max\=)([0-9]*)/ ) { $$config{dhcp_leasemax}{line}=$lineno; $$config{dhcp_leasemax}{max}=$2; $$config{dhcp_leasemax}{used}=($line !~/^\#/); } # bootp host & file elsif ($line =~ /(^[\#]*[\s]*dhcp-boot\=)([0-9a-zA-Z0-9\,\_\.\/]*)/ ) { $subline=$2; if( $subline =~ /([0-9a-zA-Z\.\-\_\/]+)\,($NAME)\,($IPADDR)/ ) { $$config{dhcp_boot}{line}=$lineno; $$config{dhcp_boot}{file}=$1; $$config{dhcp_boot}{host}=$2; $$config{dhcp_boot}{address}=$3; $$config{dhcp_boot}{used}=($line !~/^\#/); } } # leases file elsif ($line =~ /(^[\#]*[\s]*dhcp-leasefile\=)([0-9a-zA-Z0-9\_\.\/]*)/ ) { $$config{dhcp_leasefile}{line}=$lineno; $$config{dhcp_leasefile}{file}=$2; $$config{dhcp_leasefile}{used}=($line !~/^\#/); } else { # everything else that's not a comment # we don't understand so it may be an error! if( $line !~ /^#/ ) { $config{errors}++; } } } } } #end of sub read_config_file # # update the config file array # # arguments are: # $lineno - the line number (array index) to update # $text - the new contents of the line # $file - reference to the array to change # $comm - put a comment marker ('#') at start of line? # false (0) means comment the line # sub update { my $lineno = shift; my $text = shift; my $file = shift; my $comm = shift; my $line; $line = ( $comm != 0 ) ? $text : "#" . $text; if( $lineno == 0 ) { push @$file, $line; } else { @$file[$lineno]=$line; } } # end of sub update 1; dnsmasq/servers.cgi0000755000000000000000000000704010512350076013402 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - server.cgi; Upstream Servers config # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks &header($text{'index_title'}, "", "intro", 1, 1, undef, "Written by Neil Fisher
Author
Home://page"); # uses the index_title entry from ./lang/en or appropriate ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure # output as web page my $count=0; &header( "DNSMasq settings", "" ); &parse_config_file( \%config, \$config_file ); print "

"; print $text{'DNS_servers'}; print "

"; print &ui_form_start( "srv_apply.cgi", "post" ); print "

".$text{dynamic}."

"; print $text{resolv}; print &ui_yesno_radio( "resolv", ($config{no_resolv}{used}?0:1) ); print "
".$text{resolv_file_explicit}; print &ui_yesno_radio( "resolv_std", ($config{resolv_file}{used}?1:0) ); print "
".$text{resolv_file}; print &ui_textbox( "resolv_file", $config{resolv_file}{filename}, 50 ); print "

".$text{poll}."
"; print &ui_yesno_radio( "poll", ($config{no_poll}{used}?0:1) ); print "

".$text{strict_order}; print &ui_yesno_radio( "strict", ($config{strict_order}{used}?1:0) ); print "

".$text{in_file}."

"; print &ui_columns_start( [ $text{domain}, $text{address}, $text{in_use}, "" ], 100 ); foreach my $server ( @{$config{servers}} ) { local ( $mover, $edit ); if( $count == @{$config{servers}}-1 ) { $mover=""; } else { $mover = ""; } if( $count == 0 ) { $mover.=""; } else { $mover .= ""; } $edit = "".$$server{address}.""; print &ui_columns_row( [ $$server{domain}, $edit, ($$server{used})?$text{used}:$text{not_used}, $mover ], [ "width=30%", "width=30%", "width=30%", "width=10%" ] ); $count++; } print &ui_columns_end(); print "
". $text{new_dns_serv}."
"; print "
" . &ui_submit( $text{'save_button'} ); print &ui_form_end(); print "
"; print ""; print $text{'DNS_settings'}; print "
"; print ""; print $text{'iface_config'}; print "
"; print ""; print $text{'alias_config'}; print "
"; print "
"; print ""; print $text{'DHCP_config'}; print "
"; &footer("/", $text{'index'}); # uses the index entry in /lang/en ## if subroutines are not in an extra file put them here ### END of servers.cgi ###. dnsmasq/iface.cgi0000755000000000000000000000711710512345430012763 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - iface.cgi; network interfaces # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks &header($text{'index_title'}, "", "intro", 1, 1, undef, "Written by Neil Fisher
Author
Home://page"); # uses the index_title entry from ./lang/en or appropriate ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure # output as web page my $count=0; &header( "DNSMasq settings", "" ); &parse_config_file( \%config, \$config_file ); print "

"; print $text{'iface_listen'}; print "

"; print &ui_columns_start( [ $text{iface}, $text{in_use} ], 100 ); foreach my $iface ( @{$config{interface}} ) { my $edit = "".$$iface{iface}.""; print &ui_columns_row( [ $edit, ($$iface{used})?$text{used}:$text{not_used} ], [ "width=30%", "width=30%", "width=30%" ] ); $count++; } print &ui_columns_end(); print "
". $text{new_iface}."
"; print "

"; print $text{'xiface_listen'}; print "

"; $count=0; print &ui_columns_start( [ $text{xiface}, $text{in_use} ], 100 ); foreach my $iface ( @{$config{ex_interface}} ) { my $edit = "".$$iface{iface}.""; print &ui_columns_row( [ $edit, ($$iface{used})?$text{used}:$text{not_used} ], [ "width=30%", "width=30%", "width=30%" ] ); $count++; } print &ui_columns_end(); print "
". $text{new_iface}."
"; print "

"; print $text{'listen_addr'}; print "

"; $count=0; print &ui_columns_start( [ $text{listen_addr}, $text{in_use} ], 100 ); foreach my $iface ( @{$config{listen_on}} ) { my $edit = "".$$iface{address}.""; print &ui_columns_row( [ $edit, ($$iface{used})?$text{used}:$text{not_used} ], [ "width=30%", "width=30%", "width=30%" ] ); $count++; } print &ui_columns_end(); print "
"; print "
". $text{new_addr}."

"; print &ui_form_start( 'iface_apply.cgi', "post" ); print $text{bind_iface}; print &ui_yesno_radio( "bind_iface", ($config{bind_interfaces}{used})?1:0 ); print "
".&ui_submit( $text{save_button} ); print &ui_form_end(); print "

".$text{'DNS_settings'}."
"; print "".$text{'servers_config'}."
"; print "".$text{'alias_config'}."
"; print "
"; print ""; print $text{'DHCP_config'}; print "
"; &footer("/", $text{'index'}); # uses the index entry in /lang/en ## if subroutines are not in an extra file put them here ### END of iface.cgi ###. dnsmasq/iface_edit.cgi0000755000000000000000000000406110512324451013763 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - iface_edit.cgi; edit interface # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{edit_iface}."

"; print &ui_form_start( "iface_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{interface}[$in{idx}]{used})?1:0 ); print "
".$text{iface_name}; print &ui_textbox( "iface", $config{interface}[$in{idx}]{iface}, 50 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{iface_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of iface_edit.cgi ###. dnsmasq/help/0000755000000000000000000000000010507121320012141 5ustar rootrootdnsmasq/help/intro.html0000644000000000000000000000202210507121320014156 0ustar rootroot
DNSmasq Configuration

Introduction to DNSmasq

DNSmasq is an integrated DNS caching proxy server and DHCP server designed to run on a host that is masquerading a local private network to the rest of the internet.

Configuring DNSmasq

In most cases, all you'll need to change will be the local domain name. Under some circumstances, you may want to change how DNSmasq resolves names to allow for other local nameservers (if for example you are using a VPN tunnel to another location).

All the functionality of DNSmasq is beyond the scope of this help file - please read the man pages!

Limitations

Please read the README file.
In Short, this is a quick and dirty implementation with virtually no error checking. Therefore, it assumes you know what you are doing!

Use with care!

If you enter a name where a IP address should be (for example) then you may need to edit the config file manually to remove or edit the offending line. YOU HAVE BEEN WARNED! dnsmasq/alias.cgi0000755000000000000000000000754010512627251013011 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - alias.cgi; aliasing and redirection # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure # output as web page &parse_config_file( \%config, \$config_file ); if( $config{errors} > 0 ) { my $line="error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } &header($text{'index_title'}, "", "intro", 1, 1, undef, "Written by Neil Fisher
Author
Home://page"); print "
\n"; # uses the index_title entry from ./lang/en or appropriate print "
\n"; print "

".$text{forced}."

"; print "

\n"; my $count=0; print &ui_columns_start( [ $text{forced_domain}, $text{forced_ip}, $text{in_use} ], 100 ); foreach my $frcd ( @{$config{forced}} ) { my $edit = "".$$frcd{domain}.""; print &ui_columns_row( [ $edit, $$frcd{addr}, ($$frcd{used}) ? $text{used} : $text{not_used} ], [ "width=30%", "width=30%", "width=30%" ] ); $count++; } print &ui_columns_end(); print "
\n"; print "". $text{forced_add}.""; print "
\n"; print "

\n"; print "
"; print "
\n"; print "

".$text{alias}."

"; print "

\n"; $count=0; print &ui_columns_start( [ $text{forced_from}, $text{forced_ip}, $text{forced_mask}, $text{in_use} ], 100 ); foreach my $frcd ( @{$config{alias}} ) { my $edit = "".$$frcd{from}.""; print &ui_columns_row( [ $edit, $$frcd{to}, ($$frcd{netmask_used}) ? $$frcd{netmask} : "255.255.255.255", ($$frcd{used}) ? $text{used} : $text{not_used} ], [ "width=25%", "width=25%", "width=25%", "width=25%" ] ); $count++; } print &ui_columns_end(); print "
\n"; print "". $text{alias_add}.""; print "
\n"; print "
"; print "
\n"; print "

".$text{nx}."

"; print "

\n"; $count=0; print &ui_columns_start( [ $text{forced_from}, $text{in_use} ], 100 ); foreach my $frcd ( @{$config{bogus}} ) { my $edit = "".$$frcd{addr}.""; print &ui_columns_row( [ $edit, ($$frcd{used}) ? $text{used} : $text{not_used} ], [ "width=50%", "width=50%" ] ); $count++; } print &ui_columns_end(); print "
\n"; print "". $text{nx_add}.""; print "
\n"; print "
"; print "

\n"; print "

\n"; print ""; print $text{'DNS_settings'}; print "
"; print ""; print $text{'DNS_servers'}; print "
"; print ""; print $text{'iface_config'}; print "
"; print "
"; print ""; print $text{'DHCP_config'}; print "
"; &footer("/", $text{'index'}); # uses the index entry in /lang/en ## if subroutines are not in an extra file put them here ### END of alias.cgi ###. dnsmasq/dhcp.cgi0000755000000000000000000001306010512347345012633 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - dhcp.cgi; DHCP config # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks &header($text{'index_title'}, "", "intro", 1, 1, undef, "Written by Neil Fisher
Author
Home://page"); # uses the index_title entry from ./lang/en or appropriate ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure # output as web page &header( "DNSMasq settings", "" ); &parse_config_file( \%config, \$config_file ); print "
\n"; if( $config{errors} > 0 ) { print "

WARNING: found "; print $config{errors}; print "errors in config file!


\n"; } print "
\n"; print "

$text{'DHCP_settings'}

"; print "


\n"; my $count; my $width; $count=0; $width="width=33%"; print "

".$text{vendor_classes}."

"; print &ui_columns_start( [ $text{class}, $text{vendor}, $text{in_use} ], 100 ); foreach my $range ( @{$config{vendor_class}} ) { my $edit = "".$$range{class}.""; print &ui_columns_row( [ $edit, $$range{vendor}, ($$range{used}) ? $text{used} : $text{not_used} ], [ $width, $width, $width ] ); $count++; } print &ui_columns_end(); print "
". $text{vend_add}."


"; $count=0; $width="width=33%"; print "

".$text{user_classes}."

"; print &ui_columns_start( [ $text{class}, $text{user}, $text{in_use} ], 100 ); foreach my $range ( @{$config{user_class}} ) { my $edit = "".$$range{class}.""; print &ui_columns_row( [ $edit, $$range{user}, ($$range{used}) ? $text{used} : $text{not_used} ], [ $width, $width, $width ] ); $count++; } print &ui_columns_end(); print "
". $text{user_add}."


"; $count=0; $width="20%"; print "

".$text{dhcp_range}."

"; print &ui_columns_start( [ $text{net_id}, $text{forced_from}, $text{forced_ip}, $text{forced_mask}, $text{leasetime}, $text{in_use} ], 100 ); foreach my $range ( @{$config{dhcp_range}} ) { my $edit = "".$$range{start}.""; print &ui_columns_row( [ $$range{id}, $edit, $$range{end}, $$range{mask}, $$range{leasetime}, ($$range{used}) ? $text{used} : $text{not_used} ], [ $width, $width, $width, $width, $width ] ); $count++; } print &ui_columns_end(); print "
". $text{range_add}."


"; $count=0; $width="width=50%"; print "

".$text{hosts}."

"; print &ui_columns_start( [ $text{hosts}, $text{in_use} ], 100 ); foreach my $range ( @{$config{dhcp_host}} ) { my $edit = "".$$range{option}.""; print &ui_columns_row( [ $edit, ($$range{used}) ? $text{used} : $text{not_used} ], [ $width, $width ] ); $count++; } print &ui_columns_end(); print "
". $text{host_add}."


"; $count=0; $width="width=50%"; print "

".$text{dhcp_options}."

"; print &ui_columns_start( [ $text{dhcp_option}, $text{in_use} ], 100 ); foreach my $range ( @{$config{dhcp_option}} ) { my $edit = "".$$range{option}.""; print &ui_columns_row( [ $edit, ($$range{used}) ? $text{used} : $text{not_used} ], [ $width, $width ] ); $count++; } print &ui_columns_end(); print "
". $text{dhcp_add}."


"; print &ui_form_start( 'dhcp_apply.cgi', "get" ); print "

".$text{misc}."


"; print $text{read_ethers}.&ui_yesno_radio( "ethers", ($config{dhcp_ethers}{used})?1:0 ); print "

".$text{use_bootp}.&ui_yesno_radio ( "bootp", ($config{dhcp_boot}{used})?1:0 ); print "
".$text{bootp_host}.&ui_textbox( "bootp_host", $config{dhcp_boot}{host}, 80 ); print "
".$text{bootp_file}.&ui_textbox( "bootp_file", $config{dhcp_boot}{file}, 80 ); print "
".$text{bootp_address}.&ui_textbox( "bootp_addr", $config{dhcp_boot}{address}, 80 ); print "

".$text{max_leases}.&ui_textbox( "max_leases", $config{dhcp_leasemax}{max}, 10 ); print "

".$text{leasefile}.&ui_yesno_radio( "useleasefile", ($config{dhcp_leasefile}{used})?1:0 ); print "
".$text{lfiletouse}.&ui_textbox( "leasefile", $config{dhcp_leasefile}{file}, 80 ); print "

".&ui_submit( $text{'save_button'} ); print &ui_form_end( ); print "


"; print $text{'DNS_settings'}; print "
"; &footer("/", $text{'index'}); # uses the index entry in /lang/en ## if subroutines are not in an extra file put them here ### END of dhcp.cgi ###. dnsmasq/restart.cgi0000755000000000000000000000300510507123056013372 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - restart.cgi; restart DNSmasq # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks &header($text{'index_title'}, "", "intro", 1, 1, undef, "Written by Neil Fisher
Author
Home://page"); # uses the index_title entry from ./lang/en or appropriate ## Insert Output code here # output as web page my $line=$config{restart}; &header( "DNSMasq settings", "" ); print $text{restarting} . "
"; print `$line`; print "

"; print $text{DNS_settings}; print ""; &footer("/", $text{'index'}); # uses the index entry in /lang/en ## if subroutines are not in an extra file put them here ### END of restart.cgi ###. dnsmasq/srv_apply.cgi0000755000000000000000000000415310512642213013727 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - srv_apply.cgi; update DNS server info # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check for input data errors if( ($in{resolv_std}) && ($in{resolv_file} !~ /^$FILE$/) ) { my $line = "error.cgi?line=".$text{resolv_file}; $line .= "&type=".$text{err_filebad}; &redirect( $line ); exit; } # adjust everything to what we got # # use resolv.conf? # &update( $config{no_resolv}{line}, "no-resolv", $config_file, ( $in{resolv} == 0 ) ); # # standard location for resolv.conf? # &update( $config{resolv_file}{line}, "resolv-file=".$in{resolv_file}, $config_file, ( $in{resolv_std} == 1 ) ); # # servers in order provided? # &update( $config{strict_order}{line}, "strict-order", $config_file, ( $in{strict} == 1 ) ); # # poll resolv.conf? # &update( $config{no_poll}{line}, "no-poll", $config_file, ( $in{poll} == 0 ) ); # # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "servers.cgi" ); # # sub-routines # ### END of srv_apply.cgi ###. dnsmasq/restart.sh0000755000000000000000000000034010506066357013252 0ustar rootroot#!/bin/bash echo "killing existing process PID is " cat /var/run/dnsmasq.pid kill -9 `cat /var/run/dnsmasq.pid` echo "done. Starting new process..." /usr/local/sbin/dnsmasq echo "Done. New PID is " cat /var/run/dnsmasq.pid dnsmasq/srv_move.cgi0000755000000000000000000000404510507102723013551 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - dns_move.cgi; move server # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # my $selected=$config{servers}[$in{idx}]{line}; if( $in{dir} eq "up" ) { $config{servers}[$in{idx}]{line}=$config{servers}[$in{idx}-1]{line}; $config{servers}[$in{idx}-1]{line}=$selected; } else { $config{servers}[$in{idx}]{line}=$config{servers}[$in{idx}+1]{line}; $config{servers}[$in{idx}+1]{line}=$selected; } foreach my $server (@{$config{servers}}) { $line= ($$server{domain_used}) ? "server=/".$$server{domain}."/".$$server{address} : "server=".$$server{address}; &update( $$server{line}, $line, $config_file, ($$server{used}) ); } # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "servers.cgi" ); # # sub-routines # ### END of dns_move.cgi ###. dnsmasq/srv_edit_apply.cgi0000755000000000000000000000364610512642225014745 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - srv_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check for input data errors if( $in{addr} !~ /^$IPADDR$/ ) { my $line = "error.cgi?line=".$text{srv_addr}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } if( ($in{named}) && ($in{name} !~ /^$NAME$/) ) { my $line = "error.cgi?line=".$text{srv_name}; $line .= "&type=".$text{err_domainbad}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="server="; $line .= ($in{named})?"/".$in{name}."/":""; $line .= $in{addr}; &update( $config{servers}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "servers.cgi" ); # # sub-routines # ### END of srv_edit_apply.cgi ###. dnsmasq/delete.cgi0000755000000000000000000000265410512627424013165 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - delete.cgi; delete a line # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line="error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # adjust everything to what we got # # &update( $config{$in{what}}[$in{idx}]{line}, "", $config_file, 0 ); &flush_file_lines(); &redirect( $in{where} ); # # sub-routines # ### END of delete.cgi ###. dnsmasq/xiface_edit.cgi0000755000000000000000000000410410512343715014155 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - xiface_edit.cgi; edit except interface # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{edit_xiface}."

"; print &ui_form_start( "xiface_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{ex_interface}[$in{idx}]{used})?1:0 ); print "
".$text{xiface_name}; print &ui_textbox( "iface", $config{ex_interface}[$in{idx}]{iface}, 50 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "". $text{delet}.""; print "
< a href=iface.cgi>".$text{iface_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of xiface_edit.cgi ###. dnsmasq/listen_edit.cgi0000755000000000000000000000407010512324553014215 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - listen_edit.cgi; edit listen on # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{edit_listen}."

"; print &ui_form_start( "listen_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{listen_on}[$in{idx}]{used})?1:0 ); print "
".$text{listen_name}; print &ui_textbox( "addr", $config{listen_on}[$in{idx}]{address}, 50 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{iface_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of listen_edit.cgi ###. dnsmasq/nx_edit.cgi0000755000000000000000000000402510512324660013343 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - nx_edit.cgi; edit forced NXDOMAIN # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{bogus}."

"; print &ui_form_start( "nx_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print $text{forced_from}. &ui_textbox( "from", $config{bogus}[$in{idx}]{addr}, 15 ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{bogus}[$in{idx}]{used})?1:0 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{alias_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of nx_edit.cgi ###. dnsmasq/add.cgi0000755000000000000000000000265010512627117012446 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - add.cgi; add a line # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line="error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # adjust everything to what we got # push @{$config_file}, "#".$in{what}; # # write file!! &flush_file_lines(); # # re-load basic page &redirect( $in{where} ); # # sub-routines # ### END of add.cgi ###. dnsmasq/README0000644000000000000000000000425510512644024012106 0ustar rootroot This is the README for the DNSmasq webmin module. Problems: 1) There's only basic error checking - if you enter some bad addresses or names, they will go straight into the config file although we do check for things like IP addresses being of the correct form (no letters, 4 groups of up to 3 digits separated by dots etc). One thing that ISN'T CHECKED FOR is that IP dotted quads are all numbers < 256. Another is that netmasks are logical (you could enter a netmask of 255.0.255.0 for example). Essentially, if it'll pass the config file regex scanner (and the above examples will), it won't be flagged as "bad" even if it is a big no-no for dnsmasq itself. 2) Code is ugly and a kludge - I ain't a programmer! There are probably a lot of things that could be done to tidy up the code - eg, it probably wouldn't hurt to move some common stuff into the lib file. 3) I've used the %text hash and written an english lang file, but I am mono-lingual so no other language support as yet. 4) for reasons unknown to me, the icon does not appear properly on the servers page of webmin (at least it doesn't for me!) 5) icons have been shamelessly stolen from the ipfilter module, specifically the up and down arrows. 6) if you delete an item, the config file will contain an otherwise empty, but commented line. This means that if you add some new stuff, then delete it, the config file will have a number of lines at the end that are just comments. Therefore, the config file could possibly grow quite large. 7) NO INCLUDE FILES! if you use an include file, it'll be flagged as an error. OK if the include file line is commented out though. 8) deprecated lines not supported (eg user and group) - they may produce an error! (user and group don't, but you can't change them) IOW, it works, it's just not very elegant and not very robust. Hope you find it useful though - I do, as I prevents me having to ever wade through the config file and man pages again. If you modify it, or add a language file, and you have a spare moment, please e-mail me - I won't be upset at all if you fix my poor coding! (rather the opposite - I'd be pleased someone found it usefull) Cheers, Neil Fisher dnsmasq/iface_edit_apply.cgi0000755000000000000000000000304010512633233015165 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - iface_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="interface=".$in{iface}; &update( $config{interface}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "iface.cgi" ); # # sub-routines # ### END of iface_edit_apply.cgi ###. dnsmasq/xiface_edit_apply.cgi0000755000000000000000000000305510512640306015362 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - xiface_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="except-interface=".$in{iface}; &update( $config{ex_interface}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "iface.cgi" ); # # sub-routines # ### END of _xiface_edit_apply.cgi ###. dnsmasq/listen_edit_apply.cgi0000755000000000000000000000332510512642154015424 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - listen_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line= "error.cgi?line=x&type=".$text{listen_addr}; &redirect( $line ); exit; } # check for input data errors if( $in{addr} !~ /^$IPADDR$/ ) { my $line= "error.cgi?line=".$text{listen_addr}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="listen-address=".$in{addr}; &update( $config{listen_on}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "iface.cgi" ); # # sub-routines # ### END of listen_edit_apply.cgi ###. dnsmasq/range_edit_apply.cgi0000755000000000000000000000535210512642203015217 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - range_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check for input data errors if( $in{from} !~ /^$IPADDR$/ ) { my $line = "error.cgi?line=".$text{forced_from}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } if( $in{to} !~ /^$IPADDR$/ ) { my $line = "error.cgi?line=".$text{forced_ip}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } if( ($in{masked}) && ($in{mask} !~ /^$IPADDR$/) ) { my $line = "error.cgi?line=".$text{forced_mask}; $line .= "&type=".$text{err_notmask}; &redirect( $line ); exit; } if( ($in{timed}) && ($in{'time'} !~ /^$TIME$/) ) { my $line = "error.cgi?line=".$text{leasetime}; $line .= "&type=".$text{err_nottime}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="dhcp-range="; $line .= $in{id}."," if $in{ided}; $line .= $in{from}.",".$in{to}; $line .= $in{mask} if $in{masked}; $line .= $in{'time'} if $in{timed}; &update( $config{dhcp_range}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "dhcp.cgi" ); # # sub-routines # ### END of range_edit_apply.cgi ###. # adjust everything to what we got # my $line="dhcp-range="; $line .= $in{id}."," if $in{ided}; $line .= $in{from}.",".$in{to}; $line .= $in{mask} if $in{masked}; $line .= $in{'time'} if $in{timed}; &update( $config{dhcp_range}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "dhcp.cgi" ); # # sub-routines # ### END of range_edit_apply.cgi ###. dnsmasq/host_edit.cgi0000755000000000000000000000405710512351537013703 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - host_edit.cgi; edit DHCP host # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{edit_host}."

"; print &ui_form_start( "host_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{dhcp_host}[$in{idx}]{used})?1:0 ); print "
".$text{host_spec}; print &ui_textbox( "host", $config{dhcp_host}[$in{idx}]{option}, 80 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{DHCP_settings}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of host_edit.cgi ###. dnsmasq/range_edit.cgi0000755000000000000000000000541310512347165014021 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - range_edit.cgi; DHCP range edit # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{range_edit}."

"; print &ui_form_start( "range_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{dhcp_range}[$in{idx}]{used})?1:0 ); print "
".$text{ided}.&ui_yesno_radio( "ided", ($config{dhcp_range}[$in{idx}]{id_used})?1:0 ); print "
".$text{id}; print &ui_textbox( "id", $config{dhcp_range}[$in{idx}]{id}, 50 ); print "
".$text{forced_from}; print &ui_textbox( "from", $config{dhcp_range}[$in{idx}]{start}, 18 ); print "
".$text{forced_ip}; print &ui_textbox( "to", $config{dhcp_range}[$in{idx}]{end}, 18 ); print "
".$text{forced_mask_used}.&ui_yesno_radio( "masked", ($config{dhcp_range}[$in{idx}]{mask_used})?1:0 ); print "
".$text{forced_mask}; print &ui_textbox( "mask", $config{dhcp_range}[$in{idx}]{mask}, 18 ); print "
".$text{timed}.&ui_yesno_radio( "timed", ($config{dhcp_range}[$in{idx}]{time_used})?1:0 ); print "
".$text{leasetime}; print &ui_textbox( "time", $config{dhcp_range}[$in{idx}]{leasetime}, 18 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{DHCP_settings}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of range_edit.cgi ###. dnsmasq/option_edit.cgi0000755000000000000000000000407610512351517014235 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - option_edit.cgi; edit DHCP option # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{edit_opt}."

"; print &ui_form_start( "option_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{dhcp_option}[$in{idx}]{used})?1:0 ); print "
".$text{option_spec}; print &ui_textbox( "host", $config{dhcp_option}[$in{idx}]{option}, 80 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{DHCP_settings}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of option_edit.cgi ###. dnsmasq/host_edit_apply.cgi0000755000000000000000000000303210512633002015066 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - host_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line="error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="dhcp-host=".$in{host}; &update( $config{dhcp_host}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "dhcp.cgi" ); # # sub-routines # ### END of host_edit_apply.cgi ###. dnsmasq/iface_apply.cgi0000755000000000000000000000300210512633156014162 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - iface_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # adjust everything to what we got # &update( $config{bind_interfaces}{line}, "bind-interfaces", $config_file, ( $in{bind_iface} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "iface.cgi" ); # # sub-routines # ### END of iface_apply.cgi ###. dnsmasq/forced_edit.cgi0000755000000000000000000000423010512324260014152 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - forced_edit.cgi; forced domain response edit # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{forced}."

"; print &ui_form_start( "forced_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print $text{forced_domain}. &ui_textbox( "domain", $config{forced}[$in{idx}]{domain}, 50 ); print "
"; print $text{forced_ip}. &ui_textbox( "to", $config{forced}[$in{idx}]{addr}, 15 ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{forced}[$in{idx}]{used})?1:0 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{alias_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of forced_edit.cgi ###. dnsmasq/alias_edit.cgi0000755000000000000000000000435010512627345014016 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - alias_edit.cgi; IP alias edit # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line="error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{alias}."

"; print &ui_form_start( "alias_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print $text{forced_from}. &ui_textbox( "from", $config{alias}[$in{idx}]{from}, 15 ); print "
"; print $text{forced_ip}. &ui_textbox( "to", $config{alias}[$in{idx}]{to}, 15 ); print "
"; print $text{forced_mask_used}. &ui_yesno_radio( "mask", ($config{alias}[$in{idx}]{netmask_used})?1:0 ); print $text{forced_mask}. &ui_textbox( "netmask", $config{alias}[$in{idx}]{netmask}, 15 ); print "
".$text{in_use}.&ui_yesno_radio( "used", ($config{forced}[$in{idx}]{used})?1:0 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{alias_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of alias_edit.cgi ###. dnsmasq/option_edit_apply.cgi0000755000000000000000000000304010512633571015433 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - option_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line= "error.cgi?line=x&type=".$text{listen_addr}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="dhcp-option=".$in{host}; &update( $config{dhcp_option}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "dhcp.cgi" ); # # sub-routines # ### END of option_edit_apply.cgi ###. dnsmasq/basic_apply.cgi0000755000000000000000000000720010512642037014176 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - dns_apply.cgi; update basic DNS info # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check user input for obvious errors if( $in{local_domain} !~ /^$FILE$/ ) { my $line = "error.cgi?line=".$text{local_domain}; $line .= "&type=".$text{err_domainbad}; &redirect( $line ); exit; } if( ($in{xhosts}) && ($in{addn_hosts} !~ /^$FILE$/) ) { my $line = "error.cgi?line=".$text{xhostsfile}; $line .= "&type=".$text{err_filebad}; &redirect( $line ); exit; } if( ($in{cache_size}) && ($in{cust_cache_size} !~ /^$NUMBER/) ) { my $line = "error.cgi?line=".$text{cust_cache_size}; $line .= "&type=".$text{err_numbbad}; &redirect( $line ); exit; } if( ($in{local_ttl}) && ($in{ttl} !~ /^$NUMBER/) ) { my $line = "error.cgi?line=".$text{ttl}; $line .= "&type=".$text{err_numbbad}; &redirect( $line ); exit; } # adjust everything to what we got # #our local domain # &update( $config{domain}{line}, "domain=".$in{local_domain}, $config_file, 1 ); # # need domains for forwarded lookups? # &update( $config{domain_needed}{line}, "domain-needed", $config_file, ( $in{domain_needed} == 1 ) ); # # add local domain to local hosts? # &update( $config{expand_hosts}{line}, "expand-hosts", $config_file, ( $in{expand_hosts} == 1 ) ); # # reverse lookups of local subnets propogating? # # NOTE: reversed logic in question! &update( $config{bogus_priv}{line}, "bogus-priv", $config_file, ( $in{bogus_priv} == 0 ) ); # # reverse lookups of local subnets propogating? # &update( $config{filterwin2k}{line}, "filterwin2k", $config_file, ( $in{filterwin2k} == 1 ) ); # # read /etc/hosts? # # NOTE: reverse logic in config file &update( $config{no_hosts}{line}, "no-hosts", $config_file, ( $in{hosts} == 0 ) ); # # read extra hosts file? # &update( $config{addn_hosts}{line}, "addn-hosts=".$in{addn_hosts}, $config_file, ( $in{xhosts} == 1 ) ); # # negative caching? # # NOTE: reverse logic in config file &update( $config{neg_cache}{line}, "no-negcache", $config_file, ( $in{neg_cache} == 0 ) ); # # custom cache size? # &update( $config{cache_size}{line}, "cache-size=".$in{cust_cache_size}, $config_file, ( $in{cache_size} == 1 ) ); # # log all lookups? # &update( $config{log_queries}{line}, "log-queries", $config_file, ( $in{log_queries} == 1 ) ); # # cache size? # &update( $config{local_ttl}{line}, "local-ttl=".$in{ttl}, $config_file, ( $in{local_ttl} == 1) ); # # # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "index.cgi" ); # # sub-routines # ### END of dns_apply.cgi ###. dnsmasq/alias_edit_apply.cgi0000755000000000000000000000407310512641777015232 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - alias_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line="error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check user input for obvious errors if( $in{from} !~ /^$IPADDR$/ ) { my $line="error.cgi?line=".$text{forced_from}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } if( $in{to} !~ /^$IPADDR$/ ) { my $line="error.cgi?line=".$text{forced_ip}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } if( ($in{mask}) && ($in{netmask} !~ /^$IPADDR$/) ) { my $line="error.cgi?line=".$text{forced_mask}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="alias=".$in{from}.",".$in{to}; $line .= ",".$in{netmask} if $in{mask}; &update( $config{alias}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "alias.cgi" ); # # sub-routines # ### END of alias_edit_apply.cgi ###. dnsmasq/forced_edit_apply.cgi0000755000000000000000000000357110512642101015363 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - forced_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line="error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check for input data errors if( $in{domain} !~ /^$NAME$/ ) { my $line="error.cgi?line=".$text{forced_domain}; $line .= "&type=".$text{err_domainbad}; &redirect( $line ); exit; } if( $in{to} !~ /^$IPADDR$/ ) { my $line="error.cgi?line=".$text{forced_domain}; $line .= "&type=".$text{err_domainbad}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="address=/".$in{domain}."/".$in{to}; &update( $config{forced}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "alias.cgi" ); # # sub-routines # ### END of forced_edit_apply.cgi ###. dnsmasq/nx_edit_apply.cgi0000755000000000000000000000331110512642170014544 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - nx_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line= "error.cgi?line=x&type=".$text{listen_addr}; &redirect( $line ); exit; } # check for input data errors if( $in{from} !~ /^$IPADDR$/ ) { my $line= "error.cgi?line=".$text{forced_from}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="bogus-nxdomain=".$in{from}; &update( $config{bogus}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "alias.cgi" ); # # sub-routines # ### END of nx_edit_apply.cgi ###. dnsmasq/user_edit.cgi0000755000000000000000000000417110512343452013676 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - vend_edit.cgi; edit user class # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{user_classes}."

"; print &ui_form_start( "user_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print $text{in_use}.&ui_yesno_radio( "used", ($config{user_class}[$in{idx}]{used})?1:0 ); print $text{class}. &ui_textbox( "class", $config{user_class}[$in{idx}]{class}, 60 ); print "
".$text{user}. &ui_textbox( "user", $config{user_class}[$in{idx}]{user}, 60 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "".$text{delet}.""; print "
".$text{DHCP_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of user_edit.cgi ###. dnsmasq/vend_edit.cgi0000755000000000000000000000421010512343567013655 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - vend_edit.cgi; edit vendor class # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { &header( "DNSMasq settings", "" ); print "

"; print $text{warn_errors}; print $config{errors}; print $text{didnt_apply}; print "


\n"; &footer( "/", $text{'index'}); exit; } # adjust everything to what we got # &header( "DNSMasq settings", "" ); print "

".$text{vendor_classes}."

"; print &ui_form_start( "vend_edit_apply.cgi", "post" ); print &ui_hidden( "idx", $in{idx} ); print $text{in_use}.&ui_yesno_radio( "used", ($config{vendor_class}[$in{idx}]{used})?1:0 ); print $text{class}. &ui_textbox( "class", $config{vendor_class}[$in{idx}]{class}, 60 ); print "
".$text{vendor}. &ui_textbox( "vendor", $config{vendor_class}[$in{idx}]{vendor}, 60 ); print "

" . &ui_submit( $text{'save_button'} )."
"; print &ui_form_end(); print "". $text{delet}.""; print "
".$text{DHCP_config}.""; &footer( "/", $text{'index'}); # # # sub-routines # ### END of vend_edit.cgi ###. dnsmasq/dhcp_apply.cgi0000755000000000000000000000536210512642064014042 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - dhcp_apply.cgi; update misc DHCP info # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line="error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check for input data errors if( $in{bootp_addr} !~ /^$IPADDR$/ ) { my $line="error.cgi?line=".$text{bootp_address}; $line .= "&type=".$text{err_notip}; &redirect( $line ); exit; } if( $in{bootp_file} !~ /^$FILE$/ ) { my $line="error.cgi?line=".$text{bootp_file}; $line .= "&type=".$text{err_filebad}; &redirect( $line ); exit; } if( $in{bootp_host} !~ /^$NAME$/ ) { my $line="error.cgi?line=".$text{bootp_host}; $line .= "&type=".$text{err_hostbad}; &redirect( $line ); exit; } if( $in{max_leases} !~ /^$NUMBER$/ ) { my $line="error.cgi?line=".$text{max_leases}; $line .= "&type=".$text{err_numbbad}; &redirect( $line ); exit; } if( $in{leasefile} !~ /^$FILE$/ ) { my $line="error.cgi?line=".$text{leasefile}; $line .= "&type=".$text{err_filebad}; &redirect( $line ); exit; } # adjust everything to what we got # # read /etc/ethers # &update( $config{dhcp_ethers}{line}, "read-ethers", $config_file, ($in{ethers} == 1) ); # # bootp # my $line="dhcp-boot=".$in{bootp_file}.",".$in{bootp_host}; $line .= ",".$in{bootp_addr}; &update( $config{dhcp_boot}{line}, $line, $config_file, ($in{bootp} == 1) ); # # max leases # &update( $config{dhcp_leasemax}{line}, "dhcp-lease-max=".$in{max_leases}, $config_file, ($in{max_leases} != 150) ); # # leases file # &update( $config{dhcp_leasefile}{line}, "dhcp-leasefile=".$in{leasefile}, $config_file, ($in{useleasefile} == 1) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "dhcp.cgi" ); # # sub-routines # ### END of dhcp_apply.cgi ###. dnsmasq/user_edit_apply.cgi0000755000000000000000000000355710512642234015112 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - user_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check for input data errors if( $in{class} !~ /^$NAME$/ ) { my $line = "error.cgi?line=".$text{class}; $line .= "&type=".$text{err_namebad}; &redirect( $line ); exit; } if( $in{user} !~ /^$NAME$/ ) { my $line = "error.cgi?line=".$text{user}; $line .= "&type=".$text{err_namebad}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="dhcp-userclass=".$in{class}.",".$in{user}; &update( $config{user_class}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "dhcp.cgi" ); # # sub-routines # ### END of user_edit_apply.cgi ###. dnsmasq/vend_edit_apply.cgi0000755000000000000000000000357310512642243015066 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - vend_edit_apply.cgi; do the update # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks ## Insert Output code here # read config file $config_file = &read_file_lines( $config{config_file} ); # pass into data structure &parse_config_file( \%config, \$config_file ); # read posted data &ReadParse(); # check for errors in read config if( $config{errors} > 0 ) { my $line = "error.cgi?line=xx&type=".$text{err_configbad}; &redirect( $line ); exit; } # check for input data errors if( $in{class} !~ /^$NAME$/ ) { my $line = "error.cgi?line=".$text{class}; $line .= "&type=".$text{err_namebad}; &redirect( $line ); exit; } if( $in{vendor} !~ /^$NAME$/ ) { my $line = "error.cgi?line=".$text{vendor}; $line .= "&type=".$text{err_namebad}; &redirect( $line ); exit; } # adjust everything to what we got # my $line="dhcp-vendorclass=".$in{class}.",".$in{vendor}; &update( $config{vendor_class}[$in{idx}]{line}, $line, $config_file, ( $in{used} == 1 ) ); # # write file!! &flush_file_lines(); # # re-load basic page &redirect( "dhcp.cgi" ); # # sub-routines # ### END of vend_edit_apply.cgi ###. dnsmasq/error.cgi0000755000000000000000000000302610511350547013044 0ustar rootroot#!/usr/bin/perl # # DNSMasq Webmin Module - error.cgi; report errors # Copyright (C) 2006 by Neil Fisher # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # This module inherited from the Webmin Module Template 0.79.1 by tn do '../web-lib.pl'; do '../ui-lib.pl'; do 'dnsmasq-lib.pl'; $|=1; &init_config("DNSMasq"); %access=&get_module_acl; ## put in ACL checks here if needed ## sanity checks &header($text{'index_title'}, "", "intro", 1, 1, undef, "Written by Neil Fisher
Author
Home://page"); # uses the index_title entry from ./lang/en or appropriate ## Insert Output code here # output as web page &ReadParse(); print "

".$text{error_heading}."

"; print "

"; print $text{err_line}; print $in{line}; print "
\n"; print $text{err_type}; print $in{type}; print "

\n"; print $text{err_help}; &footer("/", $text{'index'}); # uses the index entry in /lang/en ## if subroutines are not in an extra file put them here ### END of error.cgi ###.