自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

在Ubuntu 16.04 LTS服務(wù)器上安裝FreeRADIUS和Daloradius的方法

系統(tǒng) Linux
freeradius一般用來進(jìn)行賬戶認(rèn)證管理,記賬管理,常見的電信運(yùn)營(yíng)商的寬帶賬戶,上網(wǎng)賬戶管理,記賬,都是使用的radius服務(wù)器進(jìn)行鑒權(quán)記賬的。

[[404920]]

 FreeRADIUS 為AAA Radius Linux下開源解決方案,DaloRadius為圖形化web管理工具。

freeradius一般用來進(jìn)行賬戶認(rèn)證管理,記賬管理,常見的電信運(yùn)營(yíng)商的寬帶賬戶,上網(wǎng)賬戶管理,記賬,都是使用的radius服務(wù)器進(jìn)行鑒權(quán)記賬的。

常見的radius服務(wù)器種類不多,比較強(qiáng)大的當(dāng)屬開源的freeradius,世界上大部分的radius服務(wù)器都是基于freeradius開發(fā)而來的。

Freeradius包含一個(gè)radius服務(wù)器和radius-client,可以對(duì)支持radius協(xié)議的網(wǎng)絡(luò)設(shè)備進(jìn)行鑒權(quán)記賬,常見的開源路由器操作系統(tǒng):如Openwrt,DD-wrt等,都支持radius協(xié)議,對(duì)PPPOE,熱點(diǎn),虛擬網(wǎng)絡(luò)等服務(wù)器進(jìn)行賬戶管理認(rèn)證,記賬。

freeradius功能十分強(qiáng)大,支持眾多的數(shù)據(jù)庫(kù)。 Freeradius操作稍顯麻煩,內(nèi)置diaup_admin簡(jiǎn)單web管理,需要更簡(jiǎn)單易用的管理功能可以使用第三方的管理程序?qū)reeradius進(jìn)行賬戶管理,系統(tǒng)配置等。

很多剛?cè)腴T的朋友,在搭建環(huán)境的時(shí)候都會(huì)遇到各種問題,本文詳細(xì)介紹在Ubuntu 16.04 LTS服務(wù)器上安裝FreeRADIUS和Daloradius的方法,為初學(xué)者省去很多麻煩。

一、在安裝之前建議將系統(tǒng)升級(jí)到最新版本,運(yùn)行以下命令:

  1. 1 sudo apt‐get update 
  2. 2 sudo apt‐get upgrade 

 升級(jí)后重新啟動(dòng)系統(tǒng):

  1. 1 sudo reboot 

系統(tǒng)啟動(dòng)后,在Ubuntu 16.04系統(tǒng)上開始安裝FreeRADIUS和Daloradius。

二、安裝Apache Web Server和PHP

Daloradius將要求在主機(jī)系統(tǒng)上安裝php和Apache Web服務(wù)器。

1、在Ubuntu上安裝Apache,運(yùn)行以下命令安裝Apache Web服務(wù)器:

  1. 1 sudo apt‐get install apache2 

2、要在Ubuntu 16.04上安裝PHP,請(qǐng)運(yùn)行以下命令:

若要安裝PHP 7.3版本請(qǐng)參考在Ubuntu 18.04或CentOS 7系統(tǒng)上安裝PHP7.3:點(diǎn)擊下面的鏈接進(jìn)入: https://ywnz.com/linuxjc/3782.html

  1. 1 sudo apt‐get install php libapache2‐mod‐php php‐gd php‐common php‐mail \ 
  2. 2 php‐mail‐mime php‐mysql php‐pear php‐db php‐mbstring php‐xml php‐curl 

 3、檢查PHP版本以確保安裝成功

  1. 1 php ‐v 

會(huì)輸出這樣的類似版本信息

  1. 1 PHP 7.0.33‐0ubuntu0.16.04.16 (cli) ( NTS ) 
  2. 2 Copyright (c) 1997‐2017 The PHP Group 
  3. 3 Zend Engine v3.0.0, Copyright (c) 1998‐2017 Zend Technologies 
  4. with Zend OPcache v7.0.33‐0ubuntu0.16.04.16, Copyright (c) 1999‐2017, by Zend Technologies 

 三、安裝MySQL并創(chuàng)建數(shù)據(jù)庫(kù)

1、接下來是安裝mysql服務(wù)器或者M(jìn)ariaDB并為daloRADIUS創(chuàng)建一個(gè)數(shù)據(jù)庫(kù)。

  1. 1 安裝MYSQL命令: 
  2. 2 sudo apt ‐y install mysql‐server 

 若安裝過程中提示你要輸入root的密碼,請(qǐng)按要求輸入密碼,然后"確定"即可。我這里暫設(shè)是:123456

若沒有提示輸入密碼的話請(qǐng)運(yùn)行以下命令:

  1. 1 sudo mysql_secure_installation 
  2. 2 如果您還沒有設(shè)置密碼,您將被要求設(shè)置密碼,然后如果您想刪除匿名用戶,則禁止遠(yuǎn)程root 
  3. 3 登錄,刪除測(cè)試數(shù)據(jù)庫(kù)并重新加載表。除非你有其他的計(jì)劃,并且知道你在做什么,否則我 
  4. 4 建議你一直按Enter鍵。 

 2、安裝并運(yùn)行后,為FreeRADIUS創(chuàng)建一個(gè)數(shù)據(jù)庫(kù),這將在稍后階段使用:

數(shù)據(jù)庫(kù)名稱:radius 數(shù)據(jù)庫(kù)用戶:radius 數(shù)據(jù)庫(kù)用戶密碼:123456

  1. 1 $ mysql ‐u root ‐p //進(jìn)入mysql 
  2. 2 MariaDB [(none)]> CREATE DATABASE radius; //創(chuàng)建一個(gè)數(shù)據(jù)庫(kù)用戶 
  3. 3 Query OK, 1 row affected (0.000 sec) 
  4. 4 // 設(shè)置數(shù)據(jù)庫(kù)用戶密碼 
  5. 5 MariaDB [(none)]> GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "123456"
  6. 6 Query OK, 0 rows affected (0.000 sec) 
  7. 7 MariaDB [(none)]> FLUSH PRIVILEGES; //刷新MySQL的系統(tǒng)權(quán)限相關(guān)表 
  8. 8 Query OK, 0 rows affected (0.001 sec)9 MariaDB [(none)]> EXIT; //退出 
  9. 10 Bye 

 四、安裝和配置FreeRADIUS

1、由于Ubuntu 16.04系統(tǒng),版本2.x是官方存儲(chǔ)庫(kù)中提供的軟件包,要安裝3.0版,請(qǐng)為FreeRADIUS版本3添加PPA:

  1. 1 sudo add‐apt‐repository ppa:freeradius/stable‐3.0 
  2. 2 sudo apt‐get update 

 安裝以下FreeRADIUS軟件包:

  1. 1 sudo apt‐get install freeradius freeradius‐mysql freeradius‐utils 
  2. 2 sudo ufw allow to any port 1812 proto udp 
  3. 3 sudo ufw allow to any port 1813 proto udp 

 并在調(diào)試模式下運(yùn)行它

  1. 1 sudo freeradius ‐X 

輸出應(yīng)該很長(zhǎng),并以這樣的內(nèi)容結(jié)尾

  1. 1 Listening on auth address * port 1812 bound to server default 
  2. 2 Listening on acct address * port 1813 bound to server default 
  3. 3 Listening on auth address :: port 1812 bound to server default 
  4. 4 Listening on acct address :: port 1813 bound to server default 
  5. 5 Listening on auth address 127.0.0.1 port 18120 bound to server inner‐tunnel 
  6. 6 Listening on proxy address * port 42463 
  7. 7 Listening on proxy address :: port 55492 
  8. 8 Ready to process requests 

 按Ctrl+C退出調(diào)試模式。

2、檢查目錄下是否有schema.sql文件

  1. 1 cd /etc/freeradius/mods‐config/sql/main/mysql 
  2. 2 find schema.sql 

 3 若提示沒有找到該文件,可能是安裝出錯(cuò)沒有生成也可能是目錄層次不同,可嘗試下:find ‐name "schema.sql"

若提示在目錄下能找到這個(gè)文件則導(dǎo)入freeradius MySQL數(shù)據(jù)庫(kù)方案:

  1. 1 sudo mysql ‐u root ‐p radius < /etc/freeradius/mods‐config/sql/main/mysql/schema.sql 

3、檢查創(chuàng)建的表:

  1. 1 mysql ‐u root ‐p ‐e "use radius;show tables;" 

