📄 pam-info
字号:
--------------------------------------PAM-ified RADIUS-------------------------------------- Written by Jeff Blaize <jblaize@kiva.net> All credit goes to him. Slightly modified by Cristian Gafton.At this point with the new PAMified radiusd installed, it should operate just asit always has. However, I've added a two more items to the dictionary thatmake it all worth our while. Here are some examples for the /etc/raddb/usersfile:DEFAULT Auth-Type = PAM, Framed-Protocol = PPP, Service-Type = Framed-User, Framed-Protocol = PPP, Framed-IP-Address = 255.255.255.254, Framed-MTU = 1500, Framed-Compression = Van-Jacobson-TCP-IP,DEFAULT Auth-Type = PAM, Menu = "menu1"This allows you to specify Auth-Type of "PAM" (instead of "System") whichthen by default uses the "radius" entry of the pam.conf for PAMauthentication. An /etc/pam.d/radius file for this to check the /etc/x2usersfile may look like this:---- /etc/pam.d/radius ----# radius stuffauth required /lib/security/pam_unix_auth.soauth required /lib/security/pam_listfile.so \ item=user sense=allow file=/etc/x2users onerr=failaccount required /lib/security/pam_unix_acct.soYou may not want to bother with the last line for accounting since RADIUSdoes a wonderful job of accounting on its own. At least that's what I'massuming it does, but I've never bothered to look into it, so I couldn'ttell you for sure.Now let's say you want multiple PAM entries for different users. Then youcan do something like this in your /etc/raddb/users file:Joe Auth-Type = PAM, Framed-Protocol = PPP Service-Type = Framed-User, Framed-Protocol = PPP, Framed-IP-Address = 255.255.255.254, Framed-MTU = 1500, Framed-Compression = Van-Jacobson-TCP-IP,DEFAULT Auth-Type = PAM, Framed-Protocol = PPP, PAM-Auth="x2" Service-Type = Framed-User, Framed-Protocol = PPP, Framed-IP-Address = 255.255.255.254, Framed-MTU = 1500, Framed-Compression = Van-Jacobson-TCP-IP,DEFAULT Auth-Type = PAM, PAM-Auth="mradius" Menu = "menu1"With something like this in the /etc/pam.d/ directory:---- /etc/pam.d/radius ----auth required /lib/security/pam_unix_auth.soaccount required /lib/security/pam_unix_acct.so---- /etc/pam.d/x2 ----auth required /lib/security/pam_unix_auth.soauth required /lib/security/pam_listfile.so \ item=user sense=allow file=/etc/x2users onerr=failaccount required /lib/security/pam_unix_acct.so---- /etc/pam.d/mradius ----auth required /lib/security/pam_unix_auth.soauth required /lib/security/pam_nologin.soaccount required /lib/security/pam_unix_acct.soThis would allow user Joe to login using /etc/passwd or shadow. All otherPPP users would authenticate via PAP or CHAP by /etc/passwd or shadow, butonly if they're in the /etc/x2users file. Then all non PPP users will getthe menu, but not if /etc/nologin exists. Of course, you could just aseasily have Joe's entry with Auth-Type=System, but then you wouldn't beusing your new toy, see.---------------------------------------------PAM module support for session logging---------------------------------------------Information for module writers only:This PAMified version of radiusd supports the PAM session modules. A modulewriter willing to use this will have to be aware, however, of thenon-standard way of passing the information contained in the acct networkpacket from radiusd to the module. The value of the authreq->request ispassed to the module in the appdata_ptr pointer of the conversationstructure. Thus, a module willing to do session logging for this version of radiusd will have to start from the provided source for the dummypam_radius_session module. Check that out, the source is self explanatory.Of course, radiusd will call pam_open_session each time an acct STARTpackets come in, and will call pam_close_session each time the STOP packetis seen.Having this model you should be able to write your module for logging into aSQL database or whatever you want, and list that module in the sessionsection of the PAM configuration file of the "radius" application (thisradiusd will call only the session modules for the "radius" application,don't get foold by PAM-Auth extension described above):---- /etc/pam.d/radius ----session required /some/path/pam_radius_session.so---- --------------------------------------------------------------------------------Please send your comments to gafton@sorosis.ro
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -