
今天,我想分享如何配置两因素身份验证服务器以保护公司网络,站点,服务,ssh。 该服务器将捆绑使用:LinOTP + FreeRadius。
我们为什么需要它?
这是一个完全免费,方便的解决方案,它在其网络内独立于第三方提供商。
与其他开源产品不同,此服务非常方便,非常直观,并且还支持大量功能和策略(例如,登录名+密码+(PIN + OTPToken))。 通过API,它与短信发送服务(LinOTP Config-> Provider Config-> SMS Provider)集成在一起,为诸如Google Autentificator之类的移动应用程序生成代码。 我认为它比
本文中考虑的服务更方便。
该服务器可以与Cisco ASA,OpenVPN服务器,Apache2以及几乎所有支持通过RADIUS服务器进行身份验证的东西(例如,数据中心中的SSH)配合使用。
这是必需的:
1)Debian 8(jessie)-
必需! (在文章末尾介绍了在debian 9上的试用安装)
开始:
安装Debian 8。
添加LinOTP存储库:
添加密钥:
有时使用“全新”安装,在执行此命令后,Debian会发出以下信息:
gpg: `/root/.gnupg' gpg: `/root/.gnupg/gpg.conf' gpg: : `/root/.gnupg/gpg.conf' gpg: `/root/.gnupg/secring.gpg' gpg: `/root/.gnupg/pubring.gpg' gpg: ( --keyserver) gpg: : URI
这是gnupg的初始设置。 不用担心。 只需再次运行命令。
Debiana询问:
gpg: "913DFF12F86258E5" hkp keys.gnupg.net (1) LSE LinOTP2 Packaging <linotp2@lsexperts.de> 2048 bit RSA key F86258E5, : 2010-05-10 Keys 1-1 of 1 for "913DFF12F86258E5". , N) Q) >
答:1
下一个:
安装mysql。 从理论上讲,您可以使用其他sql服务器,但为简单起见,我将按照LinOTP的建议使用它。
(有关其他信息,包括有关重新配置LinOTP数据库的信息,可以在
链接的官方文档中找到。在同一位置,您可以找到以下命令:dpkg-reconfigure linotp以更改设置(如果您已经安装了mysql))。
(再次检查更新不会有伤害)
安装LinOTP和附加模块:
我们回答安装程序的问题:
使用Apache2:是
为管理员Linotp创建密码:“ YourPassword”
生成自签名证书?:是
使用MySQL吗?:是
数据库在哪里:localhost
在服务器上创建LinOTP数据库(数据库名称):LinOTP2
为数据库创建一个单独的用户:LinOTP2
我们为用户设置密码:“ YourPassword”
我现在应该建立一个基地吗? (类似于“您确定要...吗?”):是
输入在安装过程中创建的MySQL根密码:“ YourPassword”
做完了
(可选,无法设置)
(可选,无法设置)
因此,我们的Linotp Web界面现在可以在以下位置找到:
"<b>https</b>: //IP_/manage"
稍后,我将在网络界面中讨论设置。
现在,最重要的是! 提升FreeRadius并将其链接到Linotp。
安装FreeRadius和LinOTP模块
备份客户端和“用户”半径配置。
创建一个空的客户端文件:
我们编辑新的配置文件(可以以备份配置为例)
client 192.168.188.0/24 { secret = passwd # }
接下来,创建用户文件:
我们编辑文件,告诉半径我们将使用perl进行身份验证。
DEFAULT Auth-type := perl
接下来,编辑文件/ etc / freeradius / modules / perl
我们需要在模块参数中写入perl linotp脚本的路径:
Perl { ....... ......... <source lang="bash">module = /usr/lib/linotp/radius_linotp.pm
.....
接下来,我们创建一个文件,在其中说明从哪个(域,数据库或文件)获取数据。
URL=https://IP__LinOTP_(192.168.XX)/validate/simplecheck REALM=webusers1c RESCONF=LocalUser Debug=True SSL_CHECK=False
我在这里要多讲一点,因为这很重要:
带有注释的文件的完整说明:
linotp服务器的IP(我们的LinOTP服务器的IP地址)
网址= https://172.17.14.103/validate/simplecheck
#我们将在LinOTP Web界面中创建的区域。)
领域=重装1
#在LinOTP Webmord中创建的juzverej组的名称。
RESCONF =平面文件
#optional:如果一切似乎都正常,请注释掉
调试=真
#optional:如果您具有自签名证书,请使用此选项,否则请注释掉(如果我们创建证书并想对其进行验证,则使用SSL)
SSL_CHECK =假
接下来,创建文件/ etc / freeradius / sites-available / linotp
并将配置复制到其中(不要编辑任何内容):
authorize { #normalizes maleformed client request before handed on to other modules (see '/etc/freeradius/modules/preprocess') preprocess # If you are using multiple kinds of realms, you probably # want to set "ignore_null = yes" for all of them. # Otherwise, when the first style of realm doesn't match, # the other styles won't be checked. #allows a list of realm (see '/etc/freeradius/modules/realm') IPASS #understands something like USER@REALM and can tell the components apart (see '/etc/freeradius/modules/realm') suffix #understands USER\REALM and can tell the components apart (see '/etc/freeradius/modules/realm') ntdomain # Read the 'users' file to learn about special configuration which should be applied for # certain users (see '/etc/freeradius/modules/files') files # allows to let authentification to expire (see '/etc/freeradius/modules/expiration') expiration # allows to define valid service-times (see '/etc/freeradius/modules/logintime') logintime # We got no radius_shortname_map! pap } #here the linotp perl module is called for further processing authenticate { perl }
接下来,建立一个sim链接:
就个人而言,我会杀死默认的半径站点,但是如果需要它们,则可以编辑其配置或禁用它们。
现在回到网络上,并进行更详细的考虑:
在右上角,单击LinOTP Config-> UserIdResolvers-> New
选择我们想要的:LDAP(AD win,LDAP samba)或SQL,或本地Flatfile用户。
填写必填字段。
接下来,创建REALMS:
在右上角,单击LinOTP Config-> Realms-> New。
并为我们的REALMS命名,并单击之前创建的UserIdResolvers。
如我上面所述,freeRadius在/etc/linotp2/rlm_perl.ini文件中需要所有这些数据,因此,如果您尚未进行编辑,请立即进行操作。
已配置所有服务器。
加法:
在Debian 9上设置LinOTP (感谢
prikhodkov )
#将LinOTP信息库添加到/etc/apt/sources.list.d/linotp.list并更新萝卜:
回声“ deb
linotp.org/apt/debian Stretch linotp”> /etc/apt/sources.list.d/linotp.list
apt-get更新
apt-get install dirmngr
apt-key adv --recv-keys 913DFF12F86258E5
#基本安装和配置mysql服务器:
apt-get安装mysql-server
#安装linotp和freeradius软件包
apt-get install linotp linotp-adminclient-cli python-ldap freeradius python-passlib python-bcrypt git libio-all-lwp-perl libconfig-file-perl libtry-tiny-perl
#创建符号链接到freeradius配置文件
ln -s /etc/freeradius/3.0/sites-available / etc / freeradius / sites-available
ln -s /etc/freeradius/3.0/sites-enabled / etc / freeradius / sites-enabled
ln -s /etc/freeradius/3.0/clients.conf /etc/freeradius/clients.conf
ln -s /etc/freeradius/3.0/users / etc / freeradius / users
#安装linotp-auth-freeradius-perl模块
git clone
github.com/LinOTP/linotp-auth-freeradius-perlcd linotp-auth-freeradius-perl /
cp radius_linotp.pm /usr/share/linotp/radius_linotp.pm
#我们将linotp的freeradius配置文件导入此表单
猫/ etc / freeradius /支持站点/ linotp
服务器linotp {
听{
ipaddr = *
端口= 1812
类型=身份验证
}
听{
ipaddr = *
端口= 1813
类型= acct
}
授权{
预处理
更新{
&控制:身份验证类型:= Perl
}
}
验证{
身份验证类型的Perl {
佩尔
}
}
会计{
Unix
}
}
#在启用了freeradius的网站中,我们仅保留linotp
ls / etc / freeradius /启用了站点
林诺普
#添加允许我们在freeradius上进行连接的主机
猫/etc/freeradius/clients.conf
客户端host1 {
ipaddr = IP_1
网络掩码= 32
秘密='SECRET_1'
}
客户端host2 {
ipaddr = IP_2
网络掩码= 32
秘密='SECRET_2'
}
#作为用户群,我们使用perl连接器
猫/ etc / freeradius /用户
默认身份验证类型:= perl
}
猫/etc/freeradius/3.0/mods-available/perl
perl {
文件名= /usr/share/linotp/radius_linotp.pm
func_authenticate =验证
func_authorize =授权
}
#在启用了mods的目录中,从mods-available目录中为perl模块建立符号链接,并删除eap
ln -s /etc/freeradius/3.0/mods-available/perl /etc/freeradius/3.0/mods-enabled/perl
rm /etc/freeradius/3.0/mods-enabled/eap
#创建auditkey以运行linotp
linotp创建审核密钥-f linotp.ini
#我们创建连接器的配置以检查DD到达半径
猫/etc/linotp2/rlm_perl.ini
URL = https:// IP_LINOTP_SRV /验证/ simplecheck
领域=领域
RESCONF = LocalUser
调试=真
SSL_CHECK =假
我将在下面设置系统的几个链接中保留这些链接,而这些链接通常需要通过两因素身份验证来保护:
在
Apache2中配置两因素身份验证
使用Cisco ASA进行设置(在那里使用了另一个令牌生成服务器,但是ASA本身的设置是相同的)。
具有双重身份验证的VPN在ssh中设置
两因素身份验证(在那里也使用LinOTP)-感谢作者。 您还可以在此处找到有关配置LiOTP策略的有趣信息。
此外,许多站点的cms支持两因素身份验证(对于Wordpress,LinOTP甚至在
github上都有其自己的特殊模块),例如,如果要在公司网站上为公司员工创建安全部分。
重要事实! 请勿选中“ Google autenteficator”框以使用Google Authenticator! 然后无法读取QR码...(奇怪的事实)
在撰写本文时,使用了以下文章中的信息:
itnan.ru/post.php?c=1&p=270571www.digitalbears.net/?p=469感谢作者。