cancel
Showing results for 
Search instead for 
Did you mean: 

OTP SMS with API (SMS Gateway)

cd
Cirrus
Cirrus

Hello,

I'd like to do OTP SMS via an HTTP API

I'm reading this link but is it still up to date (February,2011) ? the VPE is still OK or maybe they are news things..

 

Should I still need the iRule (It doesn't seem to be working (BIG IP v12.1.3.7)) ? Or can I use the OTP GENERATE object rather ?

Second thing I don't understand the use of "Variable Asssign HTTP", same for the username variable

 

Thanks

 

 

1 ACCEPTED SOLUTION

Imran_Abid
Altocumulus
Altocumulus

0691T000005lTWKQA2.pngHi cd,

 

I'm using a hardware device SMSEagle as my SMS gateway with APM.

 

As Neils rightly said above, there is no need to use an iRule.

 

I'm using these VPE agents in this particular sequence:

 

OTP Generate

HTTP Auth (to send the OTP as SMS)

Logon Page (to collect the OTP)

OTP Verify

 

Please refer to attached screenshots.

 

I hope it helps.

 

 

 

 

 

 

View solution in original post

9 REPLIES 9

It seems the documentation you are referring to is a little outdated. You don't need to use the iRule to create an OTP. Just use the 'OTP Generate' agent in the VPE.

 

The 'Variable Assign HTTP' is being used to match the AAA HTTP sms_auth object. You can see the fields 'Form Parameter for User Name' being set to 'to' and the 'Form Parameter for Password' being set to 'text'. These fields are being read from 'session.logon.last.username' and 'session.logon.last.password'.

 

Which SMS gateway are you using? If using MessageBird you could also use this code:

 

https://devcentral.f5.com/s/articles/send-an-one-time-password-otp-via-the-messagebird-sms-gateway-1...

 

Note that there are also other code snippets available for other SMS gateway providers.

 

Imran_Abid
Altocumulus
Altocumulus

0691T000005lTWKQA2.pngHi cd,

 

I'm using a hardware device SMSEagle as my SMS gateway with APM.

 

As Neils rightly said above, there is no need to use an iRule.

 

I'm using these VPE agents in this particular sequence:

 

OTP Generate

HTTP Auth (to send the OTP as SMS)

Logon Page (to collect the OTP)

OTP Verify

 

Please refer to attached screenshots.

 

I hope it helps.

 

 

 

 

 

 

cd
Cirrus
Cirrus

 

Thanks for your help !!

If you can help me to configure my HTTP API Server

Here the information of the API:

Endpoint

https://europe.ipx.com

Ressource

/restapi/v1/sms/send

Paramètres

?destinationAddress=33xxxxxxxxx&messageText=xxxxxxxxxxx&username=loginxxx&password=pwdxxx

 

TEST:

https://europe.ipx.com/restapi/v1/sms/send?destinationAddress=33xxxxxxxxx&messageText=Test&username= xxxxxxxxx &password=xxxxxxx

 0691T000005lVXUQA2.png

 

 

 

Imran_Abid
Altocumulus
Altocumulus

Hi,

 

You are missing the "?" at the end of Form Action URL:

 

It should be: https://europe.ipx.com/restapi/v1/sms/send?

cd
Cirrus
Cirrus

Even with the "?" it still dosent work:

 > Session variable 'session.http.last.errmsg' set to 'Curl perform failed: Couldn't connect to server'

I tried with GET or POST METHOD

 

Using Postman the curl is working in POST METHOD

>POSThttps://europe.ipx.com/restapi/v1/sms/send

BODY >messageText=test+Message+1&destinationAddress=33611223344&username=xxxxxxxt&password=xxxxx

 WITH HEADER> Accept:application/json and Content-Type:application/x-www-form-urlencoded

From F5 it doesn't work

curl -vkX POST https://europe.ipx.com/restapi/v1/sms/send -d 'messageText=REST+test4&destinationAddress=33611223344&username=xxxxxx&password=xxxxxxx'

* About to connect() to europe.ipx.com port 443 (#0)

*  Trying 194.165.14.200... Connection refused

* couldn't connect to host

* Closing connection #0

curl: (7) couldn't connect to host

 

 

I tried the curl command from an other linux server and it's working but not from the F5 😕

antec42
Altostratus
Altostratus

It looks like your F5 might be blocked by a firewall or router when trying to reach the SMS GW? Also check from which interface the calls are being sourced when APM initiates the connection.

 

BR, Marcus

cd
Cirrus
Cirrus

Yeah it's worked finally but I needed to use a custom post in AAA HTTP Server and use un custom body. Also add custom headers with "Accept:application/json and Content-Type:application/x-www-form-urlencoded"

Dear CD,

thanks for sharing your knowledge. Have you any step-by-step documents for this solution? Let me explain a little my scenario first. 

I do have a BIG-IP VE  ver 16+ WAF, I want to publish a virtual server, where OTP SMS will be generated by my own SMS Windows gateway. Please share any doc for this MFA Deployment with AD Authentication.

Md__Maksudur_Ra_0-1654081465817.png

 

Dennis_Kloosterman
Altostratus
Altostratus

Hi CD, I also have to use a custom post and have some trouble getting it to work. Were you able to use variables in your custom post?