Freeradius: add motp authentication

aptitude install ksh gcc libpam0g-dev -y
wget http://motp.sourceforge.net/pam_mobile_otp-0.6.2.tgz
tar -zxf pam_mobile_otp-0.6.2.tgz
cd pam_mobile_otp-0.6.2
make && make install
wget http://downloads.sourceforge.net/project/pam-script/pam-script-1.1.5.tar.gz
cd pam-script
./configure && make && make install
wget http://motp.sourceforge.net/otpverify.sh
chmod +x otpverify.sh
wget http://motp.sourceforge.net/dictionary.motp
include this file to /etc/freeradius/dictionary
mkdir -p /var/motp/{cache,users}
chown -R freerad.freerad /var/motp
create file /etc/freeradius/modules/MOTP
MOTP {
wait = yes
program = «/path/to/otpverify.sh %{User-Name} %{User-Password} %{reply:Secret} %{reply:Pin} %{reply:Offset}»
input_pairs = request
output_pairs = reply
}

add to file /etc/freeradius/sited-enabled/default (or which do you use)
Auth-Type External {
         MOTP
}

edit /etc/freeradius/users
DEFAULT Auth-Type := External
  Fall-Through = Yes
yourlogin
 Secret = e37629f6d057dcc5,
 PIN = 1234,
 Offset = 0

/etc/init.d/freeradius restart