{"id":309499,"date":"2020-09-05T03:00:16","date_gmt":"2020-09-05T03:00:16","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=309499"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=309499","title":{"rendered":"Freeradius + Google Autheticator + LDAP + Fortigate"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/516362\/\">\u041a\u0430\u043a \u0431\u044b\u0442\u044c, \u0435\u0441\u043b\u0438 \u0434\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0438 \u043a\u043e\u043b\u0435\u0442\u0441\u044f, \u0430 \u0434\u0435\u043d\u0435\u0433 \u043d\u0430 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0435 \u0442\u043e\u043a\u0435\u043d\u044b \u043d\u0435\u0442 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0438 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f.<br \/>  \u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u043c-\u0442\u043e \u0441\u0443\u043f\u0435\u0440\u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c, \u0441\u043a\u043e\u0440\u0435\u0435 \u2014 \u043c\u0438\u043a\u0441 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0418\u0442\u0430\u043a, \u0434\u0430\u043d\u043e:<\/h4>\n<p>  \u0414\u043e\u043c\u0435\u043d <i>Active Directory<\/i>.<br \/>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0434\u043e\u043c\u0435\u043d\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 VPN, \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u0438\u0435 \u043d\u044b\u043d\u0447\u0435.<br \/>  \u0412 \u0440\u043e\u043b\u0438 \u0448\u043b\u044e\u0437\u0430 VPN \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 <i>Fortigate<\/i>.<br \/>  \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f VPN-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438.<br \/>  \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 <i>Fortinet <\/i>\u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043c\u0435\u043d\u0435\u0435 \u0447\u0435\u043c \u0436\u043b\u043e\u0431\u0441\u043a\u043e\u0439 \u043d\u0435 \u043d\u0430\u0437\u043e\u0432\u0435\u0448\u044c \u2014 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0430\u0436 10 \u0435\u0434\u0438\u043d\u0438\u0446, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u2014 \u043f\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043a\u043e\u0448\u0435\u0440\u043d\u043e\u0439 \u0446\u0435\u043d\u0435. RSASecureID, Duo \u0438 \u0438\u043c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u0430.<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/b> \u0445\u043e\u0441\u0442 <b>*nix<\/b> \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c <i>freeradius<\/i>, <i>sssd <\/i> \u2014 \u0432\u0432\u0435\u0434\u0435\u043d \u0432 \u0434\u043e\u043c\u0435\u043d, \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043d\u0430 \u043d\u0435\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f. <br \/>  <b>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/b> <i>shellinabox<\/i>, <i>figlet<\/i>, <i>freeeradius-ldap<\/i>, \u0448\u0440\u0438\u0444\u0442 <i>rebel.tlf<\/i> \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f <a href=\"https:\/\/github.com\/xero\/figlet-fonts\" rel=\"nofollow\">https:\/\/github.com\/xero\/figlet-fonts<\/a>.<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 CentOS 7.8.<br \/>  \u041b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f: \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a VPN \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0439 \u043b\u043e\u0433\u0438\u043d \u0438 OTP \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0430\u0440\u043e\u043b\u044f.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/h4>\n<p>  \u0412 <i>\/etc\/raddb\/radiusd.conf<\/i> \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438 \u0433\u0440\u0443\u043f\u043f\u0430, \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 <i>freeradius<\/i>, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441 <i>radiusd <\/i>\u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432\u043e \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445 <i>\/home\/<\/i>.<\/p>\n<pre><code class=\"bash\">user = root group = root <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 <i>Fortigate<\/i>, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c <b>Vendor Specific Attribute<\/b>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <i>raddb\/policy.d<\/i> \u0441\u043e\u0437\u0434\u0430\u044e \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre><code class=\"bash\">group_authorization {     if (&amp;LDAP-Group[*] == &quot;CN=vpn_admins,OU=vpn-groups,DC=domain,DC=local&quot;) {             update reply {                 &amp;Fortinet-Group-Name = &quot;vpn_admins&quot; }             update control {                 &amp;Auth-Type := PAM                 &amp;Reply-Message := &quot;Welcome Admin&quot;                 }         }     else {         update reply {         &amp;Reply-Message := &quot;Not authorized for vpn&quot;             }         reject         } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 <i>freeradius-ldap<\/i> \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <i>raddb\/mods-available<\/i> \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b <i>ldap<\/i>.<br \/>  \u041d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <i>raddb\/mods-enabled<\/i>.<\/p>\n<pre><code class=\"bash\">ln -s \/etc\/raddb\/mods-available\/ldap \/etc\/raddb\/mods-enabled\/ldap<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n<pre><code class=\"bash\">ldap {         server = 'domain.local'         identity = 'CN=freerad_user,OU=users,DC=domain,DC=local'         password = &quot;SupeSecretP@ssword&quot;         base_dn = 'dc=domain,dc=local'         sasl {         }         user {                 base_dn = &quot;${..base_dn}&quot;                 filter = &quot;(sAMAccountname=%{%{Stripped-User-Name}:-%{User-Name}})&quot;                 sasl {                 }                 scope = 'sub'         }         group {                 base_dn = &quot;${..base_dn}&quot;                 filter = '(objectClass=Group)'                 scope = 'sub'                 name_attribute = cn                 membership_filter = &quot;(|(member=%{control:Ldap-UserDn})(memberUid=%{%{Stripped-User-Name}:-%{User-Name}}))&quot;                 membership_attribute = 'memberOf'         } }<\/code><\/pre>\n<p>  \u0412 \u0444\u0430\u0439\u043b\u0430\u0445 <i>raddb\/sites-enabled\/default<\/i> \u0438 <i>raddb\/sites-enabled\/inner-tunnel<\/i> \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 <b>authorize<\/b> \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0438\u043c\u044f \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u2014 group_authorization. \u0412\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u0438\u043c\u044f \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0430\u0439\u043b\u0430 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <b>policy.d<\/b>, \u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0430\u0439\u043b\u0430 \u043f\u0435\u0440\u0435\u0434 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438. <br \/>  \u0412 \u0441\u0435\u043a\u0446\u0438\u0438 <b>authenticate<\/b> \u0432 \u044d\u0442\u0438\u0445 \u0436\u0435 \u0444\u0430\u0439\u043b\u0430\u0445 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 <b>pam<\/b>.<br \/>  \u0412 \u0444\u0430\u0439\u043b\u0435 <b>clients.conf<\/b> \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f <i>Fortigate<\/i>:<\/p>\n<pre><code class=\"bash\">client fortigate {     ipaddr = 192.168.1.200     secret = testing123     require_message_authenticator = no     nas_type = other } <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f <b>pam.d\/radiusd<\/b>:<\/p>\n<pre><code class=\"bash\">#%PAM-1.0 auth       sufficient   pam_google_authenticator.so auth       include      password-auth account    required     pam_nologin.so account    include      password-auth password   include      password-auth session    include      password-auth <\/code><\/pre>\n<p>  \u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u043a\u0438 <i>freeradius <\/i>\u0441 <i>google authenticator<\/i> \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u0432\u0432\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435: <i>username\/password<\/i>+<i>OTP<\/i>. <\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u043a\u043b\u044f\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0441\u044b\u043f\u0435\u0442\u0441\u044f \u043d\u0430 \u0433\u043e\u043b\u043e\u0432\u0443, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u043a\u0438 <i>freeradius <\/i>\u0441 <i>Google Authenticator<\/i>, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u044f <i>pam <\/i>\u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0448\u044c \u0442\u043e\u043a\u0435\u043d <i>Google Authenticator<\/i>.<br \/>  \u041f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>Freeradius \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0434\u043e\u043c\u0435\u043d\u0435 \u0438 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 OTP \u0442\u043e\u043a\u0435\u043d\u0430. <\/li>\n<\/ul>\n<p>  \u0412\u0441\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u0430\u0447\u043d\u043e \u0434\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043f\u043e\u043a\u0430 \u044f \u043d\u0435 \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u00ab\u0410 \u043a\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e OTP \u0434\u043b\u044f 300+ \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439?\u00bb<br \/>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 <i>freeradius <\/i>\u0438 \u0438\u0437-\u043f\u043e\u0434 \u0441\u0432\u043e\u0435\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <i>Google authenticator<\/i>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f QR-\u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 <b>shellinabox<\/b> \u0432 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0441 <b>.bash_profile<\/b>.<\/p>\n<pre><code class=\"bash\">[root@freeradius ~]# yum install -y shellinabox <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u0435\u043c\u043e\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <b>\/etc\/sysconfig\/shellinabox<\/b>.<br \/>  \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u0442\u0430\u043c \u043f\u043e\u0440\u0442 443 \u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.<\/p>\n<pre><code class=\"bash\">[root@freeradius ~]#systemctl enable --now shellinaboxd<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0437\u0430\u0439\u0442\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u0440\u0435\u0434\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c QR-\u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:  <\/p>\n<ul>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043b\u043e\u0433\u0438\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443 \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.<\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0439 \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0439, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u043a \u0433\u0440\u0443\u043f\u043f\u0435 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0430\u0434\u043c\u0438\u043d, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043b\u0438 Google Autheticator. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f QR-\u043a\u043e\u0434 \u0438 logout \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0430\u0434\u043c\u0438\u043d \u0438 Google Authenticator \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e logout.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0430\u0434\u043c\u0438\u043d, \u0442\u043e \u043e\u043f\u044f\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 Google Authenticator. \u0415\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d, \u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f QR-\u043a\u043e\u0434.<\/li>\n<\/ul>\n<p>  \u0412\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <i>\/etc\/skel\/.bash_profile<\/i>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">cat \/etc\/skel\/.bash_profile<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\"># .bash_profile  # Get the aliases and functions if [ -f ~\/.bashrc ]; then         . ~\/.bashrc fi  # User specific environment and startup programs # Make several commands available from user shell  if [[ -z $(id $USER | grep &quot;admins&quot;) || -z $(cat \/etc\/passwd | grep $USER) ]]   then     [[ ! -d $HOME\/bin ]] &amp;&amp; mkdir $HOME\/bin     [[ ! -f $HOME\/bin\/id ]] &amp;&amp; ln -s \/usr\/bin\/id $HOME\/bin\/id     [[ ! -f $HOME\/bin\/google-auth ]] &amp;&amp; ln -s \/usr\/bin\/google-authenticator $HOME\/bin\/google-auth     [[ ! -f $HOME\/bin\/grep ]] &amp;&amp; ln -s \/usr\/bin\/grep $HOME\/bin\/grep     [[ ! -f $HOME\/bin\/figlet ]] &amp;&amp; ln -s \/usr\/bin\/figlet $HOME\/bin\/figlet     [[ ! -f $HOME\/bin\/rebel.tlf ]] &amp;&amp; ln -s \/usr\/share\/figlet\/rebel.tlf $HOME\/bin\/rebel.tlf     [[ ! -f $HOME\/bin\/sleep ]] &amp;&amp; ln -s \/usr\/bin\/sleep $HOME\/bin\/sleep   # Set PATH env to &lt;home user directory&gt;\/bin     PATH=$HOME\/bin     export PATH   else     PATH=PATH=$PATH:$HOME\/.local\/bin:$HOME\/bin     export PATH fi   if [[ -n $(id $USER | grep &quot;domain users&quot;) ]]   then     if [[ ! -e $HOME\/.google_authenticator ]]       then         if [[ -n $(id $USER | grep &quot;admins&quot;) ]]           then             figlet -t -f $HOME\/bin\/rebel.tlf &quot;Welcome to Company GAuth setup portal&quot;             sleep 1.5             echo &quot;Please, run any of these software on your device, where you would like to setup OTP: Google Autheticator: AppStore - https:\/\/apps.apple.com\/us\/app\/google-authenticator\/id388497605 Play Market - https:\/\/play.google.com\/stor\/apps\/details?id=com.google.android.apps.authenticator2&amp;hl=en FreeOTP: AppStore - https:\/\/apps.apple.com\/us\/app\/freeotp-authenticator\/id872559395 Play Market - https:\/\/play.google.com\/store\/apps\/details?id=org.fedorahosted.freeotp&amp;hl=en  And prepare to scan QR code.  &quot;             sleep 5             google-auth -f -t -w 3 -r 3 -R 30 -d -e 1             echo &quot;Congratulations, now you can use an OTP token from application as a password connecting to VPN.&quot;           else             figlet -t -f $HOME\/bin\/rebel.tlf &quot;Welcome to Company GAuth setup portal&quot;             sleep 1.5             echo &quot;Please, run any of these software on your device, where you would like to setup OTP: Google Autheticator: AppStore - https:\/\/apps.apple.com\/us\/app\/google-authenticator\/id388497605 Play Market - https:\/\/play.google.com\/store\/apps\/details?id=com.google.android.apps.authenticator2&amp;hl=en FreeOTP: AppStore - https:\/\/apps.apple.com\/us\/app\/freeotp-authenticator\/id872559395 Play Market - https:\/\/play.google.com\/store\/apps\/details?id=org.fedorahosted.freeotp&amp;hl=en  And prepare to scan QR code.  &quot;             sleep 5             google-auth -f -t -w 3 -r 3 -R 30 -d -e 1             echo &quot;Congratulations, now you can use an OTP token from application as a password to VPN.&quot;             logout         fi       else         echo &quot;You have already setup a Google Authenticator&quot;         if [[ -z $(id $USER | grep &quot;admins&quot;) ]]           then           logout         fi     fi   else     echo &quot;You don't need to set up a Google Authenticator&quot; fi <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Fortigate:<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c <i>Radius<\/i>-\u0441\u0435\u0440\u0432\u0435\u0440\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eg\/5j\/gg\/eg5jggktj2rwjip6tpck5y6kary.png\"><\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c. \u0418\u043c\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u043d\u0430 <i>Fortigate<\/i> \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <i>Vendor Specific Attribute<\/i> <b>Fortinet-Group-Name<\/b>.\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5v\/zr\/_g\/5vzr_gll3otpmtj5xqpp87oxr0w.png\"><\/li>\n<li>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 <i>SSL<\/i>-\u043f\u043e\u0440\u0442\u0430\u043b\u044b.\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/69\/oa\/9k\/69oa9k_xbgvhhr-noojivxshv_0.png\"><\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u044b \u0432 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438.\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vb\/dg\/ui\/vbdguiginb9l6a02ee0b0bb3dqs.png\"><\/li>\n<\/ul>\n<p>  \u041f\u043b\u044e\u0441\u044b \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f:   <\/p>\n<ul>\n<li>\u0415\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e OTP \u043d\u0430 <i>Fortigate <\/i>\u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c. <\/li>\n<li>\u0418\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0432\u043e\u0434 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043f\u043e VPN, \u0447\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. 6-\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u0442\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0438\u043a\u0435\u0442\u043e\u0432 \u0441 \u0442\u0435\u043c\u043e\u0439: \u00ab\u041d\u0435 \u043c\u043e\u0433\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a VPN\u00bb.<\/li>\n<\/ul>\n<p>  P.S. \u0412 \u043f\u043b\u0430\u043d\u0430\u0445 \u0434\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 2-\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 challenge-response.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/516362\/\"> https:\/\/habr.com\/ru\/post\/516362\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/516362\/\">\u041a\u0430\u043a \u0431\u044b\u0442\u044c, \u0435\u0441\u043b\u0438 \u0434\u0432\u0443\u0445\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0438 \u043a\u043e\u043b\u0435\u0442\u0441\u044f, \u0430 \u0434\u0435\u043d\u0435\u0433 \u043d\u0430 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0435 \u0442\u043e\u043a\u0435\u043d\u044b \u043d\u0435\u0442 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0438 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f.<br \/>  \u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u043c-\u0442\u043e \u0441\u0443\u043f\u0435\u0440\u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c, \u0441\u043a\u043e\u0440\u0435\u0435 \u2014 \u043c\u0438\u043a\u0441 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-309499","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=309499"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309499\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=309499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=309499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=309499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}