會(huì)顯示這樣圖形輸出例子

  1. 1 +‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+ 
  2. 2 | Tables_in_radius | 
  3. 3 +‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+ 
  4. 4 | nas | 
  5. 5 | radacct | 
  6. 6 | radcheck | 
  7. 7 | radgroupcheck | 
  8. 8 | radgroupreply | 
  9. 9 | radpostauth | 
  10. 10 | radreply | 
  11. 11 | radusergroup | 
  12. 12 +‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+ 

 4、創(chuàng)建一個(gè)從SQL模塊到/etc/freeradius/3.0/mods啟用目錄的符號(hào)鏈接:

  1. 1 sudo ln ‐s /etc/freeradius/mods‐available/sql /etc/freeradius/mods‐enabled/ 

5、配置SQL模塊并更改數(shù)據(jù)庫(kù)連接參數(shù)以適合你的環(huán)境:

  1. 1 sudo vim /etc/freeradius/mods‐enabled/sql 

你的sql部分應(yīng)該類似于下面的部分: 如果你有專用數(shù)據(jù)庫(kù)服務(wù)器,請(qǐng)將localhost替換為源FreeRadius服務(wù)器的IP:

  1. 1 sql { 
  2. 2 driver = "rlm_sql_mysql" 
  3. 3 dialect = "mysql" 
  4. 4 # Connection info: 
  5. 5 server = "localhost" 
  6. 6 port = 33067 login = "radius" 
  7. password = "123456" 
  8. 9 # Database table configuration for everything except Oracle 
  9. 10 radius_db = "radius" 
  10. 11 } 
  11. 12 # Set to ‘yes’ to read radius clients from the database (‘nas’ table
  12. 13 # Clients will ONLY be read on server startup. 
  13. 14 read_clients = yes 
  14. 15 
  15. 16 # Table to keep radius client info 
  16. 17 client_table = "nas" 

 6、然后更改/etc/freeradius/mods-enabled/sql的組權(quán)限:

  1. 1 sudo chgrp ‐h freerad /etc/freeradius/mods‐available/sql 
  2. 2 sudo chown ‐R freerad:freerad /etc/freeradius/mods‐enabled/sql 

 重啟freeradius服務(wù):

  1. 1 sudo systemctl restart freeradius.service 

最后,我們將在調(diào)試模式下運(yùn)行FreeRADIUS以確保一切正常工作。

7、首先停止當(dāng)前運(yùn)行的服務(wù)

  1. 1 sudo systemctl stop freeradius.service 

在調(diào)試模式下運(yùn)行FreeRADIUS

  1. 1 sudo freeradius ‐X 

輸出的末尾應(yīng)該是這樣的

  1. 1 Listening on auth address * port 1812 bound to server default 
  2. 2 Listening on acct address * port 1813 bound to server default 
  3. 3 Listening on auth address :: port 1812 bound to server default 
  4. 4 Listening on acct address :: port 1813 bound to server default 
  5. 5 Listening on auth address 127.0.0.1 port 18120 bound to server inner‐tunnel 
  6. 6 Listening on proxy address * port 55873 
  7. 7 Listening on proxy address :: port 46059 
  8. 8 Ready to process requests 

 按Ctrl+C退出調(diào)試模式。

8、重新啟動(dòng)FreeRADIUS服務(wù)。

  1. 1 sudo systemctl start freeradius.service 

五、在Ubuntu 16.04上安裝和配置Daloradius

1、如果沒有安裝wget和unzip,則安裝wget和unzip

  1. 1 sudo apt ‐y install wget unzip 

下載并解壓daloRADIUS和cd到目標(biāo)文件夾中,這個(gè)文件夾是daloRADIUS-master

  1. 1 wget https://github.com/lirantal/daloradius/archive/master.zip 
  2. 2 unzip daloradius‐master.zip 
  3. 3 mv daloradius‐master/ daloradius 
  4. 4 cd daloradius 
  5. 5 若無法下載,可用瀏覽器打開https://github.com/lirantal/daloradius/archive/master.zip下載 

 2、我們將用daloRADIUS模式填充FreeRADIUS使用的數(shù)據(jù)庫(kù)。它是我們?cè)谇懊娴陌咐袆?chuàng)建的數(shù)據(jù)庫(kù)radius。

  1. 1 sudo mysql ‐u root ‐p radius < contrib/db/fr2‐mysql‐daloradius‐and‐freeradius.sql 
  2. 2 sudo mysql ‐u root ‐p radius < contrib/db/mysql‐daloradius.sql 

 從“daloradius”目錄中退出,并將該文件夾移動(dòng)到文檔根目錄中,并將其重命名為“daloradius”

  1. 1 cd .. 
  2. 2 sudo mv daloradius /var/www/html/ 

 3、將daloradius文件夾的所有者和組更改為www-data:www-data,這是運(yùn)行Apache Web Server的所有者和組。

  1. 1 sudo chown ‐R www‐data:www‐data /var/www/html/daloradius/ 

