Merhaba arkadaşlar,
ücretsiz bir şekilde kullanabileceğim bir hotspot captive portal ihtiyacım var. Pfsense ile denedik ama başarılı olamadık T.C Kimlik no SMS yada doğum tarihinden doğrulama gerekli KVKK için.
Yardımcı olabilecek varmı ne kullanabilirim?
hotspot captive portal ihtiyacı
2
●120
- 02-12-2024, 16:45:51
- 02-12-2024, 16:48:27Pfsense ile tc doğrulama yapabilirsiniz.
Forumda tc kimlik doğrulama için örnek PHP fonksiyon paylaşılmıştı.
Captiveportal kaynak kodlarını düzenlemeniz gerekecek.
/usr/local/captiveportal sanıyorum buradaydı.
Edit: haftaya bir ağ için hem loglama hem captive portal kurulumu yapacağım. Buradan paylaşırım.
https://www.r10.net/php/4118411-t-c-...yonu-hk-2.html
talhacimen58 adlı üyeden alıntı: mesajı görüntüle
TC doğrulamalı captive portal için internetteki paylaşılan paketlerin güncel freebsd ile uyumsuzluğundan dolayı maalesef çalıştıramadım.
Şu şekilde yaptım:
1- Pfsense apiyi yükledim
2- API key oluşturdum.
3- Captive portal custom login sayfası hazırladım. Bu sayfada hem kayıt hem de giriş alanı var:
Bu sayfadan kayıt ol yapılırsa, javascript ile validate.php dosyasına istek atıyorum, bu sayfada önce tc doğrulaması yapılıyor, ardından üye pfsense'e ekleniyor.
validate.php
<?php function NVITCSorgula($bilgiler = array()) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <TCKimlikNoDogrula xmlns="http://tckimlik.nvi.gov.tr/WS"> <TCKimlikNo>'.$bilgiler['TCKimlikNo'].'</TCKimlikNo> <Ad>'.$bilgiler['Ad'].'</Ad> <Soyad>'.$bilgiler['Soyad'].'</Soyad> <DogumYili>'.$bilgiler['DogumYili'].'</DogumYili> </TCKimlikNoDogrula> </soap:Body> </soap:Envelope>', CURLOPT_HTTPHEADER => array( 'POST: /Service/KPSPublic.asmx HTTP/1.1', 'Host: tckimlik.nvi.gov.tr', 'Content-Type: text/xml; charset=utf-8', 'SOAPAction: "http://tckimlik.nvi.gov.tr/WS/TCKimlikNoDogrula"', 'Cookie: TS0193588c=01e4b30442ae308bf9bb635dc7895298e8f2d382b1f484a1209cb70726a4888c12c705b7ed57df13477e3ae27f77feafa66b531bab' ), )); $response = curl_exec($curl); $result = simplexml_load_string($response); $result = $result->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children()->TCKimlikNoDogrulaResponse->TCKimlikNoDogrulaResult; if ($result == 'true') { return true; } else { return false; } } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $tc = $_POST['tc']; $name = $_POST['name']; $lastname = $_POST['lastname']; $birthdate = $_POST['birthdate']; $birthYear = explode('-', $birthdate)[0]; $password = $_POST['password']; $bilgiler = [ 'TCKimlikNo' => $tc, 'Ad' => $name, 'Soyad' => $lastname, 'DogumYili' => $birthYear ]; $userData = [ 'tc' => $tc, 'name' => 'fatihakan', 'password' => $password ]; if (NVITCSorgula($bilgiler)) { $result = addUserToPfsense($userData); if (isset($result['code']) && $result['code'] === 400) { if (strpos($result['message'], 'Field `name` must be unique') !== false) { echo json_encode(['success' => false, 'error' => 'Bu TC Kimlik Numarası zaten kayıtlı']); exit; } } echo json_encode(['success' => true]); } else { echo json_encode(['success' => false, 'error' => 'Geçersiz TC Kimlik No']); } } function addUserToPfsense($userData) { $apiUrl = 'http://192.168.5.1/api/v2/user'; $apiKey = 'pfsense_api_key'; $data = [ 'name' => $userData['tc'], 'password' => $userData['password'], 'disabled' => false, 'descr' => $userData['name'] ?? 'Captive Portal User' ]; $ch = curl_init($apiUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-API-Key: ' . $apiKey, 'Content-Type: application/json' ]); $response = curl_exec($ch); if(curl_errno($ch)) { $error = curl_error($ch); curl_close($ch); return ['error' => $error]; } curl_close($ch); return json_decode($response, true); }