mirror of
https://gitlab.com/hacklab01/pivilion.git
synced 2025-04-29 16:47:17 +00:00
Compare commits
18 Commits
b18157ae7d
...
f9d0816b46
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f9d0816b46 | ||
![]() |
4453731974 | ||
![]() |
1e31c3a8c8 | ||
![]() |
b6a105f477 | ||
![]() |
2252ed14c1 | ||
![]() |
bef229e43f | ||
![]() |
476e254cc9 | ||
![]() |
d86a9dd76a | ||
![]() |
6e0ef56b3d | ||
![]() |
cf8f219630 | ||
![]() |
5b0cdee390 | ||
![]() |
b0f02c639e | ||
![]() |
5252ac87a5 | ||
![]() |
01d553ee25 | ||
![]() |
e636db27d3 | ||
![]() |
0c78b5349a | ||
![]() |
6e686794c9 | ||
![]() |
ea3d3998c5 |
19
home/pi/pivilion/config/dnsmasq.hotspot
Normal file
19
home/pi/pivilion/config/dnsmasq.hotspot
Normal 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/#
|
9
home/pi/pivilion/config/hostapd.hotspot
Normal file
9
home/pi/pivilion/config/hostapd.hotspot
Normal file
@ -0,0 +1,9 @@
|
||||
interface=wlan0
|
||||
channel=6
|
||||
hw_mode=g
|
||||
|
||||
ssid=pivilion
|
||||
|
||||
bridge=br0
|
||||
auth_algs=1
|
||||
wmm_enabled=0
|
0
home/pi/pivilion/config/html/.gitkeep
Normal file
0
home/pi/pivilion/config/html/.gitkeep
Normal file
4
home/pi/pivilion/config/html/.htaccess
Normal file
4
home/pi/pivilion/config/html/.htaccess
Normal 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]
|
31
home/pi/pivilion/config/html/index.php
Normal file
31
home/pi/pivilion/config/html/index.php
Normal 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>
|
5
home/pi/pivilion/config/override.hotspot
Normal file
5
home/pi/pivilion/config/override.hotspot
Normal file
@ -0,0 +1,5 @@
|
||||
<Directory /var/www/>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
20
home/pi/pivilion/config/rc.hotspot
Normal file
20
home/pi/pivilion/config/rc.hotspot
Normal 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
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user