Configurar aprovar acesso rede guest por email / Configure approve guest network access via email
Prezados, boa noite, alguem saberia como é possivel configurar uma forma de aprovar o acesso a rede guest pelo email ?
Exemplo, o usuario conecta na rede guest, preenche um formulario e cheg aum email para aprovar pelo gestor da rede.
Dear, good night, would anyone know how it is possible to configure a way to approve guest network access by email?
For example, the user connects to the guest network, fills out a form and gets an email to be approved by the network manager.
- Copy Link
- Subscribe
- Bookmark
- Report Inappropriate Content
no. nothing like this. your request is way more advanced and not seem to be a portal. portal is for something to get authenticated and get internet instantly. not like you write an email and wait for the admin to authorize. is this for a business network like office? then your network admin should be settings there waiting for each email and gotta reply in a minute once the email request arrives? i'd say wow.
if you need to fill out a form and send to the email, why would bother to use portal? portal can collect info like a chart for cafe/mall promo. but unlike what you said. that's way formal than a portal scenario.
you should set up a portal page and put terms of service like: email to example.at.exmaple.. to get net connection. but they don't get internet in the end. and complain..
btw, mail server is something you gotta host a domain to use like that way. this is a router/switch/ap controller instead a fancy all-in-one linux server.
- Copy Link
- Report Inappropriate Content
Yes, the company has about 150 employees currently connected to wifi.
It has a manager who only takes care of the approvals in the guest network.
Because we receive many visits, and we cannot let anyone connect to the network, only those who have the manager's approval.
I have an email server, web server, domain, all the infrastructure for hosting, including the omada SDN running on linux.
What I thought, when the user logs in, be directed to a page (external portal), where he fills in the name, email, and purpose or reason to connect to the network and after filling out, he is forwarded to a notice that was requested for approval.
At that moment it saves the information in the mysql database ( mac, ip, name, email, website, omadaid, others... ).
And send an email to the manager with a link
site/approve.php?id=XXXX
when you click on this link, it fetches the information and sends a post to the omada controller API to approve the user for 24 hours.
Therefore, the user will automatically connect without requesting login again.
Only 24 hours after use.
Yes this is a corporate network.
- Copy Link
- Report Inappropriate Content
Sim, a empresa possui cerca de 150 funcionarios conectados atualmente no wifi.
Tem um gerente que cuida somente das aprovações na rede guest.
Pois recebemos muitas visitas, e não podemos deixar qualquer um conectar na rede, somente quem tem aprovação do gestor.
Possuo servidor de email, servidor web, dominio, toda a infraestrutura para hospedagem, inclusive tem o omada SDN rodando em linux.
Oque pensei, quando usuario realizar login, ser direcionado para uma pagina (portal externo), onde ele preenche o nome, email, e objetivo ou motivo para conectar na rede e após preencher ser encaminhado para um aviso que foi solicitado a aprovação.
Nesse momento ele guarda as informaçõe no banco de dados mysql ( mac, ip, nome, email, site, omadaid, outras... ).
E envia um email para o gestor com um link
site/aprove.php?id=XXXX
quando clica nesse link, ele busca as informações e manda um post no API do omada controller para aprovar o usuario por 24 horas.
Sendo assim, o usuario já irá conectar automaticamente sem solicitar login novamente.
Somente 24 horas após o uso.
Sim isso é uma rede corporativa.
- Copy Link
- Report Inappropriate Content
<?php
session_start();
$_SESSION["target"] = $_GET["target"];
$_SESSION["targetPort"] = $_GET["targetPort"];
$_SESSION["clientMac"] = $_GET["clientMac"];
$_SESSION["clientIp"] = $_GET["clientIp"];
$_SESSION["radiusServerIp"] = $_GET["radiusServerIp"];
$_SESSION["apMac"] = $_GET["apMac"];
$_SESSION["gatewayMac"] = $_GET["gatewayMac"];
$_SESSION["scheme"] = $_GET["scheme"];
$_SESSION["ssidName"] = $_GET["ssidName"];
$_SESSION["vid"] = $_GET["vid"];
$_SESSION["radioId"] = $_GET["radioId"];
$_SESSION["originUrl"] = $_GET["originUrl"];
$_SESSION["site"] = $_GET["site"];
$_SESSION["url"] = $_GET["redirectUrl"];
$_SESSION["t"] = $_GET["t"];
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Acesso ao WIFI GUEST DH </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<p>Bem Vindo ao Wifi Visitantes da escola DH!<br>
Entre com suas informações</p>
<form method="post" action="form-8703.php">
Nome
<input type="text" name="nome" placeholder="Nome"><br>
Telefone
<input type="text" name="telefone" placeholder="Telefone"><br>
E-mail
<input type="text" name="email" placeholder="E-Mail"><br>
Objetivo da conexão
<input type="text" name="mensagem" placeholder="Objectivo"><br>
<input type="submit" value="Conectar">
</form>
</body>
</html>
- Copy Link
- Report Inappropriate Content
<?php
session_start();
// Inclui o arquivo class.phpmailer.php localizado na mesma pasta do arquivo php
include "PHPMailer-master/PHPMailerAutoload.php";
$nome = $_POST['nome'];
$email = $_POST['email'];
$telefone = $_POST['telefone'];
$mensagem = $_POST['mensagem'];
$target = $_SESSION["target"];
$targetPort = $_SESSION["targetPort"];
$clientMac = $_SESSION["clientMac"];
$clientIp = $_SESSION["clientIp"];
$radiusServerIp = $_SESSION["radiusServerIp"];
$apMac = $_SESSION["apMac"];
$gatewayMac = $_SESSION["gatewayMac"];
$scheme = $_SESSION["scheme"];
$ssidName = $_SESSION["ssidName"];
$site = $_SESSION["site"];
$vid = $_SESSION["vid"];
$t = $_SESSION["t"];
$radioId = $_SESSION["radioId"];
$originUrl = $_SESSION["url"];
$mensagem = "SEGUE AS INFOS DE $nome \n<br> EMAIL: $email \n<br> TELEFONE: $telefone \n<br> OBJETIVO: $mensagem \n<br> TARGET: $target \n<br> TARGETPORT: $targetPort \n<br> CLIENTEIP: $clientIp \n<br> CLIENTMAC: $clientMac \n<br> RADIUSID: $radioId \n<br> RADIUSIP: $radiusServerIp \n<br> MAC AP: $apMac \n<br> MAC GATEWAY: $gatewayMac \n<br> SCHEME: $scheme \n<br> SSID: $ssidName \n<br> VLANID: $vid \n<br> URL ORIGEM: $originUrl \n<br> TEMPO: $t \n<br> SITE: $site \n<br> LINK PARA APROVAR: SITE/scripts/form-8704.php?clientMac=$clientMac&apMac=$apMac&ssidName=$ssidName&radioId=$radioId&site=$site&time=$t&authType=4";
// Inicia a classe PHPMailer
$mail = new PHPMailer();
// Método de envio
$mail->IsSMTP();
// Enviar por SMTP
$mail->Host = "smtphost";
// Você pode alterar este parametro para o endereço de SMTP do seu provedor
$mail->Port = 587;
// Usar autenticação SMTP (obrigatório)
$mail->SMTPAuth = true;
// Usuário do servidor SMTP (endereço de email)
// obs: Use a mesma senha da sua conta de email
$mail->Username = 'email';
$mail->Password = 'Password';
// Configurações de compatibilidade para autenticação em TLS
$mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) );
// Você pode habilitar esta opção caso tenha problemas. Assim pode identificar mensagens de erro.
// $mail->SMTPDebug = 2;
// Define o remetente
// Seu e-mail
$mail->From = "email";
// Seu nome
$mail->FromName = "email";
// Define o(s) destinatário(s)
$mail->AddAddress('email', 'email');
$mail->IsHTML(true);
// Charset (opcional)
$mail->CharSet = 'UTF-8';
// Assunto da mensagem
$mail->Subject = "Solicitação de acesso de $nome ao wifi visitante";
// Corpo do email
$mail->Body = "$mensagem";
// Opcional: Anexos
// $mail->AddAttachment("/home/usuario/public_html/documento.pdf", "documento.pdf");
// Envia o e-mail
$enviado = $mail->Send();
// Exibe uma mensagem de resultado
if ($enviado)
{
echo "Acesso solicitado, em breve será aprovado.";
} else {
echo "Houve um erro enviando o email: ".$mail->ErrorInfo;
}
?>
- Copy Link
- Report Inappropriate Content
<?php
session_start();
$clientMac = $_GET["clientMac"];
$apMac = $_GET["apMac"];
$ssidName = $_GET["ssidName"];
$radioId = $_GET["radioId"];
$site = $_GET["site"];
$time = $_GET["t"];
$authType = $_GET["authType"];
class aprovar {
public static function login()
{
$loginInfo = array(
"aprssove" => OPERATOR_USER,
"irffri123s" => OPERATOR_PASSWORD
);
echo "setou login info <br>";
$headers = array(
"Content-Type: application/json",
"Accept: application/json"
);
echo "setou headers <br>";
$ch = curl_init();
// post
echo "iniciou o curl <br>";
curl_setopt($ch, CURLOPT_POST, TRUE);
echo "ativou o post<br>";
// Set return to a value, not return to page
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set up cookies. COOKIE_FILE_PATH defines where to save Cookie.
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE_PATH);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE_PATH);
echo "setou o cookies <br>";
// Allow Self Signed Certs
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
echo "habilitou o sef signed <br>";
// API Call
curl_setopt($ch, CURLOPT_URL, "https://ip:8043/729881ec436c05cae52d4007416344ac/api/v2/hotspot/login");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($loginInfo));
echo "chamou a api <br>";
$res = curl_exec($ch);
echo "executou o login <br>";
$resObj = json_decode($res);
echo "respondeu <br>";
//Prevent CSRF. TOKEN_FILE_PATH defines where to save Token.
if ($resObj->errorCode == 0) {
// login successfully
echo "logou <br>";
self::setCSRFToken($resObj->result->token);
}
else
{
echo "não logou <br>";
}
curl_close($ch);
echo "fechou o curl login <br>";
}
private static function setCSRFToken($token)
{
echo "iniciou o set token <br>";
$myfile = fopen("token.txt", "w") or die("Unable to open file!");
echo "abriu o token <br>";
fwrite($myfile, $token);
echo "escreveu o token <br>";
fclose($myfile);
echo "fechou o token <br>";
return $token;
}
public static function authorize($clientMac, $apMac, $ssidName, $radioId, $milliseconds)
{
// Send user to authorize and the time allowed
$authInfo = array(
'clientMac' => $clientMac,
'apMac' => $apMac,
'ssidName' => $ssidName,
'radioId' => $radioId,
'time' => $time,
'authType' => 4
);
echo "setou as info do autorize <br>";
$csrfToken = self::getCSRFToken();
echo "leu o token <br>";
$headers = array(
'Content-Type: application/json',
'Accept: application/json',
'Csrf-Token: ' . $csrfToken
);
echo "setou os headers <br>";
$ch = curl_init();
echo "iniciou o curl <br>";
// post
curl_setopt($ch, CURLOPT_POST, TRUE);
// Set return to a value, not return to page
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set up cookies.
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE_PATH);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE_PATH);
// Allow Self Signed Certs
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
// API Call
curl_setopt($ch, CURLOPT_URL, "https://ip:8043/api/v2/hotspot/extPortal/auth/"."?token=".$csrfToken);
echo "$csrfToken <br>";
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($authInfo));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
echo "chamou a api o login <br>";
$res = curl_exec($ch);
echo "executou a api o login <br>";
echo $res;
$resObj = json_decode($res);
if ($resObj->errorCode == 0) {
echo "AUTORIZADO ! <br>";
}
else
{
echo "Não autorizou <br>";
}
curl_close($ch);
echo "fechou o curl <br>";
}
public static function getCSRFToken()
{
echo "solicitou o tokenn <br>";
$myfile = fopen("token.txt", "r") or die("Unable to open file!");
echo "abriu o token <br>";
$token = fgets($myfile);
echo "aleu";
fclose($myfile);
echo "afechou o token <br>";
return $token;
}
}
echo aprovar::login();
echo aprovar::authorize($clientMac,$apMac,$ssidName,$radioId,$time);
?>
- Copy Link
- Report Inappropriate Content
Depois de muito esforço consegui fazer o fluxo de aprovação por email.
Inclusive agora vou aprimorar para um painel de aprovação da rede guest ( atraves de mysql ).
After a lot of effort I managed to do the approval flow by email.
Even now I'm going to improve it to a guest network approval panel (through mysql).
- Copy Link
- Report Inappropriate Content
Information
Helpful: 0
Views: 657
Replies: 7
Voters 0
No one has voted for it yet.