Commit 3246c031 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Do a better job of removing the Ports we add to sshd_condig, without

removing anything else from the file below what we add. This was biting
us on elabinelab setup. Also a fix to the fixup to fstab for device
names.
parent 9c54116a
#!/usr/bin/perl -w
#
# Copyright (c) 2009-2015 University of Utah and the Flux Group.
# Copyright (c) 2009-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -697,12 +697,11 @@ sub callback($)
my $sshdport = VNCONFIG('SSHDPORT');
mysystem2("echo '# EmulabJail' >> $path/etc/ssh/sshd_config");
mysystem2("echo '# DO NOT MAKE ANY CHANGES BELOW THIS LINE!' ".
" >> $path/etc/ssh/sshd_config");
mysystem2("echo 'Port $sshdport' >> $path/etc/ssh/sshd_config");
if (VNCONFIG('CTRLIP') ne $ext_ctrlip) {
mysystem2("echo 'Port 22' >> $path/etc/ssh/sshd_config");
}
mysystem2("echo '# EndEmulabJail' >> $path/etc/ssh/sshd_config");
}
# Localize the timezone.
mysystem2("cp -fp /etc/localtime $path/etc");
......
......@@ -1682,8 +1682,14 @@ sub vnodePreConfig($$$$$){
if ($?);
}
# Kill off old sshd ports.
mysystem2("sed -i.bak -e '/^# EmulabJail/,\$d' ".
" $vnoderoot/etc/ssh/sshd_config");
if (system("grep -q EndEmulabJail $vnoderoot/etc/ssh/sshd_config") == 0) {
mysystem2("sed -i.bak -e '/^# EmulabJail/,/^# EndEmulabJail/d' ".
" $vnoderoot/etc/ssh/sshd_config");
}
else {
mysystem2("sed -i.bak -e '/^# EmulabJail/,\$d' ".
" $vnoderoot/etc/ssh/sshd_config");
}
goto bad
if ($?);
......@@ -1796,14 +1802,14 @@ sub vnodePreConfig($$$$$){
goto bad
if ($?);
my $ldisk = "da0s1";
my $ldisk = "da";
if (-e "$vnoderoot/etc/dumpdates") {
mysystem2("sed -i.bak -e 's;^/dev/\\(ada\\|ad\\|da\\)[0-9]s1;/dev/$ldisk;' ".
mysystem2("sed -i.bak -e 's;^/dev/\\(ada\\|ad\\);/dev/$ldisk;' ".
" $vnoderoot/etc/dumpdates");
goto bad
if ($?);
}
mysystem2("sed -i.bak -e 's;^/dev/\\(ada\\|ad\\|da\\)[0-9]s1;/dev/$ldisk;' ".
mysystem2("sed -i.bak -e 's;^/dev/\\(ada\\|ad\\);/dev/$ldisk;' ".
" $vnoderoot/etc/fstab");
goto bad
if ($?);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment