add everything so cindy can get it
[challenge-bot] / bbb / local / bin / allow-bbb-to-use-this-systems-internet.bash
diff --git a/bbb/local/bin/allow-bbb-to-use-this-systems-internet.bash b/bbb/local/bin/allow-bbb-to-use-this-systems-internet.bash
new file mode 100755 (executable)
index 0000000..85d1483
--- /dev/null
@@ -0,0 +1,32 @@
+#! /usr/bin/env bash
+
+#  Copyright (C) 2016 Daniel Watson
+#  See the end of the file for license conditions.
+#   GNU AGPLv3 (or later at your option)
+#   https://challenge-bot.com/
+
+set -o nounset
+set -o errexit
+
+ETH="${1}"
+sudo ifconfig "${ETH}" 192.168.7.1
+sudo iptables \
+     --table nat \
+     --append POSTROUTING \
+     --out-interface wlan0 \
+     -j MASQUERADE
+sudo iptables --append FORWARD --in-interface "${ETH}" -j ACCEPT
+echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
+
+# Challenge-bot is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU Affero Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with challenge-bot.  If not, see <http://www.gnu.org/licenses/>.