Saturday, September 14, 2019

HOWTO use MFA with Fortigate and OneLogin

In this blog post. I will demo a simple but effective Onelogin RADIUS-aaS w/MFA & with a Fortigate firewall and give you a few free API tips

A few items;
  1. username "demosocpuppets"   
  2. a policy was created in OneLogin & with MFA set for the authentication policy and for the user
  3. Radius Server was configured in the  FGT as plain jane radius client
  4. the use username was set in onelogin with  passsword+otp for the password format

Let's 1st peek at the OneLogin configurational items, since most of the work is done here.

1st you need a RADIUS client defined. This is the FGT that would send the radius request




and set the username and password files , by default username==email and password=password





That concludes the radius client configurations. Now it'w best to build the Authenticator  & MFApolicy since you will use that for the radius-client and users. Do it in that order also!

1st we define our Authenticators, we want to use google-auth. So I built mine and selected google-authenticator. Google-Auth is widely accepted and it plain out works & works great. The temporal 6 numeric digits  OTP is pretty much hack proof.





The policy will call up the enablement of MFA and uses google-authenticator for this demo and user.







Okay we are almost done. You only need to apply a user and instructions in that user settings to use the MFA policy.




Make sure to set the user's "username field",  by default it is not required , but our radius cfg and attributes is using that for the username to authenticated and not via the email address




After the above has been done,  and the user has registered. We need to set his  MFA profile in the user portal.

I'm using  AUTHY for my token generators  https://authy.com/









The authentication would be similar to the following;

   Username="username in onelogin ......the user name field"
   Password="password<otp>"


Examples

 demosocpuppets 
 !test1234!435789 

Breaks down to;

   password = !test1234!
   otp= 435789

Here's a diag test from the fortigate  appliance that shows a PAP radius request , and the values sent to our Onelogin Radius Server.


Here's a ssh access being tested for the user demosocpuppets



And finally the boring radius configuration in FortiOS;

{ radius server }


{ group defined }


{User account set for External-Authentication )



OneLogin has a few advantages over Jumpcloud,  but both are equally great platforms.

1st off the logs are great and the format is very simple to read





And 2nd you can login failure times and hold out in the OneLogin Policy




This along with the on appliance lock-on-failure settings and really secure the appliance and users







Onelogin also has some pre-defined reports and better ease of using and assuming a user. The layout in the WebUI is just basically better.

The API interface is pretty awesome and uses a token granted based off your client id and secret. The life of the token is 1hour











Sample API calls using cUrl 

    { request a new token  }

 curl  -H "Authorization: client_id:<fromportal>, client_secret:<fromportal>" -k -H "Content-Type: application/json" -d '{ "grant_type":"client_credentials" }' https://api.us.onelogin.com/auth/oauth2/token



    { check rate limits  }

curl  -k -H "Authorization: bearer:bacf325e9fc62bd8314bb3293f714e8a9a27ebfabffc10b2f492131101e055e2" https://api.us.onelogin.com/auth/rate_limit

    { get a list of users }

 curl  -k -H "Authorization:bearer:bacf325e9fc62bd8314bb3293f714e8a9a27ebfabffc10b2f492131101e055e2" https://api.us.onelogin.com/api/1/users

   { get events }

curl  -k -H "Accept: application/xml"  -H "Authorization: bearer:bacf325e9fc62bd8314bb3293f714e8a9a27ebfabffc10b2f492131101e055e2" https://api.us.onelogin.com/api/1/events/

   { lock a user }

curl -X PUT   -k -d '{ "locked_until":"10" }'  -H "Accept: application/xml"  -H "Authorization: bearer:bacf325e9fc62bd8314bb3293f714e8a9a27ebfabffc10b2f492131101e055e2" https://api.us.onelogin.com/api/1/users/58498736/lock_user

   { change a user password }

curl -X PUT -H "Content-Type: application/json"   -k -d '{ "password":"socpuppets12345678", "password_confirmation":"socpuppets12345678" }'  -H "Accept: application/xml"  -H "Authorization: bearer:da242c58d2c76ef16b6652b163c5c25936f4b0a3a4e9dc841d69e68132c799da" https://api.us.onelogin.com/api/1/users/set_password_clear_text/58498736

    
 If you try something outside of your permission you will get a response similar to top photo vrs the bottom



And on passwords changes, the confirmation will quickly tell you if your a success or not;




All API admin activities are login in the event audit traces




In closing MFA is the method that we all should be using to secure access via  ssh, webgui, ipsec-dialup, and sslvpn.Onelogin can secure all aspect of the Firewall Access. You can read more at one of my earlier post;


I've been securing Fortigates and Fortimail with MFA authentication for over 6 years now. These same configuration apply to other vendor products ( JNPR, PANW etc...)






NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=
         o
        /  \



Thursday, September 12, 2019

HOWTO use MFA with Fortigate and Jumpcloud

In this post we have a simple MFA deployment using the Jumpcloud RADIUS-aaS and a Fortiagte Firewall. The configuration for MFA from the radius-client ( FGT ) is no different than the a non-MFA radius deployment.

