Skip to content

Instantly share code, notes, and snippets.

@spacelatte
Last active September 22, 2019 10:33
Show Gist options
  • Save spacelatte/5ccf7394a3e722320b7f1d6f0765abc2 to your computer and use it in GitHub Desktop.
Save spacelatte/5ccf7394a3e722320b7f1d6f0765abc2 to your computer and use it in GitHub Desktop.
cloud init for digitalocean vnc droplet
#cloud-config
package_update: true
package_upgrade: true
packages:
- curl
- tmux
- xterm
- netcat
- htop
- iotop
- iftop
- tcpdump
- nginx
- gpm
- git
- manpages
- man-db
- fluxbox
- chromium
- vnc4server
write_files:
- path: /etc/rc.local
content: |
#!/usr/bin/env bash
su -lc 'tmux new -ds "login $(date)"' | logger &
su -lc 'vncserver -localhost no -verbose -geometry 1280x800 -depth 24 :0' | logger &
exit 0
permissions: '0755'
runcmd: # initial run only
- echo %%%%%%%%%% RUNCMD PART %%%%%%%%%%
- mkdir -p /etc/default/grub.d
- echo 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT apparmor=0"' | tee /etc/default/grub.d/apparmor.cfg
- update-grub
- apt update
- apt upgrade -y
- apt dist-upgrade -y
- apt full-upgrade -y
- apt purge -y do-agent
- apt install -y netcat
- curl -sSL https://repos.insights.digitalocean.com/install.sh | bash
- apt install -y xvnc4viewer
- su -lc 'printf "1234567\n1234567\nn\n" | vncpasswd' || echo something went bad
- echo msg @mert instance init $LOCAL_HOSTNAME $(hostname) $INSTANCE_ID | nc -vq1 src.n0pe.me 3335 || echo ping failed
- env | sort
bootcmd: # every boot
- echo %%%%%%%%%% BOOTCMD PART %%%%%%%%%%
- apt update
- apt install -y curl
- echo msg @mert instance boot $LOCAL_HOSTNAME $(hostname) $INSTANCE_ID | nc -vq1 src.n0pe.me 3335 || echo ping failed
- env | sort
phone_home:
url: https://src.n0pe.me/?cloud-init-id=$INSTANCE_ID
post: [ instance_id, pub_key_rsa ]
power_state:
delay: "now"
mode: reboot
message: "init completed"
timeout: 360
condition: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment