summaryrefslogtreecommitdiff
path: root/install.sh
blob: 96f1b4e0a9597a33a2b91e20b752c17fc95d24b6 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
ssh-keygen -f /opt/autopeer/id_autopeer
echo "You need to add your new SSH key (/opt/autopeer/id_autopeer) to dn42 gitea to clone the repo:"
cat /opt/autopeer/id_autopeer.pub
echo
read -p "Press enter once you've done that..."


apt install git wireguard-tools
ln -s /opt/autopeer/sshd_config /etc/ssh/sshd_config.d/autopeer.conf
addgroup autopeer
adduser --disabled-password --comment '' new
git -c core.sshcommand="ssh -i /opt/autopeer/id_autopeer" git clone git@git.dn42.dev:dn42/registry.git /opt/autopeer/dn42-registry

echo '47 * * * * root git -c merge.verifysignatures=false -c core.sshcommand="ssh -i /opt/autopeer/id_autopeer" -C /opt/autopeer/dn42-registry pull' >>/etc/cron.d/autopeer
echo '*/5 * * * * root /opt/autopeer/cronjob.py' >>/etc/cron.d/autopeer

mkdir /opt/autopeer/db
echo 'CREATE TABLE peers (name, asn, ipll, endpoint, port, pubkey, creator_ip, creator_name, creator_date, primary key (name, asn));' | python -m sqlite3 /opt/autopeer/db/sqlite3.db
chgrp -R autopeer /opt/autopeer/db/
chmod 770 /opt/autopeer/db/
chmod 660 /opt/autopeer/db/sqlite3.db

umask 0077
wg genkey >/etc/wireguard/privkey
umask 0022
wg pubkey </etc/wireguard/privkey >/etc/wireguard/pubkey