vm_clean: delete keys from from /etc/ssh/ before shipping vm
It's a bad idea for all Mininet VMs to share the same SSH keys. Certainly users can regenerate their own keys, but it's better if we don't ship a key and simply regenerate it on boot.
This commit is contained in:
@@ -706,6 +706,20 @@ function vm_clean {
|
|||||||
rm -f ~/.ssh/id_rsa* ~/.ssh/known_hosts
|
rm -f ~/.ssh/id_rsa* ~/.ssh/known_hosts
|
||||||
sudo rm -f ~/.ssh/authorized_keys*
|
sudo rm -f ~/.ssh/authorized_keys*
|
||||||
|
|
||||||
|
# Remove SSH keys and regenerate on boot
|
||||||
|
echo 'Removing SSH keys from /etc/ssh/'
|
||||||
|
sudo rm -f /etc/ssh/*key*
|
||||||
|
if ! grep mininet /etc/rc.local >& /dev/null; then
|
||||||
|
sudo sed -i -e "s/exit 0//" /etc/rc.local
|
||||||
|
echo '
|
||||||
|
# mininet: regenerate ssh keys if we deleted them
|
||||||
|
if ! stat -t /etc/ssh/*key* >/dev/null 2>&1; then
|
||||||
|
/usr/sbin/dpkg-reconfigure openssh-server
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
' | sudo tee -a /etc/rc.local > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove Mininet files
|
# Remove Mininet files
|
||||||
#sudo rm -f /lib/modules/python2.5/site-packages/mininet*
|
#sudo rm -f /lib/modules/python2.5/site-packages/mininet*
|
||||||
#sudo rm -f /usr/bin/mnexec
|
#sudo rm -f /usr/bin/mnexec
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ fi
|
|||||||
# Install Mininet
|
# Install Mininet
|
||||||
time mininet/util/install.sh
|
time mininet/util/install.sh
|
||||||
# Finalize VM
|
# Finalize VM
|
||||||
time mininet/util/install.sh -tc
|
time mininet/util/install.sh -tcd
|
||||||
# Ignoring this since NOX classic is deprecated
|
# Ignoring this since NOX classic is deprecated
|
||||||
#if ! grep NOX_CORE_DIR .bashrc; then
|
#if ! grep NOX_CORE_DIR .bashrc; then
|
||||||
# echo "export NOX_CORE_DIR=~/noxcore/build/src/" >> .bashrc
|
# echo "export NOX_CORE_DIR=~/noxcore/build/src/" >> .bashrc
|
||||||
|
|||||||
Reference in New Issue
Block a user