4、接下來,我們需要?jiǎng)?chuàng)建daloRADIUS配置文件。daloRADIUS提供了一個(gè)配置文件模板,名為/var/www/html/daloradius/library/daloradius.conf.php。我們只復(fù)制樣本。

  1. 1 sudo cp /var/www/html/daloradius/library/daloradius.conf.php.sample 

/var/www/html/daloradius/library/daloradius.conf.php將配置文件的權(quán)限更改為664

  1. 1 sudo chmod 664 /var/www/html/daloradius/library/daloradius.conf.php 

5、接下來,我們將編輯daloRADIUS配置文件中的一些值,以便它連接到我們之前為FreeRADIUS創(chuàng)建的數(shù)據(jù)庫(kù)。

  1. 1 sudo vim /var/www/html/daloradius/library/daloradius.conf.php 

我們將更改以下值

  1. 1 $configValues['CONFIG_DB_USER'] = 'root'
  2. 2 $configValues['CONFIG_DB_PASS'] = ''
  3. 3 $configValues['CONFIG_DB_NAME'] = 'radius'

 下面是我如何根據(jù)前面創(chuàng)建的數(shù)據(jù)庫(kù)名、用戶和密碼修改它們的。

  1. 1 $configValues['CONFIG_DB_USER'] = 'radius'
  2. 2 $configValues['CONFIG_DB_PASS'] = '123456'
  3. 3 $configValues['CONFIG_DB_NAME'] = 'radius' 

 6、最后重啟daloRADIUS和Apache

  1. 1 sudo systemctl restart freeradius.service apache2 

六、訪問daloRADIUS

1、要訪問daloRADIUS,請(qǐng)?jiān)跒g覽器中訪問本機(jī)的IP或域名,然后是/daloRADIUS,例如https://your_server_ip/daloradius 除非您配置了SSL,否則請(qǐng)確保它是http://,并且瀏覽器不會(huì)將其更改為https://,,因?yàn)橛袝r(shí)可能會(huì)發(fā)生這種情況。 這就是daloRADIUS的樣子

默認(rèn)的登錄憑據(jù)是: username: administrator password: radius

七、測(cè)試 FreeRADIUS和daloRADIUS

1、NAS (Network Access Server)客戶端表充當(dāng)了到受保護(hù)資源的網(wǎng)關(guān)。

為了讓另一個(gè)設(shè)備連接到我們的FreeRADIUS服務(wù)器,需要將它添加到NAS客戶端表中。 我們通過登錄到daloRADIUS儀表板來添加NAS客戶端表。然后導(dǎo)航到Management > NAS(在藍(lán)色的子菜單中)> New NAS(在左邊,深灰色的邊欄)。 我們需要填寫的最小選項(xiàng)如下所示

  1. 1 NAS IP/Host:你將連接的計(jì)算機(jī)的IP。 
  2. 2 NAS Secret:密鑰。 
  3. 3 NAS Type:你可以在這里任意填寫 
  4. 4 NAS Shortname:方便您使用的短名稱 

 我將填寫以下內(nèi)容

2、創(chuàng)建daloRADIUS用戶

為了測(cè)試我們的服務(wù)器,我們還需要一個(gè)用戶。 通過在頂部菜單導(dǎo)航到Management > Users(在藍(lán)色子菜單中)> New User(在左邊,深灰色的邊欄)。 對(duì)于我們的示例,我將使用以下憑證創(chuàng)建用戶

在創(chuàng)建用戶時(shí),除了Username,Password外,還有其他字段可用,但對(duì)于我們的目的,這些就足夠了。

3、在調(diào)試模式下運(yùn)行FreeRADIUS

接下來,我們將在調(diào)試模式下運(yùn)行FreeRADIUS,這樣我們就可以看到當(dāng)我們向它發(fā)送認(rèn)證請(qǐng)求時(shí)會(huì)發(fā)生什么。 首先停止正在運(yùn)行的進(jìn)程。

  1. 1 sudo systemctl stop freeradius.service 

在調(diào)試模式下運(yùn)行FreeRADIUS

  1. 1 sudo freeradius ‐X 

