Quantcast
Channel: Fortinet Cookbook
Viewing all articles
Browse latest Browse all 690

Social WiFi Captive Portal with FortiAuthenticator (Facebook)

$
0
0

WiFi authentication using social media provides access control without having to manually create guest accounts.

This recipe involves configuring an API for Facebook accounts, setting up a social portal RADIUS service on the FortiAuthenticator, and configuring the FortiGate for Captive Portal access.
 
This recipe is similar to the Captive portal WiFi access control recipe, but involves external security mode configuration, RADIUS authentication, and does not include FortiAP registration instructions.
 
Note that some CLI usage is required when configuring the FortiGate.
 
The FortiAuthenticator has been given an example fully qualified domain name (FQDN) — fortiauthenticator.example.com.

1. Configuring the Facebook developer account API

Open a browser and log in to your Facebook account.

In the URL field enter the following:

https://developers.facebook.com/products/login/

Select My Apps and select Register as Developer.

Confirm your Facebook password to continue.

Select that you have read and agree to the Facebook Platform and Facebook Privacy policies, and select Next to continue.

Enter your phone number and select to have your confirmation code sent to you via text (you may also choose to verify via phone call).

Once received, enter the code and select Register to continue. You will now be registered as a Facebook developer.

Next, select the Website platform to add a new app.

Enter a name for the website, and select Create New Facebook App ID.

Select Communication from the dropdown Category menu, and select Create App ID.

Scroll down to the bottom of the page and enter the site’s URL, then select Next. Scroll back up to the top of the page, and select Skip Quick Start.

To confirm the configuration, go to Settings. From here you can see your App ID, App Secret, Display Name, and Site URL.

Take note of the App ID and App Secret as they are required when configuring the Captive Portal on the FortiAuthenticator.

 

Next, go to Status & Review and enable the application — the account needs to be made “live” before WiFi users can successfully authenticate through Facebook.

The App ID and App Secret can be accessed at any time on the LinkedIn developer account, but it may be a good idea to copy them to a secure location.

2. Configuring the social portal RADIUS service on FortiAuthenticator

On the FortiAuthenticator, go to Authentication > User Management > User Groups, and create a Social_Users user group.

Users that log into LinkedIn will be placed in this group once it is added to the Captive Portal General Settings.

Go to Authentication > RADIUS Service > Clients, and create a new RADIUS client.

Enter a Name for the RADIUS client (the FortiGate) and enter its IP address (in the example, 172.20.121.56).

Enable the Social portal captive portal.

Enter the pre-shared Secret and set the Authentication method. The FortiGate will use this secret key in its RADIUS configuration.

Add the Social_Users user group to the Realms group filter as shown.

Select Save and then OK.

Next go to Authentication > Captive Portal > General and enable Social Portal.

Configure the account expiry time (in the example it is set to 1 hour).

Set Place registered users into a group to Social_Users.

Enable the Facebook login option and add your Facebook key and Facebook secret.

3. Configuring the FortiGate authentication settings

On the FortiGate, go to User & Device > Authentication > RADIUS Servers and create the connection to the FortiAuthenticator RADIUS server, using its IP and pre-shared secret.

Use the Test Connectivity option with valid credentials to test the connection.

Next, go to User & Device > User > User Groups and create a RADIUS user group called social_users.

Set the Type to Firewall and add the RADIUS server to the Remote groups table.

4. Configuring the FortiGate WiFi settings

Go to WiFi & Switch Controller > WiFi Network > SSID and select the SSID interface.

Under WiFi Settings, set the Security Mode to Captive Portal.

For the Authentication Portal, select External, and enter the FQDN of the FortiAuthenticator, followed by /social_login/.

For this recipe, it is set to:

https://fortiauthenticator.example.com/social_login/

Set User Groups to the social_users group.

5. Configuring the FortiGate to allow access to Facebook

On the FortiGate, configure firewall addresses to allow users to access the Facebook login page.

The following step can be performed in the GUI, but may take considerably longer than using the CLI. You can also copy and paste the commands below into the CLI console.

Go to System > Dashboard and enter the CLI Console. Enter the following, which creates the firewall addresses and adds them to a firewall address group called Facebook_Auth:

