#!/bin/bash

# Scripts in this directory will be executed by cloud-init on the first boot of droplets
# created from your image.  Things like generating passwords, configuration requiring IP address
# or other items that will be unique to each instance should be done in scripts here.

#
# Setup Bitwarden Installer
# ref: https://help.bitwarden.com/article/install-on-premise/
#

docker pull ghcr.io/bitwarden/setup

curl -L -s -o /root/bitwarden.sh "https://func.bitwarden.com/api/dl/?app=self-host&platform=linux"

chmod +x /root/bitwarden.sh

# Remove the ssh force logout command
sed -e '/Match User root/d' \
    -e '/.*ForceCommand.*droplet.*/d' \
    -i /etc/ssh/sshd_config

systemctl restart ssh
