Centos安裝Freeradius+daloRADIUS配合ROS PPPOE驗證
LAMP環境安裝:
yum -y install httpd httpd-devel mysql mysql-server mysql-develyum -y install php php-devel php-mysql php-common php-gd php-mbstring php-mcrypt php-xml/etc/init.d/httpd start/etc/init.d/mysqld startchkconfig httpd onchkconfig mysqld onmysqladmin -u root password 'newpassowrd'
Freeradius安裝:
yum install freeradius2 freeradius2-mysql freeradius2-utils/etc/init.d/radiusd startchkconfig radiusd on
測試Freeradius:
radiusd -XListening on authentication address * port 1812Listening on accounting address * port 1813Listening on command file /var/run/radiusd/radiusd.sockListening on authentication address 127.0.0.1 port 18120 as server inner-tunnelListening on proxy address * port 1814Ready to process requests.
配置Freeradius支援sql:
cat /etc/raddb/radiusd.conf $INCLUDE sql.conf #調用sql.conf配置,去除之前的#cat /etc/raddb/sites-enabled/default #下兩段中添加sqlauthorize {preprocesschapmschapdigestsuffixeap {ok = return}filessqlexpirationlogintimepap}accounting {detailunixradutmpsqlexecattr_filter.accounting_response}
設定Freeradius sql串連資訊:
cat /etc/raddb/sql.conf database = "mysql"driver = "rlm_sql_${database}"server = "localhost"#port = 3306login = "radius"password = "radiupass"radius_db = "radius"
安裝DaloRADIUS:
wget http://downloads.sourceforge.net/project/daloradius/daloradius/daloradius0.9-9/daloradius-0.9-9.tar.gztar zxvf daloradius-0.9-9.tar.gz mv daloradius-0.9-9 /var/www/html/daloradiuschown -R apache:apache /var/www/html/daloradius
建立資料庫並匯入:
mysql -u root -pmysql>create database radius;mysql>grant all on radius.* to radius@localhost identified by "radpass"; mysql>exit;mysql -uroot -p radius < /var/www/html/daloradius/contrib/db/mysql-daloradius.sql mysql -uroot -p radius < /var/www/html/daloradius/contrib/db/fr2-mysql-daloradius-and-freeradius.sql
配置DaloRADIUS:
cat cat /var/www/html/daloradius/library/daloradius.conf.php$configValues['CONFIG_DB_ENGINE'] = 'mysql';$configValues['CONFIG_DB_HOST'] = 'localhost';$configValues['CONFIG_DB_PORT'] = '3306';$configValues['CONFIG_DB_USER'] = 'radius';$configValues['CONFIG_DB_PASS'] = 'radpass';$configValues['CONFIG_DB_NAME'] = 'radius';$configValues['CONFIG_PATH_DALO_VARIABLE_DATA'] = '/var/www/daloradius/var'; #如在別目錄需修改
添加RADIUS用戶端:
cat /etc/raddb/clients.confclient 192.168.1.21 {secret = rootshortname = ROS}
通過瀏覽器訪問http://www.haiyun.me/daloradius即可登入管理,預設帳號:administrator,密碼:radius。
Daloradius建立使用者測試,ROS端配置RADIUS請參考:安裝Radiusmanager做為ROS驗證伺服器。
通過Daloradius管理介面可查看線上使用者: