README.MSCHAP80 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. PPP Support for Microsoft's CHAP-80
  2. ===================================
  3. Eric Rosenquist rosenqui@strataware.com
  4. (updated by Paul Mackerras)
  5. (updated by Al Longyear)
  6. (updated by Farrell Woods)
  7. (updated by Frank Cusack)
  8. INTRODUCTION
  9. Microsoft has introduced an extension to the Challenge/Handshake
  10. Authentication Protocol (CHAP) which avoids storing cleartext
  11. passwords on a server. (Unfortunately, this is not as secure as it
  12. sounds, because the encrypted password stored on a server can be used
  13. by a bogus client to gain access to the server just as easily as if
  14. the password were stored in cleartext.) The details of the Microsoft
  15. extensions can be found in the document:
  16. <http://www.ietf.org/rfc/rfc2433.txt>
  17. In short, MS-CHAP is identified as <auth chap 80> since the hex value
  18. of 80 is used to designate Microsoft's scheme. Standard PPP CHAP uses
  19. a value of 5. If you enable PPP debugging with the "debug" option and
  20. see something like the following in your logs, the remote server is
  21. requesting MS-CHAP:
  22. rcvd [LCP ConfReq id=0x2 <asyncmap 0x0> <auth MS> <magic 0x46a3>]
  23. ^^^^^^^
  24. MS-CHAP is enabled by default under Linux in pppd/Makefile.linux by
  25. the line "CHAPMS=y".
  26. CONFIGURATION
  27. If you've never used PPPD with CHAP before, read the man page (type
  28. "man pppd") and read the description in there. Basically, you need to
  29. edit the "chap-secrets" file typically named /etc/ppp/chap-secrets.
  30. This should contain the following two lines for each system with which
  31. you use CHAP (with no leading blanks):
  32. RemoteHost Account Secret
  33. Account RemoteHost Secret
  34. Note that you need both lines and that item 1 and 2 are swapped in the
  35. second line. I'm not sure why you need it twice, but it works and I didn't
  36. have time to look into it further. The "RemoteHost" is a somewhat
  37. arbitrary name for the remote Windows NT system you're dialing. It doesn't
  38. have to match the NT system's name, but it *does* have to match what you
  39. use with the "remotename" parameter. The "Account" is the Windows NT
  40. account name you have been told to use when dialing, and the "Secret" is
  41. the password for that account. For example, if your service provider calls
  42. their machine "DialupNT" and tells you your account and password are
  43. "customer47" and "foobar", add the following to your chap-secrets file:
  44. DialupNT customer47 foobar
  45. customer47 DialupNT foobar
  46. The only other thing you need to do for MS-CHAP (compared to normal CHAP)
  47. is to always use the "remotename" option, either on the command line or in
  48. your "options" file (see the pppd man page for details). In the case of
  49. the above example, you would need to use the following command line:
  50. pppd name customer47 remotename DialupNT <other options>
  51. or add:
  52. name customer47
  53. remotename DialupNT
  54. to your PPPD "options" file.
  55. The "remotename" option is required for MS-CHAP since Microsoft PPP servers
  56. don't send their system name in the CHAP challenge packet.
  57. E=691 (AUTHENTICATION_FAILURE) ERRORS WHEN YOU HAVE THE VALID SECRET (PASSWORD)
  58. If your RAS server is not the domain controller and is not a 'stand-alone'
  59. server then it must make a query to the domain controller for your domain.
  60. You need to specify the domain name with the user name when you attempt to
  61. use this type of a configuration. The domain name is specified with the
  62. local name in the chap-secrets file and with the option for the 'name'
  63. parameter.
  64. For example, the previous example would become:
  65. DialupNT domain\\customer47 foobar
  66. domain\\customer47 DialupNT foobar
  67. and
  68. pppd name 'domain\\customer47' remotename DialupNT <other options>
  69. or add:
  70. name domain\\customer47
  71. remotename DialupNT
  72. when the Windows NT domain name is simply called 'domain'.
  73. TROUBLESHOOTING
  74. Assuming that everything else has been configured correctly for PPP and
  75. CHAP, the MS-CHAP-specific problems you're likely to encounter are mostly
  76. related to your Windows NT account and its settings. A Microsoft server
  77. returns error codes in its CHAP response. The following are extracted from
  78. RFC 2433:
  79. 646 ERROR_RESTRICTED_LOGON_HOURS
  80. 647 ERROR_ACCT_DISABLED
  81. 648 ERROR_PASSWD_EXPIRED
  82. 649 ERROR_NO_DIALIN_PERMISSION
  83. 691 ERROR_AUTHENTICATION_FAILURE
  84. 709 ERROR_CHANGING_PASSWORD
  85. You'll see these in your pppd log as a line similar to:
  86. Remote message: E=649 R=0
  87. The "E=" is the error number from the table above, and the "R=" flag
  88. indicates whether the error is transient and the client should retry. If
  89. you consistently get error 691, then either you're using the wrong account
  90. name/password, or the DES library or MD4 hashing (in md4.c) aren't working
  91. properly. Verify your account name and password (use a Windows NT or
  92. Windows 95 system to dial-in if you have one available). If that checks
  93. out, test the DES library with the "destest" program included with the DES
  94. library. If DES checks out, the md4.c routines are probably failing
  95. (system byte ordering may be a problem) or my code is screwing up. I've
  96. only got access to a Linux system, so you're on your own for anything else.
  97. Another thing that might cause problems is that some RAS servers won't
  98. respond at all to LCP config requests without seeing the word "CLIENT"
  99. from the other end. If you see pppd sending out LCP config requests
  100. without getting any reply, try putting something in your chat script
  101. to send the word CLIENT after the modem has connected.
  102. STILL TO DO
  103. A site using only MS-CHAP to authenticate has no need to store cleartext
  104. passwords in the "chap-secrets" file. A utility that spits out the ASCII
  105. hex MD4 hash of a given password would be nice, and would allow that hash
  106. to be used in chap-secrets in place of the password. The code to do this
  107. could quite easily be lifted from chap_ms.c (you have to convert the
  108. password to Unicode before hashing it). The chap_ms.c file would also have
  109. to be changed to recognize a password hash (16 binary bytes == 32 ASCII hex
  110. characters) and skip the hashing stage. This would have no real security
  111. value as the hash is plaintext-equivalent.