注意:每次添加新的NAS表時(shí),都需要重新啟動(dòng)FreeRADIUS服務(wù)器,以便它獲取更新后的表。

4、使用NTRadPing測(cè)試FreeRADIUS服務(wù)器

測(cè)試服務(wù)器的一個(gè)方便方法是使用一種叫做NTRadPing的免費(fèi)Windows軟件。

你可以在這里下載https://community.microfocus.com/t5/OES-Tips-Information/NTRadPing-1-5-RADIUS-TestUtility/ta-p/1777768

這是到檔案的直接鏈接 https://community.microfocus.com/dcvta86296/attachments/dcvta86296/OES_Tips/148/1/ntradping.zip

這是VirusTotal的報(bào)告,所以你知道它是安全的 https://www.virustotal.com/gui/file/e1b3318b884e4643a043ec5e3104638016c343c447424c244fc1da4f6e7165ec/detection

只需解壓歸檔文件并運(yùn)行可執(zhí)行文件以運(yùn)行NTRadPing即可。

5、我們將使用NTRadPing向在調(diào)試模式下運(yùn)行FreeRADIUS的服務(wù)器發(fā)送身份驗(yàn)證請(qǐng)求。

我們將按如下方式填寫

  1. 1 RADIUS Server/port:FreeRADIUS服務(wù)器的IP /端口1812 
  2. 2 Reply timeout (sec.):1 
  3. 3 Retries: 1 
  4. 4 RADIUS Secret Key:testing1235 UserName:test_1 
  5. Password:A123456 
  6. 7 選中CHAP復(fù)選框,這樣請(qǐng)求使用CHAP密碼,而不是PAP密碼。 
  7. 8 現(xiàn)在單擊Send按鈕發(fā)送身份驗(yàn)證請(qǐng)求。 
  8. 9 如果您接收到Access‐Accept響應(yīng),那么我們可以假定它可以工作。 

 NTRadPing的輸出應(yīng)該像這樣

在調(diào)試模式下運(yùn)行FreeRADIUS的終端中,輸出應(yīng)該以這樣的內(nèi)容結(jié)束

希望您也已經(jīng)成功地在ubuntu16.0.4上安裝了FreeRADIUS,并安裝和配置了daloRADIUS,然后成功地測(cè)試了FreeRADIUS服 務(wù)器。

八、常見錯(cuò)誤

Failed binding with auth address [ ] when running in debug mode

  1. 1 Failed binding to auth address * port 1812 bound to server default: Address already in use 
  2. 2 /etc/freeradius/3.0/sites‐enabled/default[59]: Error binding to port for 0.0.0.0 port 1812 

 這個(gè)錯(cuò)誤發(fā)生在你試圖運(yùn)行FreeRADIUS,但有另一個(gè)FreeRADIUS實(shí)例已經(jīng)在運(yùn)行,所以你需要運(yùn)行下面的命令來停止它

  1. 1 sudo systemctl stop freeradius.service 

快抓緊來操作吧!

 

 

責(zé)任編輯:姜華 來源: 今日頭條
相關(guān)推薦

2016-09-30 13:48:25

UbuntuPython報(bào)警系統(tǒng)

2018-10-12 10:10:58

Ubuntu服務(wù)器Oracle Virt

2017-08-03 10:36:08

UbuntuCertbotNGINX

2017-08-09 13:13:25

LinuxUbuntuZabbix

2012-06-12 10:56:29

KVM虛擬化

2011-09-06 16:27:59

CoLinuxUbuntulinux

2018-10-16 16:20:41

UbuntuKVM服務(wù)器

2011-01-21 17:43:13

2018-07-24 09:55:43

LinuxUbuntuMicrosoft

2009-02-01 09:15:02

UbuntuTwitterMicroblog

2018-02-23 14:50:30

2018-04-03 13:31:53

LinuxUbuntu 16.0msmtp

2015-01-27 10:16:27

Ubuntu Jetty 9

2018-02-25 11:03:00

LinuxUbuntuEncryptpad

2011-09-07 13:33:51

ubuntuUbuntu Twea

2021-09-24 08:55:34

LinuxUbuntu 14.016.04 LTS

2013-07-29 13:49:23

UbuntuLAMP服務(wù)器

2015-08-03 15:38:06

2017-10-27 16:09:26

UbuntuGraylog日志服務(wù)器

2009-07-28 19:18:44

物理服務(wù)器VMware ESXi服務(wù)器虛擬化
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)