config firewall address
   edit "FB0"
      set subnet 5.178.32.0 255.255.240.0
   next
   edit "FB1"
      set subnet 195.27.154.0 255.255.255.0
   next
   edit "FB2"
      set subnet 80.150.154.0 255.255.255.0
   next
   edit "FB3"
      set subnet 77.67.96.0 255.255.252.0
   next
   edit "FB4"
      set subnet 212.119.27.0 255.255.255.128
   next
   edit "FB5"
      set subnet 2.16.0.0 255.248.0.0
   next
   edit "FB6"
      set subnet 66.171.231.0 255.255.255.0
   next
   edit "FB7"
      set subnet 31.13.24.0 255.255.248.0
   next
   edit "FB8"
      set subnet 31.13.64.0 255.255.192.0
   next
   edit "FB9"
      set subnet 23.67.246.0 255.255.255.0
   next
   edit "akamai-subnet-23.74.8"
      set subnet 23.74.8.0 255.255.255.0
   next
   edit "akamai-subnet-23.74.9"
      set subnet 23.74.9.0 255.255.255.0
   next
   edit "akamaihd.net"
      set type fqdn
      set fqdn "akamaihd.net"
   next
   edit "channel-proxy-06-frc1.facebook.com"
      set type fqdn
      set fqdn "channel-proxy-06-frc1.facebook.com"
   next
   edit "code.jquery.com"
      set type fqdn
      set fqdn "code.jquery.com"
   next
   edit "connect.facebook.com"
      set type fqdn
      set fqdn "connect.facebook.com"
   next
   edit "fbcdn-photos-c-a.akamaihd.net"
      set type fqdn
      set fqdn "fbcdn-photos-c-a.akamaihd.net"
   next
   edit "fbcdn-profile-a.akamaihd.net"
      set type fqdn
      set fqdn "fbcdn-profile-a.akamaihd.net"
   next
   edit "fbexternal-a.akamaihd.net"
      set type fqdn
      set fqdn "fbexternal-a.akamaihd.net"
   next
   edit "fbstatic-a.akamaihd.net"
      set type fqdn
      set fqdn "fbstatic-a.akamaihd.net"
   next
   edit "m.facebook.com"
      set type fqdn
      set fqdn "m.facebook.com"
   next
   edit "ogp.me"
      set type fqdn
      set fqdn "ogp.me"
   next
    edit "s-static.ak.facebook.com"
      set type fqdn
      set fqdn "s-static.ak.facebook.com"
   next
   edit "static.ak.facebook.com"
      set type fqdn
      set fqdn "static.ak.facebook.com"
   next
   edit "static.ak.fbcdn.com"
      set type fqdn
      set fqdn "static.ak.fbcdn.com"
   next
   edit "web_ext_addr_SocialWiFi"
      set type fqdn
      set fqdn "web_ext_addr_SocialWiFi"
   next
   edit "www.facebook.com"
      set type fqdn
      set fqdn "www.facebook.com"
   next
end
config firewall addrgrp
   edit "Facebook_Auth"
      set member "FB0" "FB1" "FB2" "FB3" "FB4" "FB5" "FB6" "FB7" "FB8"       "FB9" "akamaisubnet-
      23.74.8" "akamai-subnet-23.74.9" "akamaihd.net" "channel-proxy-06-
      frc1.facebook.com" "code.jquery.com" "connect.facebook.com" "fbcdn-      photos-ca.
      akamaihd.net" "fbcdn-profile-a.akamaihd.net" "fbexternal-      a.akamaihd.net"
      "fbstatic-a.akamaihd.net" "m.facebook.com" "ogp.me" "s-      static.ak.facebook.com"
      "static.ak.facebook.com" "static.ak.fbcdn.com"       "web_ext_addr_SocialWiFi"
      "www.facebook.com" "FortiAuthenticator"
   next
end

Go to Policy & Objects > Policy > IPv4 and create a policy for Facebook authentication traffic.

Set Incoming Interface to the WiFi SSID interface and set Source Address to all.

Set Outgoing Interface to the Internet-facing interface and set Destination Address to Facebook_Auth.

Set Service to ALL and enable NAT. Configure Security Profiles accordingly.

Go to System > Dashboard and enter the CLI Console. Add the following to exempt the Facebook authentication traffic policy from the captive portal:

config firewall policy
   edit <policy_id>
      set captive-portal-exempt enable
   next
end

This command allows access to the external Captive Portal.

6. Configuring the FortiGate to allow access to FortiAuthenticator

On the FortiGate, go to Policy & Objects > Objects > Addresses and add the FortiAuthenticator firewall object.

For Subnet/IP Range enter the IP address of the FortiAuthenticator.

Go to Policy & Objects > Policy > IPv4 and create the FortiAuthenticator access policy.

Set Incoming Interface to the WiFi SSID interface and set Source Address to all.

Set Outgoing Interface to the Internet-facing interface and set Destination Address to FortiAuthenticator.

Set Service to ALL and enable NAT.

Add the following to exempt the FortiAuthenticator access policy from the Captive Portal:

config firewall policy
   edit <policy_id>
      set captive-portal-exempt enable
   next
end

7. Results

Connect to the WiFi and attempt to browse the Internet. You will be redirected to the Captive Portal splash page.

Select Facebook and you should be redirected to the Facebook login page.

Enter valid Facebook credentials and you will be redirected to the URL initially requested.

You can now browse freely until the social login account expires, as configured on the FortiAuthenticator under Authentication > Captive Portal > General.

To view the authenticated user added on FortiAuthenticator, go to Authentication > User Management > Social Login Users.

You can configure Captive Portal to use other social WiFi logins:

The post Social WiFi Captive Portal with FortiAuthenticator (Facebook) appeared first on Fortinet Cookbook.


Viewing all articles
Browse latest Browse all 690

Trending Articles