[RADIATOR] 2 Factor authentication via Authby LDAP2 and Authby OTP

Sagar Malam sagar.malam at ecosmob.com
Thu Jan 6 12:31:23 UTC 2022


Hello Heikki,

Thanks for the help. I tried the approach with authby OTP that you
suggested but once Authby LDAP2 is processed , Authby OTP is not getting
executed instead Access-Accept is sent to  client.


Config File :

<AuthBy OTP>
        Identifer otp-authby
    EAPType One-Time-Password,Generic-Token
    PasswordPattern 99999

    ChallengeHook sub {my ($self, $user, $p, $context) = @_;\
        $context->{otp_password} = $self->generate_password();\

system('/usr/src/send_sms.sh','NNNNNNNNN',$context->{otp_password});\
        return "OTP sent";}

    AddToReply State="auth-otp"
    VerifyHook sub {my ($self, $user, $submitted_pw, $p, $context) = @_;\
        return $context->{otp_password} eq $submitted_pw ;}
</AuthBy>

<Handler State=auth-otp>
    AuthBy otp-authby
</Handler>

<Handler>
    AuthByPolicy ContinueWhileAccept
    <AuthBy LDAP2>
     Host    192.168.0.45
    EAPType One-Time-Password,Generic-Token
    AuthDN CN=XXXXXX ,OU=ServiceAccounts,DC=XXXXX,DC=XXXXX,DC=com
    AuthPassword    XXXXX
    BaseDN        DC=XXXXXX,DC=XXXXX,DC=com
    ServerChecksPassword
    UsernameAttr sAMAccountName
    AuthAttrDef logonHours,MS-Login-Hours,check
    ConsumePassword ,
    </AuthBy>
    AuthBy otp-authby
</Handler>

Error Log : https://paste-bin.xyz/30722

[root at radiator goodies]# /opt/radiator/radiator/radpwtst -noacct -password
'' -user XXXXX -password XXXX
sending Access-Request
OK
[root at radiator goodies]#




On Wed, Jan 5, 2022 at 6:08 PM Heikki Vatiainen <hvn at open.com.au> wrote:

> On 4.1.2022 12.15, Sagar Malam wrote:
>
> > I am new to radiator and perl.I would like to implement 2FA using Authby
> > LDAP2 and Authby OTP but i am not able to find any examples for
> > implementing the same over the internet.
>
> Please see goodies/duo.cfg together with goodies/otp.cfg
>
> duo.cfg shows how to check password against a file, can be SQL, LDAP,
> etc. too, and then pass the request, if successful so far, to the second
> factor. In this case there's no Access-Challenge required, just one
> Access-Request followed by access or reject, and it works with plain PAP
> and EAP-TTLS/PAP.
>
> If you'd like to use AuthBy OTP, something like this could work:
>
> <AuthBy OTP>
>      Identifer otp-authby
>      # Add to Access-Challenge State attribute with value 'auth-otp'
>      # This is done in the ChallengeHook
> </AutHBy>
>
> <Handler State=auth-otp>
>      AuthBy otp-authby
> </Handler>
>
> <Handler>
>      AuthByPolicy ContinueWhileAccept
>      <AuthBy LDAP2>
>          ConsumePassword
>      </AuthBy>
>      AuthBy otp-authby
> </Handler>
>
>
> The user first logs in with their LDAP password. If successful, password
> is cleared from the request and AuthBy OTP is called for the first time.
> This triggers ChallengeHook. Within the ChallengeHook, add State
> attribute so that the subsequent Access-Accept, that now contains the
> one-time-password, caught by <Handler State=auth-otp>.
>
> What the above requires is PAP and that the authentication client
> software the user has understands Radius Access-Challenge.
>
> Using EAP-TTLS/PAP could also work. In this case the correct use of
> State attribute needs to be checked.
>
> Note that the above is plain Radius where a RADIUS client sends requests
> to Radiator. If you'd need to have an integration to web services, that
> can be problematic as Dubravko wrote earlier.
>
> Thanks,
> Heikki
>
> --
> Heikki Vatiainen
> OSC, makers of Radiator
> Visit radiatorsoftware.com for Radiator AAA server software
> _______________________________________________
> radiator mailing list
> radiator at lists.open.com.au
> https://lists.open.com.au/mailman/listinfo/radiator



-- 

Thanks & Regards,
Sagar Malam
Project Leader | Ecosmob Technologies Pvt. Ltd.
(+91)9601533171 | www.ecosmob.com
<http://www.google.com/url?q=http%3A%2F%2Fwww.hodusoft.com&sa=D&sntz=1&usg=AFQjCNHXhIaelhkmhqcPU8D1lt3QoYpm2w>
Skype: sagar.ecosmob

-- 
*Disclaimer*
In addition to generic Disclaimer which you have agreed on our 
website, any views or opinions presented in this email are solely those of 
the originator and do not necessarily represent those of the Company or its 
sister concerns. Any liability (in negligence, contract or otherwise) 
arising from any third party taking any action, or refraining from taking 
any action on the basis of any of the information contained in this email 
is hereby excluded.



*Confidentiality*
This communication (including any 
attachment/s) is intended only for the use of the addressee(s) and contains 
information that is PRIVILEGED AND CONFIDENTIAL. Unauthorized reading, 
dissemination, distribution, or copying of this communication is 
prohibited. Please inform originator if you have received it in error.


*Caution for viruses, malware etc.*
This communication, including any 
attachments, may not be free of viruses, trojans, similar or new 
contaminants/malware, interceptions or interference, and may not be 
compatible with your systems. You shall carry out virus/malware scanning on 
your own before opening any attachment to this e-mail. The sender of this 
e-mail and Company including its sister concerns shall not be liable for 
any damage that may incur to you as a result of viruses, incompleteness of 
this message, a delay in receipt of this message or any other computer 
problems. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.open.com.au/pipermail/radiator/attachments/20220106/895d0173/attachment.html>


More information about the radiator mailing list