echo "Running Software Installations" # Activate SSH package sudo apt-get -y install openssh-server # Fix for E3-1240V3 IPMI Hang sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"/GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"/g' /etc/default/grub sudo update-grub wget -q -O /dev/null 'http://192.168.200.2/automation/completeKickstartInstallationStep.php?kickstartInstallationId=32830&securityKey=cwkknrnfkxnbppeqisuwskwebuacptkf&identifier=ubuntu16_04&percentComplete=50&message=Installing%20Software' # Install Software wget -q -O /dev/null 'http://192.168.200.2/automation/updateKickstartInstallationStatus.php?kickstartInstallationId=32830&securityKey=cwkknrnfkxnbppeqisuwskwebuacptkf&percentComplete=95&message=Setting%20up%20SNMP' sudo apt-get install snmpd -y mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig service snmpd stop # Default Secured Servers echo 'rocommunity iuhet08532h\nsyslocation "PNAP, SecuredServers"\nsyscontact support@securedservers.com' > /etc/snmp/snmpd.conf sed -i 's/ 127.0.0.1//g' /etc/default/snmpd sed -i 's/snmpd.pid/snmpd.pid -c \/etc\/snmp\/snmpd.conf/g' /etc/default/snmpd wget -q -O /dev/null 'http://192.168.200.2/automation/updateKickstartInstallationStatus.php?kickstartInstallationId=32830&securityKey=cwkknrnfkxnbppeqisuwskwebuacptkf&percentComplete=99&message=Completing%20Installation' BACKEND_INTERFACE=$(ip ntable | grep dev | sort | uniq | sed -e 's/^.*dev //;/^lo/d' | head -n 1 | tail -n 1 | xargs) echo detected backend interface name: $BACKEND_INTERFACE FRONTEND_INTERFACE=$(ip ntable | grep dev | sort | uniq | sed -e 's/^.*dev //;/^lo/d' | head -n 2 | tail -n 1 | xargs) # Configure Network echo "# Loopback" > /etc/network/interfaces2 echo "auto lo" >> /etc/network/interfaces2 echo "iface lo inet loopback" >> /etc/network/interfaces2 echo "" >> /etc/network/interfaces2 echo "# Backend Interface" >> /etc/network/interfaces2 echo "auto $BACKEND_INTERFACE" >> /etc/network/interfaces2 echo "iface $BACKEND_INTERFACE inet static" >> /etc/network/interfaces2 echo "address 0.0.0.0" >> /etc/network/interfaces2 echo "netmask 255.255.255.255" >> /etc/network/interfaces2 echo "" >> /etc/network/interfaces2 echo "# Public Interfaces" >> /etc/network/interfaces2 echo "auto $FRONTEND_INTERFACE" >> /etc/network/interfaces2 echo "iface $FRONTEND_INTERFACE inet static" >> /etc/network/interfaces2 echo "address 0.0.0.0" >> /etc/network/interfaces2 echo "netmask 255.255.255.255" >> /etc/network/interfaces2 echo "gateway 0.0.0.0" >> /etc/network/interfaces2 # Name Servers echo "dns-search securedservers.com" >> /etc/network/interfaces2 echo "dns-nameservers 174.138.175.115 174.138.175.116" >> /etc/network/interfaces2 # Startup script echo "mv /etc/network/interfaces2 /etc/network/interfaces" > /root/initializeNetwork.sh echo "/etc/init.d/networking stop; /etc/init.d/networking start" >> /root/initializeNetwork.sh #echo "service networking restart" >> /root/initializeNetwork.sh echo "ifdown --exclude=lo -a && sudo ifup --exclude=lo -a" >> /root/initializeNetwork.sh echo "mv /etc/rc.local.bu /etc/rc.local" >> /root/initializeNetwork.sh echp "chmod +x /etc/rc.local" >> /root/initializeNetwork.sh echo "#rm /root/initializeNetwork.sh" >> /root/initializeNetwork.sh chmod +x /root/initializeNetwork.sh #this should blacklist the mei and mei_me modules as per ticket 848112 - #echo "\n#blacklisting the mei modules\n\n" >> /target/etc/modprobe.d/blacklist.conf #echo "blacklist mei" >> /target/etc/modprobe.d/blacklist.conf #echo "blacklist mei_me" >> /target/etc/modprobe.d/blacklist.conf # finally attempt to inject root ssh key messenger "**** CONFIGURING AUTHORIZED KEYS ****" # Inject public ssh key to root user in *any case* bacause it is just one ssh key and it is for root user messenger "sshKey is not defined, nothing inserted to authorized_keys" # Add the startup script to firstboot cp /etc/rc.local /etc/rc.local.bu echo "#!/bin/sh -e" > /etc/rc.local echo "" >> /etc/rc.local echo "/root/initializeNetwork.sh" >> /etc/rc.local echo "exit 0" >> /etc/rc.local chmod +x /etc/rc.local # All done here wget -T 30 -O /dev/null 'http://192.168.200.2/automation/completeKickstartInstallation.php?kickstartInstallationId=32830&securityKey=cwkknrnfkxnbppeqisuwskwebuacptkf' echo "Done"