3. 认证服务器:设置 FreeRADIUS

FreeRADIUS 是一个完全 GPL 许可的 RADIUS 服务器实现。它支持广泛的身份验证机制,但在本文档的示例中使用了 PEAP。

3.1. 安装 FreeRADIUS

安装 FreeRADIUS

  1. 前往 FreeRADIUS 网站 http://www.freeradius.org/,并下载最新版本。

       # cd /usr/local/src
       # wget ftp://ftp.freeradius.org/pub/radius/freeradius-1.0.0.tar.gz
       # tar zxfv freeradius-1.0.0.tar.gz
       # cd freeradius-1.0.0
      
  2. 配置,编译和安装

        # ./configure
        # make
        # make install
       

    您可以将选项传递给 configure。使用 ./configure --help 或阅读 README 文件以获取更多信息。

二进制文件安装在/usr/local/bin/usr/local/sbin。配置文件位于/usr/local/etc/raddb.

如果出现问题,请检查INSTALLREADME(包含在源代码中)。RADIUS FAQ 也包含有价值的信息。

3.2. 配置 FreeRADIUS

FreeRADIUS 有一个庞大而强大的配置文件。它非常大,以至于被拆分成几个较小的文件,这些文件只是 "包含" 在主radius.conf文件中。

有许多方法可以使用和设置 FreeRADIUS 来完成您想要的操作:例如,从 LDAP、SQL、PDC、Kerberos 等获取用户信息。在本文档中,使用了来自纯文本文件的用户信息,users

Tip

配置文件有详尽的注释,如果这还不够,源代码附带的doc/文件夹包含更多信息。

配置 FreeRADIUS

  1. 配置文件可以在/usr/local/etc/raddb/

        # cd /usr/local/etc/raddb/
       
  2. 下找到。打开主配置文件radiusd.conf并阅读注释! 在加密的 PEAP 隧道内部,使用了 MS-CHAPv2 身份验证机制。

    1. MPPE [RFC3078] 负责将 PMK 发送到 AP。确保设置了以下设置

          # under MODULES, make sure mschap is uncommented!
          mschap {
            # authtype value, if present, will be used
            # to overwrite (or add) Auth-Type during
            # authorization. Normally, should be MS-CHAP
            authtype = MS-CHAP
      
            # if use_mppe is not set to no, mschap will
            # add MS-CHAP-MPPE-Keys for MS-CHAPv1 and
            # MS-MPPE-Recv-Key/MS-MPPE-Send-Key for MS-CHAPv2
            #
            use_mppe = yes
      
            # if mppe is enabled, require_encryption makes
            # encryption moderate
            #
            require_encryption = yes
      
            # require_strong always requires 128 bit key
            # encryption
            #
            require_strong = yes
      
            authtype = MS-CHAP
            # The module can perform authentication itself, OR
            # use a Windows Domain Controller. See the radius.conf file
            # for how to do this.
          }
          
    2. 还要确保 "authorize""authenticate" 包含

          authorize {
              preprocess
              mschap
      	suffix
      	eap
      	files
          }
          
          authenticate {
               
               #
               #  MSCHAP authentication.    
               Auth-Type MS-CHAP {
                     mschap
                }
      	
      	 #
               #  Allow EAP authentication.
               eap
           }
          
  3. 然后,更改clients.conf文件以指定它服务的网络

       # Here, we specify which network we're serving
       client 192.168.0.0/16 { 
            # This is the shared secret between the Authenticator (the 
    	# access point) and the Authentication Server (RADIUS).
            secret          = SharedSecret99
            shortname       = testnet
        }
       
  4. Theeap.conf也应该非常简单明了。

    1. "default_eap_type" 设置为 "peap"

            default_eap_type = peap
           
    2. 由于 PEAP 使用 TLS,TLS 部分必须包含

          tls { 
              # The private key password
              private_key_password = SecretKeyPass77
      	# The private key
              private_key_file = ${raddbdir}/certs/cert-srv.pem
              #  Trusted Root CA list
              CA_file = ${raddbdir}/certs/demoCA/cacert.pem
              dh_file = ${raddbdir}/certs/dh
              random_file = /dev/urandom
      	}
          
    3. 找到 "peap" 部分,并确保它包含以下内容

            peap {
              #  The tunneled EAP session needs a default
              #  EAP type, which is separate from the one for
              #  the non-tunneled EAP module.  Inside of the
              #  PEAP tunnel, we recommend using MS-CHAPv2,
              #  as that is the default type supported by
              #  Windows clients.
              default_eap_type = mschapv2
            }
            
  5. 用户信息存储在纯文本文件users中。可能更希望使用更复杂的解决方案来存储用户信息(SQL、LDAP、PDC 等)。

    确保users文件包含以下条目

       "testuser"      User-Password == "Secret149"