Skip to content

Instantly share code, notes, and snippets.

@eumel8
Created January 18, 2018 06:37
Show Gist options
  • Save eumel8/e9d25ab3407a46b21ae576d75b1fac8b to your computer and use it in GitHub Desktop.
Save eumel8/e9d25ab3407a46b21ae576d75b1fac8b to your computer and use it in GitHub Desktop.
Content-Type: multipart/mixed; boundary="===============8494485615320709508=="
MIME-Version: 1.0
--===============8494485615320709508==
Content-Type: text/cloud-boothook; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="boothook.sh"
#cloud-boothook
#!/bin/bash
--===============8494485615320709508==
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
#
#
# PLEASE LOOK AT URL FOR FULL EXAMPLE:
#
# https://github.com/cloudsigma/cloud-init/blob/master/doc/examples/cloud-config.txt
# https://github.com/cloudsigma/cloud-init/blob/master/doc/examples/
#
hostname: console
fqdn: console.otx.example.com
packages:
- curl
- git
- python-jmespath
- python-netaddr
- python-openstackclient
- python-pip
- libs3-2
- jq
- shellinabox
runcmd:
final_message: "The system is finally up, after $UPTIME seconds"
--===============8494485615320709508==
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="shellscript.sh"
#!/bin/bash
set -x
add-apt-repository -y ppa:ansible/ansible
apt-get update
apt-get -y install ansible
pip install python-otcclient
sed -i -e "s/^SHELLINABOX_PORT=4200/SHELLINABOX_PORT=443/" /etc/default/shellinabox
sed -i -e "s/^PasswordAuthentication no/PasswordAuthentication yes/" /etc/ssh/sshd_config
systemctl restart ssh.service
cat <<EOF > /var/lib/shellinabox/certificate-console.otx.example.com.pem
-----BEGIN CERTIFICATE-----
[put cert here]
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
[put key here]
-----END PRIVATE KEY-----
EOF
systemctl restart shellinabox.service
useradd -m -s /bin/bash clouduser;echo clouduser:<password> | chpasswd -c SHA512
--===============8494485615320709508==--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment