Commit 3db7e49e authored by Ole Lorbacher's avatar Ole Lorbacher 💬
Browse files

Add SSH Key exercise

parent b887b76d
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -356,6 +356,21 @@ export const pooltest = test((function(){
        this.verify('cat /tmp/.file-to-print').hasOutput("/home/students/robobert/dokument.pdf")
    })

    this.exercise("SSH-Key erstellen", async function () {
        this.describe(`Um Zugang zu unseren Serven zu bekommen, benötigst du einen SSH Key.
            Erstelle einen neuen Key und kopiere den Inhalt des public keys in eine neue Datei "gt_mail.txt".
            Sobald du dne Pooltest bestanden hast musst du auch auf deinem eigenen Gerät ein SSH Key erstellen und uns den public key zusammen mit dem Token aus dem Pooltest zuschicken.`)

        const pubKey = "ssh-ed25519 AAAABBBBCCCCDDDDP00lT35t55HK3yPlac3h0ld3rF0rYal1k3zazz pooltest key"
        const privKey = "IN DIESER DATEI WIRD DEIN PRIVATE KEY GESPEICHERT, TEILE DIESEN NIEMALS MIT ANDEREN! ---- THIS IS WHERE YOUR PRIVATE KEY IS STORED! NEVER SHARE IT WITH ANYONE"

        await this.prepareWith(` if [[ ! -f /bin/ssh-keygen ]]; then echo 'mkdir /root/.ssh && echo "${pubKey}" > /root/.ssh/id_ed25519.pub && echo "${privKey}" > /root/.ssh/id_ed25519 &&exit 1' > /bin/ssh-keygen;chmod +x /bin/ssh-keygen; fi `)

        await this.manualConfirmation()

        this.verify('cat /root/gt_mail.txt').hasOutput(pubKey)
    })

    // To add another exercise, simply copy and paste an exercise(...) block from above and adjust it.
    // Order is respected, so you can e.g. order the exercises by increasing difficulty.
})