96d61f3d |
1 | #! /usr/bin/env bash |
2 | |
3 | # Copyright (C) 2016 Daniel Watson |
4 | # See the end of the file for license conditions. |
5 | # GNU AGPLv3 (or later at your option) |
6 | # https://challenge-bot.com/ |
7 | |
8 | set -o nounset |
9 | set -o errexit |
10 | |
11 | ETH="${1}" |
12 | sudo ifconfig "${ETH}" 192.168.7.1 |
13 | sudo iptables \ |
14 | --table nat \ |
15 | --append POSTROUTING \ |
16 | --out-interface wlan0 \ |
17 | -j MASQUERADE |
18 | sudo iptables --append FORWARD --in-interface "${ETH}" -j ACCEPT |
19 | echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null |
20 | |
21 | # Challenge-bot is free software: you can redistribute it and/or modify |
22 | # it under the terms of the GNU Affero General Public License as published by |
23 | # the Free Software Foundation, either version 3 of the License, or |
24 | # (at your option) any later version. |
25 | |
26 | # GNU Affero Emacs is distributed in the hope that it will be useful, |
27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29 | # GNU Affero General Public License for more details. |
30 | |
31 | # You should have received a copy of the GNU Affero General Public License |
32 | # along with challenge-bot. If not, see <http://www.gnu.org/licenses/>. |