Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * RADIUS client example using PAP password.
- */
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- require_once __DIR__ . '/../autoload.php';
- $radius = new \Dapphp\Radius\Radius();
- $radius->setServer('[2001:718:1001:2c6::129]') // IP or hostname of RADIUS server
- ->setSecret('radiussecret') // RADIUS shared secret
- //->setNasIpAddress('127.0.0.1') // IP or hostname of NAS (device authenticating user)
- //->setAttribute(32, 'vpn') // NAS identifier
- ->setDebug(); // Enable debug output to screen/console
- // Send access request for a user with username = 'username' and password = 'password!'
- $response = $radius->accessRequest('user', 'user');
- if ($response === false) {
- // false returned on failure
- echo sprintf("Access-Request failed with error %d (%s).\n",
- $radius->getErrorCode(),
- $radius->getErrorMessage()
- );
- } else {
- // access request was accepted - client authenticated successfully
- echo "Success! Received Access-Accept response from RADIUS server.\n";
- }
- #####kdyz komunikace projde
- 2017-12-11 21:28:07 DEBUG: Added Attribute 1 (User-Name), format S, value user
- 2017-12-11 21:28:07 DEBUG: Added Attribute 2 (User-Password), format S, value 鍫觙Y6虌腧鹣庙�
- 2017-12-11 21:28:07 DEBUG: Added Attribute 6 (Service-Type), format I, value 1
- 2017-12-11 21:28:07 DEBUG: Packet type 1 (Access-Request) sent
- 2017-12-11 21:28:07 DEBUG: Attribute 1 (User-Name), length (4), format S, value user
- 2017-12-11 21:28:07 DEBUG: Attribute 2 (User-Password), length (16), format S, value 鍫觙Y6虌腧鹣庙�
- 2017-12-11 21:28:07 DEBUG: Attribute 6 (Service-Type), length (4), format I, value 1
- 2017-12-11 21:28:07 DEBUG: Packet type 2 (Access-Accept) received
- 2017-12-11 21:28:07 DEBUG: Attribute 6 (Service-Type), length 4, format I, value 2
- 2017-12-11 21:28:07 DEBUG: Attribute 7 (Framed-Protocol), length 4, format I, value 1
- 2017-12-11 21:28:07 DEBUG: Attribute 13 (Framed-Compression), length 4, format I, value 1
- Success! Received Access-Accept response from RADIUS server.
- #####kdyz komunikace neprojde
- 2017-12-11 21:28:16 DEBUG: Added Attribute 1 (User-Name), format S, value user
- 2017-12-11 21:28:16 DEBUG: Added Attribute 2 (User-Password), format S, value Ú;ýØŸÝl=-H:dZÂf
- 2017-12-11 21:28:16 DEBUG: Added Attribute 6 (Service-Type), format I, value 1
- 2017-12-11 21:28:16 DEBUG: Packet type 1 (Access-Request) sent
- 2017-12-11 21:28:16 DEBUG: Attribute 1 (User-Name), length (4), format S, value user
- 2017-12-11 21:28:16 DEBUG: Attribute 2 (User-Password), length (16), format S, value Ú;ýØŸÝl=-H:dZÂf
- 2017-12-11 21:28:16 DEBUG: Attribute 6 (Service-Type), length (4), format I, value 1
- 2017-12-11 21:28:17 DEBUG: Packet type 3 (Access-Reject) received
- Access-Request failed with error 3 (Access rejected).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement