refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / ssh-utils / ssh-adduser.sh
deleted file mode 100644 (file)
index 47aefae2eeb348aa449d343488d39665d3f39e19..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-{
-    set -e
-    set -u
-
-    # TODO: a more complete VPS setup
-
-    # TODO would $EUID be better?
-    if [ "root" != "$(whoami)" ]; then
-      echo "webi adduser: running user is already a non-root user"
-      exit 0
-    fi
-
-    #apt-get -y update
-    #apt-get -y install curl wget rsync git
-
-    # Add User app
-    # Picking 'app' because that seems to be what the # Docker/Vagrant
-    # crowd is doing. TODO: Other ideas? me, user, tron
-    adduser --disabled-password --gecos "" app
-    my_password=$(openssl rand -hex 16)
-    printf "$my_password"'\n'"$my_password" | passwd app
-
-    # make 'app' a sudo-er (admin)
-    adduser app sudo
-    echo "app ALL=(ALL:ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/app
-
-    # allow users who can already login as 'root' to login as 'app'
-    mkdir -p /home/app/.ssh/
-    chmod 0700 /home/app/.ssh/
-    cp -r "$HOME/.ssh/authorized_keys" /home/app/.ssh/
-    chmod 0600 /home/app/.ssh/authorized_keys
-    touch /home/app/.ssh/config
-    chmod 0644 /home/app/.ssh/config
-    chown -R app:app /home/app/.ssh/
-
-    # ensure that 'app' has an SSH Keypair
-    sudo -i -u app bash -c 'ssh-keygen -b 2048 -t rsa -f /home/app/.ssh/id_rsa -q -N ""'
-
-    # Install webi for the new 'app' user
-    sudo -i -u app bash -c 'curl -fsSL https://webinstall.dev/webi | bash' \
-        || sudo -i -u app bash -c 'wget -q -O - https://webinstall.dev/webi | bash'
-
-    # TODO ensure that ssh-password login is off
-
-    echo "Created user 'app' with password '$my_password'"
-}
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..de82e63c26c822d1ee0c33f9e7ad6c708148dff2
--- /dev/null
@@ -0,0 +1 @@
+../ssh-adduser/ssh-adduser.sh
\ No newline at end of file