In this example we have a username=smcldap which  been enrolled in the Jumpcloud for google-auth. The Jumpcloud radius client has been enforced to use MFA for it's users.






User enablement for MFA is done in the Jumpcloud portal for each user






The Fortigate is done as a typical radius setup with the populate radius configuration




I 've set my nas-ip and source-ip in this example to ensure the address will be seen and matched by the cloud radius server-instance @ 18.204.0.31

The login for MFA is done in this fashion (userpassword,<OTP>)  see this diag test output where my 6digit OTP  is include after my password


MFA with Jump cloud is only via PAP for the obviously reason that the challenge and changing OTP would not work. So if you send anything other than PAP, the client will fail or timeout.




So here's a simple screenshot of me doing  a login from a webUI. I add-on the format of the password and otp that I would insert ine "web form password input "

e.g    'mypassword,123456'





MFA is the method that we should be using to secure ssh, webgui, ipsec-dialup, and sslvpn.





NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=
         o
        /  \




Thursday, September 5, 2019

Howto Use FortiOS api-user

In this blog I will demo some basic api-user with the FortiOS token.

The API interface on the fortigate, is very well documented and defined. You can review my earlier API blog for the FortiOS here on blogspot.

http://socpuppet.blogspot.com/2018/07/howto-use-fortios-api-to-add-delete.html

The 1st item you will need to defined is a api-user. In this example we have a user name "soc2". The user is logged in the events logs btw. You need to set a "accessprofile" and that profile needs to allow whatever function the api is trying to do.





You will have to call up  api key. This key is generated one time and is visible on the cli. Here' I crafted a user for socpuppets api-key

  cli cmd  execute api-user generate-key <username>





Next to make system level calls you need to use HTTPS and send a Application header in the format of "Authorization: Bearer <your generated api token key> "   https:/x.x.x.x/api/v2/cmdb/<api path to the object your calling >

Here's a few example using cURL for exploring the API.



curl -k  -H -- "Authorization: Bearer 6qQyk7Q3Hpz8k6z74161xG0Q5GNkpn"  "https://192.168.1.99/api/v2/cmdb/system/global?access_token=6qQyk7Q3Hpz8k6z74161xG0Q5GNkpn"  


And the output would be some thing like the following;

 {

  "http_method":"GET",
  "revision":"4.0.0.79100365.1565843549",
  "results":{
    "language":"english",
    "gui-ipv6":"disable",
    "gui-certificates":"enable",
    "gui-custom-language":"disable",
    "gui-wireless-opensecurity":"disable",
    "gui-display-hostname":"disable",
    "gui-lines-per-page":50,
    "admin-https-ssl-versions":"tlsv1-1 tlsv1-2",
    "admintimeout":15,
    "admin-console-timeout":0,
    "admin-concurrent":"enable",
    "admin-lockout-threshold":3,
    "admin-lockout-duration":60,
    "refresh":0,
    "interval":5,
    "failtime":5,
    "daily-restart":"disable",
    "restart-time":"00:00",
    "radius-port":1812,
    "admin-login-max":100,
    "remoteauthtimeout":5,
    "ldapconntimeout":500,
    "batch-cmdb":"enable",
    "multi-factor-authentication":"optional",
    "dst":"enable",
    "timezone":"04",
    "traffic-priority":"tos",
    "traffic-priority-level":"medium",
    "anti-replay":"strict",
    "send-pmtu-icmp":"enable",
    "honor-df":"enable",
    "management-vdom":"root",
    "hostname":"xxxxxxxx",
    "alias":"xxxxxxxxxx",
    "strong-crypto":"enable",
    "ssh-cbc-cipher":"enable",
    "ssh-hmac-md5":"enable",
    "ssh-kex-sha1":"en
( output snipped)

Here's a few more simple calls you can test.

Example we will look at the addrgrp   /api/v2/cmdb/firewall/addrgrp



( out was snipped )


How about a policy #1 . /api/v2/cmdb/firewall/policy/1




( out was snipped )

Here we will look at policy counters;   /api/v2/monitor/firwall/policy/?vdom=root&access_token=<tokenvalue>




( out was snipped )


If you request a object that does not exist like policyid #222 in this example you will get a status code 404





Example we will look at a api-user    /api/v2/cmdb/system/api-user




( out was snipped )



Example we will look at a accprofile    /api/v2/cmdb/system/accprofile




( out was snipped )

In the above examples these where http.get here we will clear policy counters via a simple POST and check afterwards to see counter values cleared






So please play around with the API and api-user in the FortiOS. All examples are done with v6.0.0. 

The API can simplify and help in auditing fortios configurations. It's a great tool from a security engineer tool box to quickly gather details for analysis and auditing.


A tip, to temporary disable the access for api-user, define a noaccess-profile and apply that to any api user. Any calls to sublevels that are set as none will be blocked.

accessprofile ( with none set ) 







Note: You can find more details and posting at the fortinet forum community. I've been a member since 2005 and regular poster since 2007 under the name "emnoc". Myself and other contributors have posted very useful information and help at this forum.

https://forum.fortinet.com/






NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=
         o
        /  \