venerdì 19 ottobre 2018

NoDogSplash captive portal in OpenWRT

Aggiornamento
questo e' la risposta degli sviluppatori

First of all, almost all operating systems on both mobile and laptop/desktop now support the defacto standard Captive Portal Detection (CPD) function designed to facilitate a secure and consistent login to captive portals. This by default uses a cut down browser that is very restricted for security purposes.
What you are seeing on Android is the CPD browser blocking iframes.
On your laptop you will be using your normal browser.

---------------------------------------------------------------------------

Il mio scopo e' quello di far girare NoDogSplash captive portal su GL.iNet AR150 con firmware OpenWRT Stock in modo che la pagina di benvenuto (nel linguaggio di NoDog e' la splash page) mostri contenuti ripresi da un sito web esterno e che sia quindi dinamica

Per prima cosa devo precisare che il firmware stable dell'AR150 monta una versione di NoDogSplash abbastanza vecchiotta ovvero la 0.9_beta9.9.9-5 (ho provato a montare anche il firmware in testing ma le cose migliorano di poco perche' opkg installa la 1.0.2.1)


Per creare il portale captivo ho tolto il WPA all'AP e poi usata la seguente configurazione
In pratica ho aggiunto alle regole di firewalle la possibilita' per utenti non autenticati di poter
raggiungere il sito 150.217.xxx.xxx su porta 80
---------------------------------------------------------------------------------
config instance
  # Set to 1 to enable nodogsplash
  option enabled 1

  # Use plain configuration file as well
  #option config '/etc/nodogsplash/nodogsplash.conf'
  option network 'lan'
  option gatewayname 'OpenWrt Nodogsplash'
  option maxclients '250'
  option idletimeout '1200'
  #option redirecturl 'http://c1p81.altervista.org/montecatini/'
  #qoption authenticateimmediately 'yes'



  # Your router may have several interfaces, and you
  # probably want to keep them private from the network/gatewayinterface.
  # If so, you should block the entire subnets on those interfaces, e.g.:
  list authenticated_users 'block to 192.168.0.0/16'
  list authenticated_users 'block to 10.0.0.0/8'

  # Typical ports you will probably want to open up.
  list authenticated_users 'allow tcp port 22'
  list authenticated_users 'allow tcp port 53'
  list authenticated_users 'allow udp port 53'
  list authenticated_users 'allow tcp port 80'
  list authenticated_users 'allow tcp port 443'

  # For preauthenticated users to resolve IP addresses in their
  # initial request not using the router itself as a DNS server,
  list preauthenticated_users 'allow tcp port 53'
  list preauthenticated_users 'allow udp port 53'
  llst preauthenticated_users 'allow tpc port 80 to 150.217.xxx.xxx'
  # Allow ports for SSH/Telnet/DNS/DHCP/HTTP/HTTPS
  list users_to_router 'allow tcp port 22'
  list users_to_router 'allow tcp port 23'
  list users_to_router 'allow tcp port 53'
  list users_to_router 'allow udp port 53'
  list users_to_router 'allow udp port 67'
  list users_to_router 'allow tcp port 80'
  list users_to_router 'allow tcp port 443'

  # See https://github.com/nodogsplash for a full list of available options.
----------------------------------------------------------------

in seguito ho modificato lo splash.html come
l'idea e' quella di avere un iframe nel quale visualizzare la pagina derivante
dal sito esterno all'interno della pagina statica splash.html
-----------------------------------------------------------------
<html>
<head>
<title>$gatewayname Entry</title>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
</head>
<body bgcolor="#DDDDDD" text="#000000">

<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td align="center"><h2>Luca $gatewayname</h2></td>
</tr>
<tr>
<td align="center">
<iframe height="710" width="720" src="http://150.217.73.108"></iframe>
</td>
</tr>

<tr>
<td align="center" height="120">
<!--
A client is authenticated by requesting the page $authtarget.
So, href to it here, with an img or link text the user can click on.
Also, note that any images you reference must reside in the
subdirectory that is the value of $imagesdir (default: "images").
-->
<a href="$authtarget">
<!--<img src="$imagesdir/splash.jpg" width="71" height="49" border="0"
alt="Click to enter" title="Click to enter">-->
<img src="http://c1p81.altervista.org/montecatini/img/logo_strong.jpg">
<img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
</a>
</td>
</tr>
</table>
<form method='GET' action='$authaction'>
  <input type='hidden' name='tok' value='$tok'>
  <input type='hidden' name='redir' value='$redir'>
  <input type='submit' value='Click Here to Enter'>
</form>
</body>
</html>

---------------------------------------------------------------------
la cosa divertente e' che tutto funziona perfettamente se mi collego da portatile con Chrome


mentre la stessa pagina vista dal telefono (Android 9) viene visualizzata cosi'

Una soluzione potrebbe essere la  modalita' Forwarding Authentication Service (FAS) (che in pratica reindirizza il login su un server esterno dovre peraltro potrebbe girare anche Php) ma non sembra funzionare (anche perche' tutti i tutorial sono per NoDogSplash 2....)

Nessun commento:

Posta un commento

Retrain Yolo8 con rifiuti su spiaggia

Ho provato a fare il retraining di Yolo 8 con rifiuti spiaggiati usando il dataset al link sottostante  https://universe.roboflow.com/baeula...