Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.85 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. /**
  5. * RADIUS client example using PAP password.
  6. */
  7.  
  8. error_reporting(E_ALL);
  9. ini_set('display_errors', 1);
  10.  
  11. require_once __DIR__ . '/../autoload.php';
  12.  
  13. $radius = new \Dapphp\Radius\Radius();
  14. $radius->setServer('[2001:718:1001:2c6::129]')        // IP or hostname of RADIUS server
  15.        ->setSecret('radiussecret')       // RADIUS shared secret
  16.        //->setNasIpAddress('127.0.0.1')  // IP or hostname of NAS (device authenticating user)
  17.        //->setAttribute(32, 'vpn')       // NAS identifier
  18.        ->setDebug();                   // Enable debug output to screen/console
  19.  
  20. // Send access request for a user with username = 'username' and password = 'password!'
  21. $response = $radius->accessRequest('user', 'user');
  22.  
  23. if ($response === false) {
  24.     // false returned on failure
  25.     echo sprintf("Access-Request failed with error %d (%s).\n",
  26.         $radius->getErrorCode(),
  27.         $radius->getErrorMessage()
  28.     );
  29. } else {
  30.     // access request was accepted - client authenticated successfully
  31.     echo "Success!  Received Access-Accept response from RADIUS server.\n";
  32. }
  33.  
  34.  
  35.  
  36. #####kdyz komunikace projde
  37. 2017-12-11 21:28:07 DEBUG: Added Attribute 1 (User-Name), format S, value user
  38. 2017-12-11 21:28:07 DEBUG: Added Attribute 2 (User-Password), format S, value 鍫觙Y6虌腧鹣庙�
  39. 2017-12-11 21:28:07 DEBUG: Added Attribute 6 (Service-Type), format I, value 1
  40. 2017-12-11 21:28:07 DEBUG: Packet type 1 (Access-Request) sent
  41. 2017-12-11 21:28:07 DEBUG: Attribute 1 (User-Name), length (4), format S, value user
  42. 2017-12-11 21:28:07 DEBUG: Attribute 2 (User-Password), length (16), format S, value 鍫觙Y6虌腧鹣庙�
  43. 2017-12-11 21:28:07 DEBUG: Attribute 6 (Service-Type), length (4), format I, value 1
  44. 2017-12-11 21:28:07 DEBUG: Packet type 2 (Access-Accept) received
  45. 2017-12-11 21:28:07 DEBUG: Attribute 6 (Service-Type), length 4, format I, value 2
  46. 2017-12-11 21:28:07 DEBUG: Attribute 7 (Framed-Protocol), length 4, format I, value 1
  47. 2017-12-11 21:28:07 DEBUG: Attribute 13 (Framed-Compression), length 4, format I, value 1
  48. Success! Received Access-Accept response from RADIUS server.
  49.  
  50. #####kdyz komunikace neprojde
  51. 2017-12-11 21:28:16 DEBUG: Added Attribute 1 (User-Name), format S, value user
  52. 2017-12-11 21:28:16 DEBUG: Added Attribute 2 (User-Password), format S, value Ú;ýØŸÝl=-H:dZÂf
  53. 2017-12-11 21:28:16 DEBUG: Added Attribute 6 (Service-Type), format I, value 1
  54. 2017-12-11 21:28:16 DEBUG: Packet type 1 (Access-Request) sent
  55. 2017-12-11 21:28:16 DEBUG: Attribute 1 (User-Name), length (4), format S, value user
  56. 2017-12-11 21:28:16 DEBUG: Attribute 2 (User-Password), length (16), format S, value Ú;ýØŸÝl=-H:dZÂf
  57. 2017-12-11 21:28:16 DEBUG: Attribute 6 (Service-Type), length (4), format I, value 1
  58. 2017-12-11 21:28:17 DEBUG: Packet type 3 (Access-Reject) received
  59. Access-Request failed with error 3 (Access rejected).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement