µÚÒ»·¶ÎÄÍø - רҵÎÄÕ·¶ÀýÎĵµ×ÊÁÏ·ÖÏíÆ½Ì¨

centos´î½¨freeradius

À´Ô´£ºÓû§·ÖÏí ʱ¼ä£º2025/10/27 18:25:35 ±¾ÎÄÓÉloading ·ÖÏí ÏÂÔØÕâÆªÎĵµÊÖ»ú°æ
˵Ã÷£ºÎÄÕÂÄÚÈݽö¹©Ô¤ÀÀ£¬²¿·ÖÄÚÈÝ¿ÉÄܲ»È«£¬ÐèÒªÍêÕûÎĵµ»òÕßÐèÒª¸´ÖÆÄÚÈÝ£¬ÇëÏÂÔØwordºóʹÓá£ÏÂÔØwordÓÐÎÊÌâÇëÌí¼Ó΢ÐźÅ:xxxxxxx»òQQ£ºxxxxxx ´¦Àí£¨¾¡¿ÉÄܸøÄúÌṩÍêÕûÎĵµ£©£¬¸ÐлÄúµÄÖ§³ÖÓëÁ½⡣

1.°²×°openssl,mysql,freeradius,freeradius-utils(Ö§³Öradtest) yum install openssl yum install mysql yum install freeradius yum install freeradius-utils

Æô¶¯radius·þÎñ£º radiusd -X

±¸×¢£ºÕâ¸ö·½·¨ºÜʵÓã¬ÓÈÆäÊÇÔÚdebug²âÊԽ׶Σ¬¿ÉÒÔÏêϸµÄ¿´µ½Óû§ÈÏÖ¤µÄÁ÷³Ì£¬ÈÏÖ¤·½Ê½£¬Óû§Ãû/ÃÜÂ룬´íÎóÏûÏ¢£¬·½±ã¿ìËÙ¶¨Î»¡£

1.½²½âfreeradiusÁ½¸ö×îÖØÒª×î»ù±¾µÄÎļþ£ºusersºÍclients.conf 1.1 Ïêϸ½²½â/etc/raddb/clients.confÎļþ client 127.0.0.1/24 { secret = localtest #¹²ÏíÃÜÔ¿,ÓÃÓÚpap/chap/mschapÈÏÖ¤ shortname = any #FQDN»òIPµØÖ·±ðÃû£¬ÎÒÓÃany/localhost/127.0.0.1¶¼²âÊÔ¹ý£¬¿´²»³öÊ²Ã´Çø±ð¡£Õâ¸öÖµÔÚ2.XÒ²²»ÊDZØÐë¡£ } client localhost { ipaddr = 127.0.0.1 secret = localtest require_message_authenticator = no # ÔÚ1.x°æ±¾£¬client·¢ËÍAccess-Requestʱ²»»áЯ´øMessage-Authenticator£¬µ«ÊÇ´Ó2.xÒÔºó£¬RFC5080½¨ÒéËùÓеÄclients·¢ËÍMessage-Authenticator£¬Èç¹ûÉèΪyes£¬clientûÓÐЯ´øMessage-Authenticator£¬±¨ÎÄ»áÇÄÇĵÄdiscardedµô£¬¶ø²»»á֪ͨclient # shortname = localhost #optional in 2.x nastype = other #nastype¸æËß¡®checkrad.pl¡¯Ê¹ÓÃÄĸöNAS-specific ·½·¨²éѯ¿ÉͬʱʹÓõÄNAS¡£ localhost²»ÐèҪʹÓÃNAS¡£ #ÏÂÃæÁ½¸öÅäÖÃÊÇΪ½«À´±£Áô¡£µ±Ç°Ê¹Óá®naspassed¡¯Îļþ´æ´¢NASµÄÓû§ÃûºÍÃÜÂ룬ÕâÔÚcheckrad.pl²éѯ¿ÉÒÔͬʱʹÓõÄNAS¡£ # login = !root # password = someadminpas #´Ó2.0¿ªÊ¼£¬clients¿ÉÒÔÖ¸¶¨Ò»¸övirtual serverÈ磺 # virtual_server = home1 #Ò»¸öÖ¸Ïò¡®home_server_pool¡¯»ò¡®home_server¡¯µÄָʾÆ÷°üÀ¨Õâ¸öclientµÄCoaÅäÖá£ÀýÈ磬һ¸öcoaµÄhome server»òhome pool£¬²Î¿¼raddb/sites-available/originate-coa¡£ # coa_server = coa #½µµÍ´Óclientµ½serverµÄresponse_windowµÄ±¨ÎÄ£¬×¢Òâ²»¿ÉÒÔÔö´óresponse_window. # response_window = 10.0 } # IPv6 Client

#client ::1 { # secret = testing123 # shortname = localhost #} # # All IPv6 Site-local clients #client fe80::/16 { # secret = testing123 # shortname = localhost #} #client some.host.org { # secret = testing123 # shortname = localhost #} #client 10.10.10.10 { # # secret and password are mapped through the \ # secret = testing123 # shortname = liv1 # # the following three fields are optional, but may be used by # # checkrad.pl for simultaneous usage checks # nastype = livingston # login = !root # password = someadminpas #} ####################################################################### # # Per-socket client lists. The configuration entries are exactly the same as above, but they are nested inside of a section. # Per-socket client lists. ÕâЩÅäÖÃÌõÄ¿ºÍÉÏÃæµÄÒ»Ñù£¬µ«ÊÇǶÌ×ÔÚÕⲿ·Ö¡£ # # You can have as many per-socket client lists as you have \sections, or you can re-use a list among multiple \ # Äã¿ÉÒÔÌîдËùÓеÄlisten²¿·Ö£¬»òÕßÖØÐ´Ò»¸ölistÔÚ¶à¸ölistenÕ½ÚÖС£ # Un-comment this section, and edit a \per_socket_clients\ # È¡Ïû×¢ÊÍÕⲿ·Ö£¬±à¼­listen²¿·Ö£¬Ôö¼Ó:\= per_socket_clients\ # That IP address/port combinationwill then accept ONLY the clients listed in this section.

# Ö»½ÓÊÜÕⲿ·Ö°üÀ¨µÄclientsµÄipµØÖ·ºÍ¶Ë¿ÚºÅ¶Ô¡£ #

#clients per_socket_clients { # client 192.168.3.4 { # secret = testing123 # } #}

1.2 Ïêϸ½²½â/etc/raddb/users

testAuth-Type := CHAP, Cleartext-Password := \ Reply-Message = \ %{User-Name}\ ±¸×¢£ºÏÖÔÚÒѾ­ÓÃCleartest-PasswordÕâ¸ö²ÎÊýÌæ´úÁËUser-Password£¬%{User-Name}»ñÈ¡Óû§Ãû

2.chapÑéÖ¤·½Ê½

2.1 ÔÚ/etc/raddb/users Ìí¼ÓÈçÏÂÅäÖãº

testAuth-Type := CHAP, Cleartext-Password := \ Reply-Message = \ %{User-Name}\

2.2 ÔÚ/etc/raddb/clients.confÌí¼ÓÈçÏ¿ͻ§¶Ë.Ìí¼Ó¿Í»§¶ËÓÐÁ½¸÷°æ±¾£º1.ÔÚ1.x°æ±¾¸ñʽÊÇ£¬clientºóÃæ¸ú×ÅipµØÖ·£¬·½·¨ÌåÄÚÓÃshortnameÇø·ÖÆäËûclient£¬Õâ¸öÊDZØÐëÌîµÄ¡£2.ÔÚ2.xµÄ°æ±¾¸ñʽÊÇ£¬clientºóÃæ¸ú×ÅÒ»¸öÃû×Ö£¬Ê¹ÓÃipaddr»òÕßipv6addrÅäÖÿͻ§¶ËipµØÖ·¡£Õâʱºòshortname¾Í³ÉΪ¿ÉÑ¡²ÎÊýÁË¡£ client 172.22.4.0/24 { secret = adcforever shortname = any } client 127.0.0.1/24 { secret = localtest #¹²ÏíÃÜÔ¿ shortname = any #FQDN»òIPµØÖ·±ðÃû£¬ÎÒÓÃany/localhost/127.0.0.1¶¼²âÊÔ¹ý£¬¿´²»³öÊ²Ã´Çø±ð¡£Õâ¸öÖµÔÚ2.XÒ²²»ÊDZØÐë¡£ } client localhost { ipaddr = 127.0.0.1 secret = localtest require_message_authenticator = no nastype = other } 2.3 ʹÓÃradtestÑéÖ¤

Usage: radtest [OPTIONS] user passwd radius-server[:port] nas-port-number secret [ppphint] [nasname]

[root@ADCTEST ~]# radtest -t chap test 123456 localhost 0 testing123 Sending Access-Request of id 1 to 127.0.0.1 port 1812

User-Name = \

CHAP-Password = 0x015fe7280a953af2331ba99066be43f30f NAS-IP-Address = 59.108.66.243 NAS-Port = 0

Message-Authenticator = 0x00000000000000000000000000000000 rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=1, length=46 CHAP-Password = 0x74657374696e67313233 Reply-Message = \ test\

2.4 ²é¿´radiusd·þÎñ¶Ëlog rad_recv: Access-Request packet from host 127.0.0.1 port 35882, id=173, length=75 User-Name = \

CHAP-Password = 0xad5524e1db4033bc5854e9a97bd8353ed9 NAS-IP-Address = 59.108.66.243 NAS-Port = 0

Message-Authenticator = 0x418d9e36f01f344e79887dda7fb8da5f # Executing section authorize from file /etc/raddb/sites-enabled/default +- entering group authorize {...} ++[preprocess] returns ok [chap] Setting 'Auth-Type := CHAP' ++[chap] returns ok ++[mschap] returns noop ++[digest] returns noop [suffix] No '@' in User-Name = \ [suffix] No such realm \ ++[suffix] returns noop [eap] No EAP-Message, not doing EAP ++[eap] returns noop [files] users: Matched entry test at line 73 [files] expand: Hello, %{User-Name} -> Hello, test ++[files] returns ok ++[expiration] returns noop ++[logintime] returns noop [pap] WARNING: Auth-Type already set. Not setting to PAP ++[pap] returns noop Found Auth-Type = CHAP # Executing group from file /etc/raddb/sites-enabled/default +- entering group CHAP {...} [chap] login attempt by \ [chap] Using clear text password \ [chap] chap user test authenticated succesfully ++[chap] returns ok # Executing section post-auth from file /etc/raddb/sites-enabled/default +- entering group post-auth {...} ++[exec] returns noop

ËÑË÷¸ü¶à¹ØÓÚ£º centos´î½¨freeradius µÄÎĵµ
centos´î½¨freeradius.doc ½«±¾ÎĵÄWordÎĵµÏÂÔØµ½µçÄÔ£¬·½±ã¸´ÖÆ¡¢±à¼­¡¢ÊղغʹòÓ¡
±¾ÎÄÁ´½Ó£ºhttps://www.diyifanwen.net/c1hive1p3ix1cf865cb8x_1.html£¨×ªÔØÇë×¢Ã÷ÎÄÕÂÀ´Ô´£©
ÈÈÃÅÍÆ¼ö
Copyright © 2012-2023 µÚÒ»·¶ÎÄÍø °æÈ¨ËùÓÐ ÃâÔðÉùÃ÷ | ÁªÏµÎÒÃÇ
ÉùÃ÷ :±¾ÍøÕ¾×ðÖØ²¢±£»¤ÖªÊ¶²úȨ£¬¸ù¾Ý¡¶ÐÅÏ¢ÍøÂç´«²¥È¨±£»¤ÌõÀý¡·£¬Èç¹ûÎÒÃÇ×ªÔØµÄ×÷Æ·ÇÖ·¸ÁËÄúµÄȨÀû,ÇëÔÚÒ»¸öÔÂÄÚ֪ͨÎÒÃÇ£¬ÎÒÃǻἰʱɾ³ý¡£
¿Í·þQQ£ºxxxxxx ÓÊÏ䣺xxxxxx@qq.com
ÓåICP±¸2023013149ºÅ
Top