1.两台虚拟机 2第一台服务器上,安装freeRadius+mysql/mariadb并完成初始配置,完成命令行方式登录测试3.编写代码(任意语言)在mysql数据库中对用户信息进行增、删、改查 4.第二台服务器上,安装mariadb/mysql apache/nginx.php7X、参照官网说明安装ilias 7.35. 配置ilias采用radius方式认证,第一台服务器为认证服务器
安装freeradius
systemctl stop firewalld
setenforce 0
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
systemctl start httpd
systemctl enable httpd
yum install -y mariadb-server mariadb
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
mysql_secure_installation
设置密码 一直 yyy
mysql -u root -p
进入数据库
创建数据库
CREATE DATABASE radius;
GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "自己的数据库密码";
FLUSH PRIVILEGES;
exit;
安装php
yum install -y https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php70w-devel php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-pdo.x86_64 php70w-mysqlnd php70w-fpm php70w-opcache php70w-pecl-redis php70w-pecl-mongodb
php -v 查看版本
echo "" > /var/www/html/phpinfo.php
systemctl restart httpd
yum -y install freeradius freeradius-utils freeradius-mysql
systemctl start radiusd.service
systemctl enable radiusd.service
mysql -u root -p radius < /etc/raddb/mods-config/sql/main/mysql/schema.sql
输入数据库密码
ln -s /etc/raddb/mods-available/sql /etc/raddb/mods-enabled/
vi /etc/raddb/mods-available/sql
如图修改
改完之后保存退出
chgrp -h radiusd /etc/raddb/mods-enabled/sql
systemctl enable radiusd.service
vi /etc/systemd/system/multi-user.target.wants/radiusd.service
添加一句话
After=mariadb.service
vi /etc/raddb/clients.conf
添加一句话
client all_client {
ipaddr = 0.0.0.0/0
secret = testing123
require_message_authenticator = no
}
cd /var/www/html/
yum -y install wget unzip zip
yum update wget
wget https://github.com/lirantal/daloradius/archive/master.zip
unzip master.zip
mv daloradius-master/ daloradius
wget http://liquidtelecom.dl.sourceforge.net/project/daloradius/daloradius/daloradius0.9-9/daloradius-0.9-9.tar.gz
tar -zxvf daloradius-0.9-9.tar.gz
mv daloradius-0.9-9/ daloradius
cd daloradius
mysql -u root -p radius < contrib/db/fr2-mysql-daloradius-and-freeradius.sql
输密码
mysql -u root -p radius < contrib/db/mysql-daloradius.sql
输密码
chown -R apache:apache /var/www/html/daloradius/
mv /var/www/html/daloradius/library/daloradius.conf.php.sample /var/www/html/daloradius/library/daloradius.conf.php
chmod 664 /var/www/html/daloradius/library/daloradius.conf.php
vi /var/www/html/daloradius/library/daloradius.conf.php
systemctl restart radiusd.service
(就是会警告 不用管)
systemctl daemon-reload
systemctl restart mariadb.service
systemctl restart radiusd.service
systemctl restart httpd
pear install DB
访问地址 http://虚拟机ip/daloradius/login.php
默认用户名: administrator 密码: radius
登陆进去点击mangerent 下的new user 创建一个新用户。回到list user 勾选 刚创建的用户,
点击enable启用。此时在数据库中就有了刚创建的用户。
测试
Radtest username userpassword 主机名称 端口 测试公钥 (testing123)。
返回 accept 则 成功。
完成freeradius的相关内容的配置。
ilias安装
systemctl stop firewalld
setenforce 0
下载插件
yum -y install lrzsz
yum -y install tar
yum -y install vim
yum -y install setup
下载apache
yum -y install httpd
yum install httpd-devel
启动apache
systemctl start httpd
下载mariadb
yum -y install mariadb mariadb-server
设置密码 YYY
mysql_secure_installation
启动mariadb
systemctl start mariadb
下载php环境
添加yum源 epel源
yum install -y \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
添加yum源 webtatic源
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
下载php7.4
yum -y install php74-devel php74.x86_64 php74-cli.x86_64 php74-common.x86_64 php74-gd.x86_64 php74-ldap.x86_64 php74-mbstring.x86_64 php74-mcrypt.x86_64 php74-pdo.x86_64 php74-mysqlnd php74-fpm php74-opcache php74-pecl-redis php74-pecl-mongodb
yum install php-dom
yum install php-gd
下载ilias(已下载,使用rz命令上传)
(在ilias官网下载 , 下载速度有些慢。提前下载。)
切换路径
cd /var/www/html
rz 上传那个压缩包(
rz上传时一定要点击打开 不能双击文件 双击文件会报错,上传一个乱码的文件。
)
解压ilias
tar zxvf ILIAS-7.3.tar.gz
(.gz文件的解压)
创建一个json文件(文件名自定,但是要以.json结尾)
touch jxf.json
vim jxf.json
内容如下
{
"common" : {
"client_id" : "myilias"
},
"database" : {
"user" : "数据库用户名称",
"password" : "数据库密码"
},
"filesystem" : {
"data_dir" : "/var/www/html"
},
"http" : {
"path" : "www.jxf.com"
},
"language" : {
"default_language" : "zh",
"install_languages" : ["zh"]
},
"logging" : {
"enable" : true,
"path_to_logfile" : "/var/www/logs/ilias.log",
"errorlog_dir" : "/var/www/logs/"
},
"systemfolder" : {
"contact" : {
"firstname" : "Richard",
"lastname" : "Klees",
"email" : "richard.klees@concepts-and-training.de"
}
},
"utilities" : {
"path_to_convert" : "/usr/bin/convert",
"path_to_zip" : "/usr/bin/zip",
"path_to_unzip" : "/usr/bin/unzip"
}
}
切换路径
cd /var/www/html/ILIAS-7.3
安装ilias
php setup/setup.php install /var/www/html/jxf.json
此时检测安装环境,如无错误,输入三次y后出现绿色框成功
cd /var/www/html
chmod -R 777 myilias/
cd /var/www
mkdir logs
chmod -R 777 logs/
浏览器访问http://ip/login.php
初始用户 root 密码homer
访问的的时候如果显示的是代码(不显示php界面 而是将里面的代码显示出来)
执行括号里的内容(
sudo yum install epel-release
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
yum repolist all |grep php
sudo yum-config-manager --enable remi-php74
sudo yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis
php -v
重启 systemctl restart httpd
重新访问页面
)
登陆成功 让你修该口令 就是密码 自己改,改完之后如图
登陆 ilias
保存
退出用户
出现1362错误
解决1362错误
wget https://pecl.php.net/get/radius-1.4.0b1.tgz
tar xzf radius-1.4.0b1.tgz && cd radius-1.4.0b1
phpize && ./configure && make && make install
echo -e "[radius]\nextension = radius.so" >> /etc/php.ini
php -i | grep radius
下载thinkphp
通过thinkphp来完成freeradius服务的增删改操作
将thinkphp上传解压到 var/www/html目录下 。
在httpd服务配置文件把httpd.conf改成var/www/html/thinkphp/public目录.
编写相关界面
增加操作
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="http://192.168.60.129" method="get">
<p>username: <input type="text" name="username" /></p>
<p>password: <input type="text" name="password" /></p>
<p>attribute<input type="text" name="attribute" /></p>
<input type="hidden" name="type" id="" value="3">
<input type="submit" value="Submit" />
</form>
</body>
</html>
编辑操作
<DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
</script>
<title>edit</title>
</head>
<body>
<form action=http://192.168.60.129(自己的配置freeradius的ip地址) method="get">
<p>id: <input type="text" name="id" id="id" /></p>
<p>username: <input type="text" name="username" id="username" /></p>
<p>password: <input type="text" name="password" id="password" /></p>
<p>attribute<input type="text" name="attribute" id="attribute" /></p>
<input type="hidden" name="type" id="" value="4">
<input type="submit" value="Submit" />
<script>
$("#id").attr("value",localStorage.getItem('id'));
$("#username").attr("value",localStorage.getItem('username'));
$("#password").attr("value",localStorage.getItem('password'));
$("#attribute").attr("value",localStorage.getItem('attribute'));
console.log(localStorage.getItem('username'));
</script>
</form>
</body>
</html>
接口操作(1为显示所有用户,2为删除用户,3为新增用户)
<?php
namespace app\index\controller;
use think\Db;
use think\Controller;
class Index extends Controller
{
public function index()
{
$params = $this->request->param();
$type = $params['type'];
if($type == "1") {
// $data = [];
$data = Db::table('radcheck')->select();
return json($data);
}else if($type == "2") {
$id = $this->request->param("id");
Db::table('radcheck')->where('id',$id)->delete();
return json("success");
}else if($type == "3") {
$username = $this->request->param("username");
$value = $this->request->param("password");
$attribute = $this->request->param("attribute");
Db::table('radcheck')->insert(['username'=>$username,'value'=>$value,'attribute'=>$attribute]);
return json("success");
}else {
$id = $this->request->param("id");
$username = $this->request->param("username");
$value = $this->request->param("password");
$attribute = $this->request->param("attribute");
Db::table('radcheck')->update(['username' => $username,'value' => $value, 'id'=>$id,'attribute'=>$attribute]);
return json("success");
}
}
}
Ilias配置比较难 ,多看 ilias.de官网,使用翻译软件翻译。安装相关依赖。