Cisco Nexus へのログイン認証に FreeRadius2 を使用する際の設定例です。
詳細については、末尾の参考リンクをご参照ください。
Radius 側の設定
Samba + Windbind 関連設定
Samba インストール
# yum install -y samba-common samba-client
Authconfig による Winbind 認証設定
# authconfig \ --enablewinbind \ --enablewinbindauth \ --smbsecurity=ads \ --smbworkgroup=EXAMPLE \ --smbrealm=EXAMPLE.COM \ --smbservers=dc.example.com \ --enablewinbindusedefaultdomain \ --winbindtemplatehomedir=/tmp \ --winbindtemplateshell=/bin/bash \ --enablelocauthorize \ --update
hosts へドメイン名及び DC エントリ追加
# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 centos.example.com centos ::1 centos6.example.com6 centos6 192.168.72.99 centos.example.com centos 192.168.72.100 dc.example.com dc
Kerberos 認証確認
# kinit administrator Password for administrator@EXAMPLE.COM:
# klist Ticket cache: FILE:/tmp/krb5cc_0 Default principal: administrator@EXAMPLE.COM Valid starting Expires Service principal 03/29/12 23:23:21 03/30/12 09:23:26 krbtgt/EXAMPLE.COM@EXAMPLE.COM renew until 03/30/12 23:23:21 Kerberos 4 ticket cache: /tmp/tkt0 klist: You have no tickets cached
Active Directory ドメイン参加
# net join -U Administrator Administrator's password: Using short domain name -- EXAMPLE DNS update failed! Joined 'CENTOS' to realm 'EXAMPLE.COM'
ドメイン情報の確認
# net ads info LDAP server: 192.168.72.100 LDAP server name: DC.example.com Realm: EXAMPLE.COM Bind Path: dc=EXAMPLE,dc=COM LDAP port: 389 Server time: Thu, 29 Mar 2012 23:31:08 JST KDC server: 192.168.72.100 Server time offset: 0
Winbind 起動
# /etc/rc.d/init.d/winbind start Starting Winbind services: [ OK ]
ドメイン内のユーザー情報の確認
# wbinfo -u
administrator
guest
krbtgt
testuser
ユーザー ID、所属グループの確認
# id testuser uid=16777217(testuser) gid=16777216(domain users) groups=16777216(domain users)
ドメイン内のユーザー認証の確認
# wbinfo -a testuser%Password1
plaintext password authentication succeeded
challenge/response password authentication succeeded
FreeRadius 関連設定
Samba NTLM 認証確認
# ntlm_auth --request-nt-key --domain=example.com --username=testuser --password=Password1 NT_STATUS_OK: Success (0x0)
FreeRadius2 インストール
# yum install -y freeradius2
NTLM 認証設定
# cat /etc/raddb/modules/ntlm_auth exec ntlm_auth { wait = yes program = "/usr/bin/ntlm_auth --request-nt-key --domain=example.com --username=%{mschap:User-Name} --password=%{User-Password}" }
Radius 認証方式に NTLM を追加
# cat /etc/raddb/sites-available/inner-tunnel 190行目付近に追記 authenticate { ntlm_auth # <...sinp...>
# cat /etc/raddb/sites-available/default 253行目付近に追記 authenticate { ntlm_auth # <...sinp...>
デフォルトの認証手段に NTLM を使用。また、Nexus へ roles attribute を返すように指定。
# cat /etc/raddb/users 最終行に追記 DEFAULT Auth-Type = ntlm_auth Service-Type = NAS-Prompt-User, cisco-avpair = "shell:roles*\"network-admin\"",
Radius クライアント(Nexus)登録
# cat /etc/raddb/clients.conf 最終行に追記 client 192.168.72.20 { secret = Password1 shortname = Nexus }
ログ出力設定
# cat /etc/raddb/radiusd.conf 423行目付近の下記をコメントアウト requests = ${logdir}/radiusd-%{%{Virtual-Server}:-DEFAULT}-%Y%m%d.log 443行目付近の auth を no から yes へ変更。 auth = yes
サービス起動
# /etc/rc.d/init.d/radiusd start Starting RADIUS server: [ OK ]
自動起動設定
# chkconfig radiusd on
# chkconfig --list | grep radius
radiusd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Cisco Nexus 側の設定
Radius サーバーの指定
Nexus(config)# radius-server host 192.168.72.99 Password1 authentication accounting
AAA グループの作成
Nexus(config)# aaa group server radius freeradius2
Nexus(config-radius)# server 192.168.72.99
Nexus(config-radius)# use-vrf management
Nexus(config-radius)# source-interface mgmt 0
Nexus(config-radius)# exit
ログイン認証に上記 AAA グループを指定
Nexus(config)# aaa authentication login default group freeradius2 local Nexus(config)# aaa authentication login console local
アカウントの確認
Nexus# show user-account user:admin this user account has no expiry date roles:network-admin user:testuser roles:network-admin account created through REMOTE authentication Credentials such as ssh server key will be cached temporarily only for this user account Local login not possible
なお、Radius 認証されたユーザーは Read Only*1とする事も可能です。手順は以下のとおりです。
admin role を持つローカルユーザー作成
Nexus(config)# username admin password 5 $1$PpNKbLFP$ytcKF2i.P3.OXF8d/08dP0 role network-admin
ログイン認証に上記 AAA グループを指定し、コンソールログインにはローカルを指定
Nexus(config)# aaa authentication login console local Nexus(config)# aaa authentication login default group Radius none
FreeRadius で roles attribute に"network-operator"を指定
# cat /etc/raddb/users DEFAULT Auth-Type = ntlm_auth Service-Type = NAS-Prompt-User, Cisco-AVPair = "shell:roles*\"network-operator\""
ロールの確認
Nexus# show role Role: network-admin Description: Predefined network admin role has access to all commands on the switch ------------------------------------------------------------------- Rule Perm Type Scope Entity ------------------------------------------------------------------- 1 permit read-write Role: network-operator Description: Predefined network operator role has access to all read commands on the switch ------------------------------------------------------------------- Rule Perm Type Scope Entity ------------------------------------------------------------------- 1 permit read <...snip...>
参考:
AD のアカウントで Linux サーバーにログインする
Cisco Nexus 1000V Security Configuration Guide
以上
*1:コンソールからのみ Read/Write を許可