1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

ovpn, uap0 compatibility; readme

This commit is contained in:
Taikuh 2020-03-15 19:02:20 +08:00
parent 5d57765669
commit 8082430c30
6 changed files with 24 additions and 4 deletions

View File

@ -16,6 +16,7 @@ We hope you enjoy using RaspAP as much as we do creating it. Tell us how you use
- [Prerequisites](#prerequisites) - [Prerequisites](#prerequisites)
- [Quick installer](#quick-installer) - [Quick installer](#quick-installer)
- [Bridged AP](#bridged-ap)
- [Simultaneous AP and Wifi client](#simultaneous-ap-and-wifi-client) - [Simultaneous AP and Wifi client](#simultaneous-ap-and-wifi-client)
- [Support us](#support-us) - [Support us](#support-us)
- [Manual installation](#manual-installation) - [Manual installation](#manual-installation)
@ -60,6 +61,11 @@ configured as an access point as follows:
**Note:** As the name suggests, the Quick Installer is a great way to quickly setup a new AP. However, it does not automagically detect the unique configuration of your RPi. Best results are obtained by connecting an RPi to ethernet (`eth0`) or as a WiFi client, also known as managed mode, with `wlan0`. For the latter, refer to [this FAQ](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode). Please [read this](https://github.com/billz/raspap-webgui/wiki/Reporting-issues) before reporting an issue. **Note:** As the name suggests, the Quick Installer is a great way to quickly setup a new AP. However, it does not automagically detect the unique configuration of your RPi. Best results are obtained by connecting an RPi to ethernet (`eth0`) or as a WiFi client, also known as managed mode, with `wlan0`. For the latter, refer to [this FAQ](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode). Please [read this](https://github.com/billz/raspap-webgui/wiki/Reporting-issues) before reporting an issue.
## Bridged AP
By default RaspAP configures a routed AP for your clients to connect to. A bridged AP configuration is also possible. Slide the **Bridged AP mode** toggle under the **Advanced** tab of **Configure hotspot**, then save and restart the hotspot.
**Note:** In bridged mode, all routing capabilities are handled by your upstream router. Because your router assigns IP addresses to your RPi's hotspot and its clients, you might not be able to reach the RaspAP web interface from the default `10.3.141.1` address. Instead use your RPi's hostname followed by `.local` to access the RaspAP web interface. With Raspbian default settings, this should look like `raspberrypi.local`.
## Simultaneous AP and Wifi client ## Simultaneous AP and Wifi client
RaspAP lets you easily create an AP with a Wifi client configuration. With your RPi configured in managed mode, enable the AP from the **Advanced** tab of **Configure hotspot** by sliding the **Wifi client AP mode** toggle. Save settings and start the hotspot. The managed mode AP is functional without restart. RaspAP lets you easily create an AP with a Wifi client configuration. With your RPi configured in managed mode, enable the AP from the **Advanced** tab of **Configure hotspot** by sliding the **Wifi client AP mode** toggle. Save settings and start the hotspot. The managed mode AP is functional without restart.

View File

@ -246,11 +246,11 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
} }
if ($wifiAPEnable == 1) { if ($wifiAPEnable == 1) {
$config.= 'interface=uap0'.PHP_EOL; $config.= 'interface=uap0'.PHP_EOL;
} elseif ($bridgedEnable == 1) {
$config.='interface='.RASPI_WIFI_CLIENT_INTERFACE.PHP_EOL;
$config.= 'bridge=br0'.PHP_EOL;
} else { } else {
$config.= 'interface='.$_POST['interface'].PHP_EOL; $config.= 'interface='.$_POST['interface'].PHP_EOL;
if ($bridgedEnable == 1) {
$config.= 'bridge=br0'.PHP_EOL;
}
} }
$config.= 'wpa='.$_POST['wpa'].PHP_EOL; $config.= 'wpa='.$_POST['wpa'].PHP_EOL;
$config.= 'wpa_pairwise='.$_POST['wpa_pairwise'].PHP_EOL; $config.= 'wpa_pairwise='.$_POST['wpa_pairwise'].PHP_EOL;

View File

@ -21,12 +21,14 @@ function DisplayOpenVPNConfig()
} elseif (isset($_POST['StartOpenVPN'])) { } elseif (isset($_POST['StartOpenVPN'])) {
$status->addMessage('Attempting to start OpenVPN', 'info'); $status->addMessage('Attempting to start OpenVPN', 'info');
exec('sudo /bin/systemctl start openvpn-client@client', $return); exec('sudo /bin/systemctl start openvpn-client@client', $return);
exec('sudo /bin/systemctl enable openvpn-client@client', $return);
foreach ($return as $line) { foreach ($return as $line) {
$status->addMessage($line, 'info'); $status->addMessage($line, 'info');
} }
} elseif (isset($_POST['StopOpenVPN'])) { } elseif (isset($_POST['StopOpenVPN'])) {
$status->addMessage('Attempting to stop OpenVPN', 'info'); $status->addMessage('Attempting to stop OpenVPN', 'info');
exec('sudo /bin/systemctl stop openvpn-client@client', $return); exec('sudo /bin/systemctl stop openvpn-client@client', $return);
exec('sudo /bin/systemctl disable openvpn-client@client', $return);
foreach ($return as $line) { foreach ($return as $line) {
$status->addMessage($line, 'info'); $status->addMessage($line, 'info');
} }

View File

@ -325,7 +325,9 @@ function patch_system_files() {
"/bin/systemctl start dnsmasq.service" "/bin/systemctl start dnsmasq.service"
"/bin/systemctl stop dnsmasq.service" "/bin/systemctl stop dnsmasq.service"
"/bin/systemctl start openvpn-client@client" "/bin/systemctl start openvpn-client@client"
"/bin/systemctl enable openvpn-client@client"
"/bin/systemctl stop openvpn-client@client" "/bin/systemctl stop openvpn-client@client"
"/bin/systemctl disable openvpn-client@client"
"/bin/cp /tmp/ovpnclient.ovpn /etc/openvpn/client/client.conf" "/bin/cp /tmp/ovpnclient.ovpn /etc/openvpn/client/client.conf"
"/bin/cp /tmp/authdata /etc/openvpn/client/login.conf" "/bin/cp /tmp/authdata /etc/openvpn/client/login.conf"
"/bin/cp /tmp/dnsmasqdata /etc/dnsmasq.conf" "/bin/cp /tmp/dnsmasqdata /etc/dnsmasq.conf"

View File

@ -34,7 +34,8 @@ lines=(
for line in "${lines[@]}"; do for line in "${lines[@]}"; do
if grep "$line" /etc/rc.local > /dev/null; then if grep "$line" /etc/rc.local > /dev/null; then
else echo "$line: Line already added"
else
sudo sed -i "s/^exit 0$/$line\nexit 0/" /etc/rc.local sudo sed -i "s/^exit 0$/$line\nexit 0/" /etc/rc.local
echo "Adding rule: $line" echo "Adding rule: $line"
fi fi

View File

@ -7,6 +7,7 @@ NAME=raspap
DESC="Service control for RaspAP" DESC="Service control for RaspAP"
CONFIGFILE="/etc/raspap/hostapd.ini" CONFIGFILE="/etc/raspap/hostapd.ini"
DAEMONPATH="/lib/systemd/system/raspap.service" DAEMONPATH="/lib/systemd/system/raspap.service"
OPENVPNENABLED=$(pidof openvpn | wc -l)
positional=() positional=()
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
@ -29,6 +30,7 @@ done
set -- "${positional[@]}" set -- "${positional[@]}"
echo "Stopping network services..." echo "Stopping network services..."
systemctl stop openvpn-client@client
systemctl stop systemd-networkd systemctl stop systemd-networkd
systemctl stop hostapd.service systemctl stop hostapd.service
systemctl stop dnsmasq.service systemctl stop dnsmasq.service
@ -51,6 +53,9 @@ if [ -r "$CONFIGFILE" ]; then
ip link set down eth0 ip link set down eth0
ip link set up eth0 ip link set up eth0
echo "Removing uap0 interface..."
iw dev uap0 del
echo "Enabling systemd-networkd" echo "Enabling systemd-networkd"
systemctl start systemd-networkd systemctl start systemd-networkd
systemctl enable systemd-networkd systemctl enable systemd-networkd
@ -87,5 +92,9 @@ sleep "${seconds}"
systemctl start dnsmasq.service systemctl start dnsmasq.service
if [ $OPENVPNENABLED -eq 1 ]; then
systemctl start openvpn-client@client
fi
echo "RaspAP service start DONE" echo "RaspAP service start DONE"