Compare commits

...

18 Commits

Author SHA1 Message Date
v3d
f9d0816b46 Update usr/local/bin/hotspot 2022-05-04 21:40:02 +00:00
v3d
4453731974 Update home/pi/pivilion/config/dnsmasq.hotspot, usr/local/bin/hotspot 2022-05-04 21:39:36 +00:00
v3d
1e31c3a8c8 Update home/pi/pivilion/config/dnsmasq.hotspot 2022-05-04 21:37:51 +00:00
v3d
b6a105f477 Update home/pi/pivilion/config/html/index.php 2022-05-04 21:29:19 +00:00
v3d
2252ed14c1 Update home/pi/pivilion/config/html/index.php 2022-05-04 21:26:55 +00:00
v3d
bef229e43f Update var/www/html/pivilion/gen/index.html 2022-05-04 21:26:28 +00:00
v3d
476e254cc9 Update home/pi/pivilion/config/html/.htaccess 2022-05-04 21:23:06 +00:00
v3d
d86a9dd76a Upload New File 2022-05-04 21:09:09 +00:00
v3d
6e0ef56b3d Delete index.php 2022-05-04 21:04:32 +00:00
v3d
cf8f219630 Upload New File 2022-05-04 21:04:07 +00:00
v3d
5b0cdee390 Upload New File 2022-05-04 21:03:54 +00:00
v3d
b0f02c639e Add new directory 2022-05-04 21:03:34 +00:00
v3d
5252ac87a5 Upload New File 2022-05-04 21:02:59 +00:00
v3d
01d553ee25 Upload New File 2022-05-04 21:02:28 +00:00
v3d
e636db27d3 Upload New File 2022-05-04 21:02:10 +00:00
v3d
0c78b5349a Upload New File 2022-05-04 21:01:36 +00:00
v3d
6e686794c9 Update for captive portal 2022-05-04 20:59:26 +00:00
v3d
ea3d3998c5 update for captive 2022-05-04 20:03:21 +00:00
10 changed files with 129 additions and 32 deletions

View File

@ -0,0 +1,19 @@
interface=br0
listen-address=10.1.1.1
no-hosts
dhcp-range=10.1.1.2,10.1.1.254,72h
dhcp-option=option:router,10.1.1.1
dhcp-authoritative
address=/#/10.1.1.1
address=/clients1.google.com/1.2.3.4
address=/clients3.google.com/1.2.3.4
address=/connectivitycheck.android.com/1.2.3.4
address=/connectivitycheck.gstatic.com/1.2.3.4
address=/connect.rom.miui.com/generate_204/1.2.3.4
address=/www.apple.com/library/test/success.html/1.2.3.4
server=/0.debian.pool.ntp.org/#
server=/1.debian.pool.ntp.org/#
server=/2.debian.pool.ntp.org/#
server=/3.debian.pool.ntp.org/#
server=/deb.debian.org/debian/#
#server=/formatc.hr/#

View File

@ -0,0 +1,9 @@
interface=wlan0
channel=6
hw_mode=g
ssid=pivilion
bridge=br0
auth_algs=1
wmm_enabled=0

View File

View File

@ -0,0 +1,4 @@
RewriteEngine on
RewriteCond %{REQUEST_URI} !(\/index\.php)$
RewriteCond %{REQUEST_URI} !(\/pi-logo_128\.png)$
RewriteRule ^(.*)$ http://10.1.1.1/index.php [L,R=301]

View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome to Pivilion</title>
<style type="text/css">
html {
background-image: url("pi-logo_128.png");
padding: 10px;
}
body {
font-family: monospace;
font-size: 14px;
color: white;
background-color: black;
padding:10px;
display: table;
}
a {
font-weight: bold;
text-decoration: underline;
color: white;
}
</style>
</head>
<body>
<h1>Welcome to Pivilion!</h1>
<p>Access your Rpi using SFTP or consult the manual to get your content here. </p>
<p>For more info visit <a href="http://pivilion.net">pivilion.net</a>
</body>
</html>

View File

@ -0,0 +1,5 @@
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>

View File

@ -0,0 +1,20 @@
#!/bin/bash
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

View File

@ -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

View File

@ -1,13 +1,26 @@
#!/bin/bash
#!/bin/sh -e
cat /home/pi/pivilion/config/dhcpcd.deny.wlan0 > /etc/dhcpcd.conf
echo "Checking for required packages and installing if missing"
if [ $(dpkg-query -W -f='${Status}' apache2 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
sudo apt update
sudo apt -y install hostapd dnsmasq apache2 php
fi
echo "Configuring components..."
sudo cp -f /home/pi/pivilion/config/hostapd.hotspot /etc/hostapd/hostapd.conf
sudo cp -f /home/pi/pivilion/config/dnsmasq.hotspot /etc/dnsmasq.conf
sudo cp -rf /home/pi/pivilion/config/html /var/www/
sudo chown -R www-data:www-data /var/www/html
sudo chown root:www-data /var/www/html/.htaccess
sudo cp -f rc.hotspot /etc/rc.local
sudo cp -f override.hotspot /etc/apache2/conf-available/override.conf
sudo a2enconf override
sudo a2enmod rewrite
sudo bash -c 'cat /home/pi/pivilion/config/interfaces.hotspot > /etc/network/interfaces'
echo "Backing up wireless network configuration..."
sudo mv /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.bak
sudo update-rc.d dnsmasq enable
echo "Captive portal enabled. Reboot to execute."
sudo bash -c 'cat /home/pi/pivilion/config/rc.local.hotspot > /etc/rc.local'
echo "Your Rpi will reboot in hotspot mode"!
sudo bash -c 'echo "hotspot" > /home/pi/pivilion/mode'
sudo bash -c 'echo "hotspot" > /home/pi/pivilion/mode'
exit 0

View File

@ -25,7 +25,7 @@
</head>
<body>
<h1>Welcome to Pivilion!</h1>
<p>Go make a gallery at yourRpilocalIP:81 or upload your own HTML to /var/www/html/pivilion/gen or change the server directory in /etc/lighttpd/lighttpd.conf.</p>
<p>Access your Rpi using SFTP or consult the manual to get your content here. </p>
<p>For more info visit <a href="http://pivilion.net">pivilion.net</a>
<p>The gallery generation script will overwrite this file.</p>
</body>