move some stuff to frodo, rename user to iank, fixes
[distro-setup] / distro-end
index c13ef340c8a58fd7e26cb99c19001cd9c41df260..b044f5c798fe549e0a4c31a07aad5899cebb3844 100755 (executable)
@@ -61,6 +61,8 @@ case $HOSTNAME in
         # universal packages
         # swh-plugins is for karaoke pulsaudio filter.
         # mutagen for pithos
+        # guvcview set webcam brightness to highest
+        # pidgin-otr, i went into pidgin pluggin settings and generated a key for some accounts
         simple_packages+=(
             apache2
             apache2-doc
@@ -77,6 +79,7 @@ case $HOSTNAME in
             chromium
             cpio-doc
             cloc
+            cpulimit
             cron
             debconf-doc
             dirmngr
@@ -102,8 +105,10 @@ case $HOSTNAME in
             goaccess
             gnome-screenshot
             gnome-session-flashback
+            guvcview
             i3lock
             inetutils-traceroute
+            iperf3
             iproute2-doc
             jq
             kid3-qt
@@ -130,6 +135,7 @@ case $HOSTNAME in
             perl-doc
             pianobar
             pidgin
+            pidgin-otr
             pry
             python-autopep8
             python3-doc
@@ -146,6 +152,7 @@ case $HOSTNAME in
             transmission-remote-gtk
             vlc
             whois
+            wondershaper
         )
         spa $(apt-cache search ruby[.0-9]+-doc| awk '{print $1}')
         ;;
@@ -276,7 +283,8 @@ if isdebian; then
 fi
 
 # we've got a few dependencies later on, so install them now.
-pi "${simple_packages[@]}"
+pi eatmydata
+s eatmydata apt-get -y install --purge --auto-remove "${simple_packages[@]}"
 simple_packages=()
 
 
@@ -431,7 +439,7 @@ EOF
         # https://nodejs.org/en/download/package-manager/
         curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
         pi nodejs
-        cd /home/ian
+        cd /home/iank
         rm -rf pump.io.git
         git clone https://github.com/pump-io/pump.io.git
         cd pump.io
@@ -481,7 +489,7 @@ After=syslog.target network.target
 Type=simple
 User=pumpio
 Group=pumpio
-ExecStart=/home/ian/pump.io/bin/pump
+ExecStart=/home/iank/pump.io/bin/pump
 Environment=NODE_ENV=production
 # failed to find databank-mongodb without this.
 # I just looked at my environment variables took a guess.
@@ -609,6 +617,26 @@ esac
 ########### end section including li/lj ###############
 
 if [[ $HOSTNAME == treetowl ]]; then
+
+    # vpn-server setup via:
+
+    vpn-server-setup -r -d
+    s tee -a /etc/openvpn/server/server.conf <<'EOF'
+push "dhcp-option DNS 192.168.1.1"
+push "route 192.168.1.0 255.255.255.0"
+client-connect /a/bin/distro-setup/vpn-client-connect
+EOF
+    s sed -i --follow-symlinks 's/10.8./10.9./g' /etc/openvpn/server/server.conf
+    ser restart openvpn-server@server
+    vpn-mk-client-cert -s /etc/update-resolv-conf-home -c x2 -n home b8.nz
+    dir=/p/c/machine_specific/x2/filesystem/etc/openvpn/client
+    mkdir -p $dir
+    # background: We have these files locally, but we\'d have to duplicate the logic
+    # in vpn-mk-client-cert to get them, and this is just simpler.
+    scp root@x2:/etc/openvpn/client/home* $dir
+
+
+
     # note, see bashrc for more documentation.
     pi rss2email
     s dd of=/etc/systemd/system/rss2email.service <<'EOF'
@@ -617,7 +645,7 @@ Description=rss2email
 After=multi-user.target
 
 [Service]
-User=ian
+User=iank
 Type=oneshot
 # about 24 hours of failures
 # it copies over its files without respecting symlinks, so
@@ -649,7 +677,7 @@ Description=pump li backup
 After=multi-user.target
 
 [Service]
-User=ian
+User=iank
 Type=oneshot
 ExecStart=/a/bin/log-quiet/sysd-mail-once pump-backup /a/bin/distro-setup/pump-backup
 EOF
@@ -721,8 +749,8 @@ if [[ $HOSTNAME == treetowl ]]; then
             pi syncthing
             ;;
     esac
-    lnf -T /w/syncthing /home/ian/.config/syncthing
-    sgo syncthing@ian # runs as ian
+    lnf -T /w/syncthing /home/iank/.config/syncthing
+    sgo syncthing@iank # runs as iank
 
     # these things persist in ~/.config/syncthing, which I save in
     # /w/syncthing (not in /p, because syncthing should continue to
@@ -894,7 +922,7 @@ if ! getent passwd debian-transmission > /dev/null; then
             ;;
     esac
 fi
-if [[ $HOSTNAME == treetowl ]]; then
+if [[ $HOSTNAME == frodo ]]; then
     sgo transmission-daemon-nn
 fi
 
