From f4955c66ab9ff90ffa02a6385d7b42a27e232495 Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Sat, 30 Aug 2008 10:16:23 +0000 Subject: polish up DNS forwarding error messages --- scripts/dns-forwarding/vyatta-dns-forwarding.pl | 30 +++++-------------------- 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'scripts') diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl index c2ef968a..902e91bc 100644 --- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl +++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl @@ -37,12 +37,10 @@ my $dnsforwarding_conf = '/etc/dnsmasq.conf'; sub dnsforwarding_restart { system("$dnsforwarding_init restart >&/dev/null"); - print "Setting up DNS forwarding.\n"; } sub dnsforwarding_stop { system("$dnsforwarding_init stop >&/dev/null"); - print "Stopping DNS forwarding.\n"; } sub dnsforwarding_get_constants { @@ -164,13 +162,6 @@ sub check_system_nameserver { } -sub check_dhcp_nameserver { - - my $intf = shift; - my $cmd = `grep nameserver /etc/resolv.conf.dhclient-new-$intf|wc -l`; - return $cmd; -} - sub is_dhcp_enabled { my $intf = shift; @@ -205,14 +196,13 @@ sub check_dhcp_interface { my $interface = shift; if (!is_dhcp_enabled($interface)) { - print "$interface is not using DHCP to get an IP address\n"; + print "DNS forwarding error: $interface is not using DHCP to get an IP address\n"; return 0; } if (-e "/var/run/vyatta/dhclient/dhclient_release_$interface") { # dhcp released for the interface - print "DHCP lease for $interface has been released.\n"; - print "Renew lease for $interface before setting this parameter.\n"; + print "DNS forwarding error: DHCP lease for $interface has been released by user\n"; return 0; } @@ -224,26 +214,18 @@ sub check_dhcp_interface { # main # -my ($update_dnsforwarding, $stop_dnsforwarding, $system_nameserver, $dhcp_interface, $dhcp_interface_nameserver, $dhclient_script); +my ($update_dnsforwarding, $stop_dnsforwarding, $system_nameserver, $dhcp_interface, $dhclient_script); GetOptions("update-dnsforwarding!" => \$update_dnsforwarding, "stop-dnsforwarding!" => \$stop_dnsforwarding, "system-nameserver!" => \$system_nameserver, - "dhcp-interface-nameserver=s" => \$dhcp_interface_nameserver, "dhclient-script!" => \$dhclient_script, "dhcp-interface=s" => \$dhcp_interface); if (defined $system_nameserver) { my $system_nameserver_exists = check_system_nameserver(); if ($system_nameserver_exists < 1){ - print "Warning: No DNS servers set in system to forward queries.\n"; - } -} - -if (defined $dhcp_interface_nameserver) { - my $dhcp_interface_nameserver_exists = check_dhcp_nameserver($dhcp_interface_nameserver); - if ($dhcp_interface_nameserver_exists < 1){ - print "Warning: No DNS servers received from DHCP server for $dhcp_interface_nameserver.\n"; + print "DNS forwarding warning: No DNS servers set in system to forward queries\n"; } } @@ -265,9 +247,9 @@ if (defined $update_dnsforwarding) { if (!(defined $use_system_nameservers) && (@use_dhcp_nameservers == 0) && (@use_nameservers == 0)) { my $nameserver_exists = check_nameserver(); if ($nameserver_exists < 1){ - print "Warning: No DNS servers ('system set' or 'dhcp received') to forward queries.\n"; + print "DNS forwarding warning: No DNS servers ('system' or 'dhcp received') to forward queries.\n"; } - } + } my $called_from_dhclient_script = 0; if (defined $dhclient_script){ -- cgit v1.2.3 From 6a040ff8506966bae20d7e0638750c7a837e48ad Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 3 Sep 2008 15:12:52 -0700 Subject: Add support for aufs If system is booted with aufs (instead of aufs) then propogate it to the installed grub options. --- scripts/install-system | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/install-system b/scripts/install-system index 724ced9d..e8f05cc7 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -765,9 +765,25 @@ copy_config () { change_password() { local user=$1 - local pwd - read pwd - local epwd=$(mkpasswd -H md5 $pwd | sed 's:/:\\/:g') + local pwd1="1" + local pwd2="2" + + until [ $pwd1 == $pwd2 ] + do + echo -n "Enter $user " + pwd1=$(mkpasswd -H md5) + local salt=$(echo $pwd1 | awk -F$ '{print $3}') + + echo -n "Retype $user " + pwd2=$(mkpasswd -H md5 -S $salt) + + if [ $pwd1 != $pwd2 ] + then echo "Passwords do not match" + fi + done + + # escape any slashes in resulting password + local epwd=$(echo $pwd | sed 's:/:\\/:g') sed -i \ -e "/ user $user {/,/}/s/encrypted-password:.*\$/encrypted-password: \"$epwd\"/" \ @@ -779,9 +795,7 @@ system_setup () { local response=$(get_response "Yes" "Yes No Y N") if [ "$response" == "yes" ] || [ "$response" == "y" ]; then - echo -n 'System administrator (root) password: ' change_password root - echo -n 'Router administrator (vyatta) password: ' change_password vyatta fi } @@ -821,6 +835,17 @@ install_grub () { grub_options="ide=nodma" fi + # Check if using aufs + if grep -q aufs /proc/filesystems + then + if [ -z "$grub_options" ] + then + grub_options="union=aufs" + else + grub_options="$grub_options union=aufs" + fi + fi + if /opt/vyatta/sbin/grub-setup "$ROOT_PARTITION" "$grub_options" /mnt/rootfs >>$INSTALL_LOG then echo "OK" -- cgit v1.2.3 From a43151a69c1482c1c10806e83271f94fb691199d Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Sat, 30 Aug 2008 16:13:53 +0000 Subject: prompt warning for no nameservers if no nameservers set and no interface set to use dhcp --- scripts/dns-forwarding/vyatta-dns-forwarding.pl | 46 +++++++++++++++++++++++-- templates/service/dns/forwarding/dhcp/node.def | 2 +- 2 files changed, 45 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl index 902e91bc..08cea70a 100644 --- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl +++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl @@ -162,6 +162,47 @@ sub check_system_nameserver { } +sub check_dhcp_any_interface { + + my $config = new VyattaConfig; + $config->setLevel("interfaces ethernet"); + my @eths = $config->listNodes("."); + foreach my $eth (@eths) { + $config->setLevel("interfaces ethernet $eth"); + my @addrs = $config->returnOrigValues("address"); + foreach my $addr (@addrs) { + if (defined $addr && $addr eq "dhcp") { + return 1; + } + } + my @vifs = $config->listNodes("vif"); + foreach my $vif (@vifs) { + $config->setLevel("interfaces ethernet $eth vif $vif"); + my @addrs = $config->returnOrigValues("address"); + foreach my $addr (@addrs) { + if (defined $addr && $addr eq "dhcp") { + return 1; + } + } + } + } + + $config->setLevel("interfaces bridge"); + my @bridges = $config->listNodes("."); + foreach my $bridge (@bridges) { + $config->setLevel("interfaces bridge $bridge"); + my @addrs = $config->returnOrigValues("address"); + foreach my $addr (@addrs) { + if (defined $addr && $addr eq "dhcp") { + return 1; + } + } + } + + return 0; + +} + sub is_dhcp_enabled { my $intf = shift; @@ -246,8 +287,9 @@ if (defined $update_dnsforwarding) { if (!(defined $use_system_nameservers) && (@use_dhcp_nameservers == 0) && (@use_nameservers == 0)) { my $nameserver_exists = check_nameserver(); - if ($nameserver_exists < 1){ - print "DNS forwarding warning: No DNS servers ('system' or 'dhcp received') to forward queries.\n"; + my $dhcp_enabled_any_interface = check_dhcp_any_interface(); + if ($nameserver_exists < 1 && $dhcp_enabled_any_interface == 0){ + print "DNS forwarding warning: No name-servers to forward DNS queries\n"; } } diff --git a/templates/service/dns/forwarding/dhcp/node.def b/templates/service/dns/forwarding/dhcp/node.def index f56a51c2..8ce8c83f 100644 --- a/templates/service/dns/forwarding/dhcp/node.def +++ b/templates/service/dns/forwarding/dhcp/node.def @@ -1,6 +1,6 @@ multi: type: txt -help: Set to forward DNS queries to nameservers received from DHCP server for specified interface +help: Set to use nameservers received from DHCP server for specified interface commit:expression: exec "/opt/vyatta/sbin/vyatta-dns-forwarding.pl --dhcp-interface $VAR(@)" allowed: local -a array ; -- cgit v1.2.3