From ea3d3998c54b21b62ead2156da84b0bf90a636bf Mon Sep 17 00:00:00 2001 From: v3d Date: Wed, 4 May 2022 20:03:21 +0000 Subject: [PATCH] update for captive --- home/pi/pivilion/config/rc.local.hotspot | 40 +++++++++++------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/home/pi/pivilion/config/rc.local.hotspot b/home/pi/pivilion/config/rc.local.hotspot index dfdac21..b19b0ca 100644 --- a/home/pi/pivilion/config/rc.local.hotspot +++ b/home/pi/pivilion/config/rc.local.hotspot @@ -1,24 +1,20 @@ -#!/bin/sh -e -# -# rc.local -# -# This script is executed at the end of each multiuser runlevel. -# Make sure that the script will "exit 0" on success or any other -# value on error. -# -# In order to enable or disable this script just change the execution -# bits. -# -# By default this script does nothing. +#!/bin/bash -# Print the IP address -_IP=$(hostname -I) || true -if [ "$_IP" ]; then - printf "My IP address is %s\n" "$_IP" -fi -# Display onion domain in MOTD -cat /var/lib/tor/hidden_service/hostname > /home/pi/torname -hostapd -d /etc/hostapd/hostapd.conf +service apache2 start +sleep 1 +ifconfig wlan0 down +ifconfig wlan0 up +sleep 1 +hostapd -B /etc/hostapd/hostapd.conf +sleep 2 +ifconfig br0 up +ifconfig br0 10.1.1.1 netmask 255.255.255.0 +sysctl net.ipv4.ip_forward=1 +iptables --flush +iptables -t nat --flush +iptables -t nat -A PREROUTING -i br0 -p udp -m udp --dport 53 -j DNAT --to-destination 10.1.1.1:53 +iptables -t nat -A PREROUTING -i br0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.1.1.1:80 +iptables -t nat -A PREROUTING -i br0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 10.1.1.1:80 +iptables -t nat -A POSTROUTING -j MASQUERADE +service dnsmasq start exit 0 - -