From 5859f71bb01552dcfd6ac08f9145e295a65bebc5 Mon Sep 17 00:00:00 2001 From: Jared Null Date: Sun, 10 Mar 2019 16:55:52 -0700 Subject: [PATCH 1/9] Updated scp command Current example scp command won't work without :~ at the end. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 789f27b..79ba22b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Get access to a server (e.g. on digitalocean or some other place) running Ubuntu 1) Copy the `create_exitnode.sh` script onto your soon-to-be-exitnode server: ``` -scp create_exitnode.sh @ +scp create_exitnode.sh @:~ ``` 2) Log into the server: From 68aa6fcc315fa608c5640defd8624211144c8fe8 Mon Sep 17 00:00:00 2001 From: Jared Null Date: Sun, 10 Mar 2019 16:58:18 -0700 Subject: [PATCH 2/9] Iproute changed to iproute2 + extras module name changed `linux-image-extra-` to `linux-modules-extra-` `iproute` to `iproute2` --- create_exitnode.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/create_exitnode.sh b/create_exitnode.sh index 582f1bb..025dd39 100755 --- a/create_exitnode.sh +++ b/create_exitnode.sh @@ -42,7 +42,7 @@ DEBIAN_FRONTEND=noninteractive apt-get update if [ "$release_name" = '"Ubuntu"' ]; then DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ - "linux-image-extra-$(uname -r)" + "linux-modules-extra-$(uname -r)" fi DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ @@ -71,7 +71,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ libevent-dev \ ebtables \ vim \ - iproute \ + iproute2 \ bridge-utils \ libnetfilter-conntrack-dev \ libnfnetlink-dev \ From caf309c3f8f94017a084002b23a6f9bf5c0ded6f Mon Sep 17 00:00:00 2001 From: Jared Null Date: Sun, 10 Mar 2019 17:13:40 -0700 Subject: [PATCH 3/9] --force replaced by --allow --force is the same as: --allow-downgrades --allow-remove-essential --allow-change-held-packages --- create_exitnode.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/create_exitnode.sh b/create_exitnode.sh index 025dd39..cb7d98a 100755 --- a/create_exitnode.sh +++ b/create_exitnode.sh @@ -41,11 +41,11 @@ echo "release_name=[$release_name]" DEBIAN_FRONTEND=noninteractive apt-get update if [ "$release_name" = '"Ubuntu"' ]; then - DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ + DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-remove-essential --allow-change-held-packages \ "linux-modules-extra-$(uname -r)" fi -DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ +DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-remove-essential --allow-change-held-packages \ build-essential \ ca-certificates \ curl \ @@ -80,7 +80,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ tmux \ netcat-openbsd -DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ +DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-remove-essential --allow-change-held-packages \ cmake \ libnl-3-dev \ libnl-genl-3-dev \ From d37d338f0b5dbe027b0169aeb6c4035a79770b5c Mon Sep 17 00:00:00 2001 From: Jared Null Date: Sun, 10 Mar 2019 17:16:08 -0700 Subject: [PATCH 4/9] removed duplicate iproute iproute package installed twice and deprecated for iproute2 --- create_exitnode.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/create_exitnode.sh b/create_exitnode.sh index cb7d98a..2ea2478 100755 --- a/create_exitnode.sh +++ b/create_exitnode.sh @@ -66,7 +66,6 @@ DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-re python \ python-dev \ python-pip \ - iproute \ libnetfilter-conntrack3 \ libevent-dev \ ebtables \ From 447ac9209943c580a2c6eca1908783482cfa936e Mon Sep 17 00:00:00 2001 From: Jared Null Date: Sun, 10 Mar 2019 17:36:52 -0700 Subject: [PATCH 5/9] added easy_install package easy_install not included as an install package --- create_exitnode.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/create_exitnode.sh b/create_exitnode.sh index 2ea2478..9773a89 100755 --- a/create_exitnode.sh +++ b/create_exitnode.sh @@ -66,6 +66,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-re python \ python-dev \ python-pip \ + easy_install \ libnetfilter-conntrack3 \ libevent-dev \ ebtables \ From fda667ba20566047cd1956b36b827308fe05cd30 Mon Sep 17 00:00:00 2001 From: Jared Null Date: Sun, 10 Mar 2019 18:11:22 -0700 Subject: [PATCH 6/9] Comment out easy_install easy_install has been removed from python-setuptools --- create_exitnode.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/create_exitnode.sh b/create_exitnode.sh index 9773a89..47e9991 100755 --- a/create_exitnode.sh +++ b/create_exitnode.sh @@ -66,7 +66,6 @@ DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-re python \ python-dev \ python-pip \ - easy_install \ libnetfilter-conntrack3 \ libevent-dev \ ebtables \ @@ -113,7 +112,7 @@ do done # see https://askubuntu.com/questions/561377/pip-wont-run-throws-errors-instead -easy_install -U pip +# easy_install -U pip #leaving here for future dev, i don't think Ubuntu 18.04 needs this though. pip install netfilter pip install virtualenv From 2950bfed6e56ed62d461d4f5b2234c89bf9a4282 Mon Sep 17 00:00:00 2001 From: Jared Null Date: Mon, 10 Jun 2019 18:27:56 -0700 Subject: [PATCH 7/9] Revert "Updated scp command" --- README.md | 2 +- create_exitnode.sh | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 79ba22b..789f27b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Get access to a server (e.g. on digitalocean or some other place) running Ubuntu 1) Copy the `create_exitnode.sh` script onto your soon-to-be-exitnode server: ``` -scp create_exitnode.sh @:~ +scp create_exitnode.sh @ ``` 2) Log into the server: diff --git a/create_exitnode.sh b/create_exitnode.sh index 47e9991..582f1bb 100755 --- a/create_exitnode.sh +++ b/create_exitnode.sh @@ -41,11 +41,11 @@ echo "release_name=[$release_name]" DEBIAN_FRONTEND=noninteractive apt-get update if [ "$release_name" = '"Ubuntu"' ]; then - DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-remove-essential --allow-change-held-packages \ - "linux-modules-extra-$(uname -r)" + DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ + "linux-image-extra-$(uname -r)" fi -DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-remove-essential --allow-change-held-packages \ +DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ build-essential \ ca-certificates \ curl \ @@ -66,11 +66,12 @@ DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-re python \ python-dev \ python-pip \ + iproute \ libnetfilter-conntrack3 \ libevent-dev \ ebtables \ vim \ - iproute2 \ + iproute \ bridge-utils \ libnetfilter-conntrack-dev \ libnfnetlink-dev \ @@ -79,7 +80,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-re tmux \ netcat-openbsd -DEBIAN_FRONTEND=noninteractive apt-get install -yq --allow-downgrades --allow-remove-essential --allow-change-held-packages \ +DEBIAN_FRONTEND=noninteractive apt-get install -yq --force-yes \ cmake \ libnl-3-dev \ libnl-genl-3-dev \ @@ -112,7 +113,7 @@ do done # see https://askubuntu.com/questions/561377/pip-wont-run-throws-errors-instead -# easy_install -U pip #leaving here for future dev, i don't think Ubuntu 18.04 needs this though. +easy_install -U pip pip install netfilter pip install virtualenv From bab5f13561642b23e20e44707efaf7b4727b790b Mon Sep 17 00:00:00 2001 From: Null Date: Mon, 10 Jun 2019 18:48:52 -0700 Subject: [PATCH 8/9] Added auto_monitor_sync script --- create_exitnode.sh | 2 ++ .../systemd/system/exitnode-monitor/sync-monitor.sh | 6 ++++++ src/etc/systemd/system/exitnode-sync.service | 13 +++++++++++++ src/etc/systemd/system/exitnode-sync.timer | 11 +++++++++++ 4 files changed, 32 insertions(+) create mode 100644 src/etc/systemd/system/exitnode-monitor/sync-monitor.sh create mode 100644 src/etc/systemd/system/exitnode-sync.service create mode 100644 src/etc/systemd/system/exitnode-sync.timer diff --git a/create_exitnode.sh b/create_exitnode.sh index 582f1bb..9aa724b 100755 --- a/create_exitnode.sh +++ b/create_exitnode.sh @@ -209,5 +209,7 @@ service babeld start systemctl start babeld-monitor.timer systemctl enable babeld-monitor.timer +systemctl stop exitnode-sync.timer +systemctl start exitnode-sync.timer reboot now diff --git a/src/etc/systemd/system/exitnode-monitor/sync-monitor.sh b/src/etc/systemd/system/exitnode-monitor/sync-monitor.sh new file mode 100644 index 0000000..1739ff7 --- /dev/null +++ b/src/etc/systemd/system/exitnode-monitor/sync-monitor.sh @@ -0,0 +1,6 @@ +ROUTES=$(ip route | grep via | grep -v default | awk '{print $1 "," $3 }' | sort | uniq | tr '\n' '|') +TOTAL_ROUTES=$(ip route | grep via | grep -v default | awk '{print $1 "\t" $3 }' | sort | uniq | wc -l) +TOTAL_GATEWAYS=$(ip route | grep via | grep -v default | awk '{print $3 }' | sort | uniq | wc -l) + +curl --silent -H 'Content-Type: text/plain' -d $ROUTES -X POST https://peoplesopen.herokuapp.com/api/v0/nodes > /dev/null +curl --silent -H "Content-Type: application/json" -d "{ \"numberOfRoutes\": $TOTAL_ROUTES, \"numberOfGateways\": $TOTAL_GATEWAYS }" -X POST https://peoplesopen.herokuapp.com/api/v0/monitor > /dev/null diff --git a/src/etc/systemd/system/exitnode-sync.service b/src/etc/systemd/system/exitnode-sync.service new file mode 100644 index 0000000..e4a3623 --- /dev/null +++ b/src/etc/systemd/system/exitnode-sync.service @@ -0,0 +1,13 @@ +[Unit] +Description=sync_peoplesopen.net/monitor. +After=network.target auditd.service + +[Service] +Type=simple +Nice=19 +IOSchedulingClass=2 +IOSchedulingPriority=7 +ExecStart=/bin/bash /opt/exitnode-monitor/sync-monitor.sh + +[Install] +WantedBy=multi-user.target diff --git a/src/etc/systemd/system/exitnode-sync.timer b/src/etc/systemd/system/exitnode-sync.timer new file mode 100644 index 0000000..bb3b69d --- /dev/null +++ b/src/etc/systemd/system/exitnode-sync.timer @@ -0,0 +1,11 @@ +[Unit] +Description=exitnode-monitor timer + +[Timer] +OnCalendar=*:0/1 + +[Install] +WantedBy=timers.target + +~ +~ From ec350eb868cb1b3d3b5ae01b3044f6a62297b3be Mon Sep 17 00:00:00 2001 From: Jared Null Date: Tue, 11 Jun 2019 22:13:47 -0700 Subject: [PATCH 9/9] Update create_exitnode.sh --- create_exitnode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_exitnode.sh b/create_exitnode.sh index 9aa724b..7b31a4a 100755 --- a/create_exitnode.sh +++ b/create_exitnode.sh @@ -209,7 +209,7 @@ service babeld start systemctl start babeld-monitor.timer systemctl enable babeld-monitor.timer -systemctl stop exitnode-sync.timer systemctl start exitnode-sync.timer +systemctl enable exitnode-sync.timer reboot now