@@ -933,7 +961,7 @@ EOF
   "profiles" : [
     {
       "profile-name" : "Default",
-      "hostname" : "transmission",
+      "hostname" : "transmission.b8.nz",
       "rpc-url-path" : "/transmission/rpc",
       "username" : "",
       "password" : "$rpc_pass",
@@ -1097,7 +1125,7 @@ case $distro in
     # others unknown
 esac
 # allow user to run vms, from debian handbook
-for x in ian traci; do s usermod -a -G libvirt,kvm $x; done
+for x in iank traci; do s usermod -a -G libvirt,kvm $x; done
 # bridge networking as user fails. google lead here, but it doesn\'t work:
 # oh well, I give up.
 # http://wiki.qemu.org/Features-Done/HelperNetworking
@@ -1227,19 +1255,11 @@ if [[ $HOSTNAME == treetowl ]]; then
                 f=$dir/bitcoin.conf
                 s dd of=$f <<EOF
 server=1
+# necessary for joinmarket, not bad in general
 rpcpassword=$(openssl rand -base64 32)
 rpcuser=$(openssl rand -base64 32)
 EOF
 
-
-                f2=$dir/bitcoinjm.conf
-                s cp $f $f2
-                s tee -a $f2 >/dev/null <<EOF
-# Joinmarket
-walletnotify=curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s
-alertnotify=curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s
-wallet=joinmarket.dat
-EOF
                 # dunno about sharing a wallet between multiple instances
                 # manually did, wallet.dat symlinked in /nocow/.bitcoin
                 sgo bitcoind
@@ -1247,34 +1267,55 @@ EOF
             ;;
         # other distros unknown
     esac
-    pi libsodium-dev python-pip
-    cd /a/opt/joinmarket
-    # using develop branch, as it seems to be mostly bug fixes,
-    # and this is quite new software.
-    # note: python3 does not work.
-    # has seg fault error due to some bug, but it still works
-    pip install -r requirements.txt || [[ $? == 139 ]]
-    # note, the target must exist ahead of time, or bitcoin
-    # just overwrites the link, and it\'s not happy with an empty file,
-    # so we have to create the wallet, then move and link it.
-    s lnf -T /q/bitcoin/wallet.dat /nocow/.bitcoin/wallet.dat
-    s lnf -T /q/bitcoin/joinmarket.dat /nocow/.bitcoin/joinmarket.dat
-    # not technically needed, but seems cleaner not to have
-    # symlinks be root owned unlike everything else
-    s chown -h bitcoin:bitcoin /nocow/.bitcoin/*
-
-    for var in rpcuser rpcpassword; do
-        u="$(s sed -rn "s/^$var=(.*)/\1/p" /etc/bitcoin/bitcoin.conf)"
-        # escape backslashes
-        u="${u//\\/\\\\\\\\}"
-        # escape commas
-        u="${u//,/\\,}"
-        sed -ri "s,^(rpc_${var#rpc}\s*=).*,\1 $u," joinmarket.cfg
-    done
-    sed -ri "s/^\s*(blockchain_source\s*=).*/\1 bitcoin-rpc/" joinmarket.cfg
 
-fi
+#     ## disabling joinmarket, its too expensive
+#     ### begin joinmarket setup ###
+
+#     case $distro in
+#         debian)
+#             f=$dir/bitcoin.conf
+#             f2=$dir/bitcoinjm.conf
+#             s cp $f $f2
+#             s tee -a $f2 >/dev/null <<EOF
+# # Joinmarket
+# walletnotify=curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s
+# alertnotify=curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s
+# wallet=joinmarket.dat
+# EOF
 
+#             ;;
+#         # other distros unknown
+#     esac
+
+#     pi libsodium-dev python-pip
+#     cd /a/opt/joinmarket
+#     # using develop branch, as it seems to be mostly bug fixes,
+#     # and this is quite new software.
+#     # note: python3 does not work.
+#     # has seg fault error due to some bug, but it still works
+#     pip install -r requirements.txt || [[ $? == 139 ]]
+#     # note, the target must exist ahead of time, or bitcoin
+#     # just overwrites the link, and it\'s not happy with an empty file,
+#     # so we have to create the wallet, then move and link it.
+#     s lnf -T /q/bitcoin/wallet.dat /nocow/.bitcoin/wallet.dat
+#     s lnf -T /q/bitcoin/joinmarket.dat /nocow/.bitcoin/joinmarket.dat
+#     # not technically needed, but seems cleaner not to have
+#     # symlinks be root owned unlike everything else
+#     s chown -h bitcoin:bitcoin /nocow/.bitcoin/*
+
+#     for var in rpcuser rpcpassword; do
+#         u="$(s sed -rn "s/^$var=(.*)/\1/p" /etc/bitcoin/bitcoin.conf)"
+#         # escape backslashes
+#         u="${u//\\/\\\\\\\\}"
+#         # escape commas
+#         u="${u//,/\\,}"
+#         sed -ri "s,^(rpc_${var#rpc}\s*=).*,\1 $u," joinmarket.cfg
+#     done
+#     sed -ri "s/^\s*(blockchain_source\s*=).*/\1 bitcoin-rpc/" joinmarket.cfg
+#     ### end joinmarket setup ###
+
+
+fi
 
 
 case $distro in
@@ -1392,8 +1433,8 @@ fi
 #         s systemctl daemon-reload
 #         case $HOSTNAME in
 #             x2|treetowl)
-#                 ser enable synergyc@ian
-#                 ser start synergyc@ian ||: # X might not be running yet
+#                 ser enable synergyc@iank
+#                 ser start synergyc@iank ||: # X might not be running yet
 #                 ;;
 #             frodo)
 #                 systemctl --user start synergys ||:
@@ -1540,20 +1581,11 @@ if [[ $HOSTNAME == treetowl ]]; then
     # ser list-timers
 fi
 
-if [[ $HOSTNAME == treetowl ]] && [[ `debian-archive` != testing ]]; then
-    # fail2 ban is broken, with a workaround, per
-    # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770171
-    # ill wait a while to see if it gets fixed
-    pi fail2ban
-    sgo fail2ban
-fi
-
-
 
 
 
 case $distro in
-    debian|ubuntu|trisquel) s gpasswd -a ian adm ;; #needed for reading logs
+    debian|ubuntu|trisquel) s gpasswd -a iank adm ;; #needed for reading logs
 esac
 
 # tor