# Implemented VPN Remote Access On pfSense

## Introduction

This project focuses on implementing a secure remote access solution using **pfSense** and **OpenVPN**. By integrating centralized authentication via **Active Directory** with **RADIUS**, the solution ensures robust security and streamlined user management. Additionally, features like secure file sharing, remote system access, and access to internal web services make this implementation versatile and practical for a variety of purposes.

## Objective

The primary objective of this project is to establish a reliable and secure VPN solution that enables remote users to access internal network resources safely and efficiently. Key goals include:

* Ensuring secure authentication through centralized user management with **Active Directory** and **RADIUS Server**.
* Enabling remote access to critical services, such as internal web servers, FTP file sharing, and Telnet-based systems.
* Providing efficient and encrypted connections to internal systems using **TightVNC** for remote management.
* Access control, ensuring users have permissions tailored to their responsibilities for simplified management and enhanced security.

## Implement

### Network Architecture

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FGrPbSyBtl04nhe3TMtje%2Fimage.png?alt=media&#x26;token=d79ad573-4660-48f1-a2cd-7fc9c16a736b" alt=""><figcaption><p>The components in architecture</p></figcaption></figure>

| WAN Address     | 192.168.31.249 |
| --------------- | -------------- |
| Tunnel Net      | 10.3.201.0/24  |
| LAN Subnet      | 10.3.0.0/24    |
| LAN gateway     | 10.3.0.10      |
| Internal Client | 10.3.0.129     |
| Internal Server | 10.3.0.131     |

### Configure VMware

In this lab, I utilize three virtual machines: one dedicated to pfSense, another for the Active Directory (AD) server, and a third serving as the Internal Client (IC).

#### pfSense

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F8YVhNIOuqE7SIFEN6Gok%2Fimage.png?alt=media&#x26;token=f1c17cff-4719-4225-a28b-368091094cf6" alt=""><figcaption><p>Configure Network Adapter</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FSZj2tsZBCY8T9gnS4ixG%2Fimage.png?alt=media&#x26;token=5171278a-4613-47cd-ad3a-eaf3b6385b94" alt=""><figcaption><p>IP of VMnet1</p></figcaption></figure>

Using 2 Network Adapter, one for WAN and another for LAN

#### Active Directory

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FRKxDozEQ3gDo63lr5cYH%2Fimage.png?alt=media&#x26;token=852fe26c-7016-4ebe-9eec-59a4ba61ba0f" alt=""><figcaption><p>Configure Network Adapter</p></figcaption></figure>

In this configuration, I use NAT solely for internet access, as it is not a critical component. The second network adapter is designated for the server within the LAN.

#### Internal Client

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FcruJfNWTY1pytFsIfVCa%2Fimage.png?alt=media&#x26;token=d67c2c3f-679f-49fd-a5ba-21117b520011" alt=""><figcaption><p>Configure Network Adapter</p></figcaption></figure>

As explained above, the NAT setup is used exclusively for internet access, which is not a key focus. Similarly, the second network adapter connects the internal client to the LAN.

### Configure pfSense

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FUcC3zF4ztR1S5Jkg8HZq%2Fimage.png?alt=media&#x26;token=049d74cd-8416-46e3-8445-017b1bc0d90b" alt=""><figcaption><p>Configure pfSense</p></figcaption></figure>

After a successful installation, the interface is configured as described above. For the VMware pfSense setup, I selected "Bridged" for the WAN interface. This allows the VM's IP to be in the same subnet as my real IP, enabling direct connection to the VM.

{% hint style="info" %}
Bridge mode allows your VM to act as its own device on your network, with its own IP address. This is beneficial if you're running services or applications that require direct network access, or if you want to mimic a real network environment.

[How do you choose between NAT and bridge mode for your VM network?](https://www.linkedin.com/advice/0/how-do-you-choose-between-nat-bridge-mode-your)
{% endhint %}

For the LAN interface, I have configured the IP address as **10.3.0.10**, which serves as the gateway IP for routing traffic between the internal network and pfSense. This ensures that devices on the internal network use **10.3.0.10** as their default gateway to communicate with pfSense and access external networks.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FERI4udl09eEGw0SzlnlM%2Fimage.png?alt=media&#x26;token=f7243be8-db6a-4ada-90a8-ab3cea58e151" alt=""><figcaption><p>GUI pfSense</p></figcaption></figure>

I have already installed  some packages as above.&#x20;

### Active Directory

Here, I am using **Windows Server 2022**. After completing the setup, I will proceed with implementing the described objectives, ensuring proper integration and functionality across the pfSense firewall, Active Directory, and internal client systems.

#### Authenticating OpenVPN Users with RADIUS via Active Directory

* First, I installed the **Active Directory Domain Services** role on the server and promoted it to a **Domain Controller (DC)**. This setup allows the server to manage domain-based user authentication and provide directory services for the network.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FpXUGJLvRk4Yf1OaYQSXp%2Fimage.png?alt=media&#x26;token=cbdbf27d-3b68-4d8c-8f7d-ddb6ded640a7" alt=""><figcaption><p>Roles and Features</p></figcaption></figure>

* I have already created a root domain named **vpn.lab**, which serves as the central domain for managing and authenticating users within the network. This domain will be used for user access control and VPN authentication.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FBTi7u3DX6nZE62VUykLc%2Fimage.png?alt=media&#x26;token=dc451b40-9e31-4094-b2e2-cf78dc463343" alt=""><figcaption><p>Domain properties</p></figcaption></figure>

* After setting up the domain, I added users to the Windows Server. I created a group called **GroupVPN** to manage user accounts specifically for VPN access. This group helps streamline VPN authentication and permissions. Within the **Users** directory, I created individual user accounts that will be used for logging into the VPN. This setup ensures centralized user management and secure access control.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2Ftc3SJsb9EEovedTXOMzg%2Fimage.png?alt=media&#x26;token=c4daa76a-b856-40a0-9fb7-7ab2b0656ce1" alt=""><figcaption><p>Group accounts </p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F6K2otm161YB9UWnhrMTB%2Fimage.png?alt=media&#x26;token=f0689ee2-8c73-476a-a7d7-bb5b8bef51c8" alt=""><figcaption><p>User accounts </p></figcaption></figure>

#### Authenticating from Active Directory using RADIUS/NPS

{% hint style="info" %}
Setup the NPS role which allows the Windows Server to handle RADIUS requests.

Windows Servers can be configured as a RADIUS server using the Microsoft Network Policy Server (NPS). This allows a Windows Server to handle authentication for OpenVPN, Captive Portal, the PPPoE server, or even the firewall GUI itself. NPS can authenticate based on Windows Server local user accounts or Active Directory.

Microsoft recommends installing NPS on an Active Directory domain controller to improve performance in environments where NPS is authenticating against Active Directory.
{% endhint %}

* First, I installed **Network Policy Server (NPS)** on the Active Directory server. By integrating NPS with Active Directory, I ensure that user credentials are securely validated against the domain's user accounts.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FNMNilYT2JCQlRXyY8cpl%2Fimage.png?alt=media&#x26;token=3b48a431-956d-4342-a33b-2992f96da43b" alt=""><figcaption><p>Roles and Features</p></figcaption></figure>

* After completing the installation, I began the configuration process. I added a **RADIUS Client** with the IP address set to the LAN gateway (10.3.0.10). This client acts as an intermediary, forwarding authentication requests from VPN users to the RADIUS server for verification.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2Fw7FGE7dpIqBICdrOXhpx%2Fimage.png?alt=media&#x26;token=17201f30-53a7-4c66-a762-d1820ac417a9" alt=""><figcaption><p>NPS</p></figcaption></figure>

* In the **Network Policies** section, I created a rule specifically for the **GroupVPN** group. This policy grants members of GroupVPN access to the LAN network, ensuring only authorized users can connect to internal resources.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FvBOgg61SO8kWvJ760ALi%2Fimage.png?alt=media&#x26;token=0c0fbc6c-c7b9-4e5a-96e7-36aa3753f6bf" alt=""><figcaption><p>Rule properties</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FKAC2URk7BCiK9DQIQSn9%2Fimage.png?alt=media&#x26;token=32793bc2-247c-45bc-a739-18f58f76304f" alt=""><figcaption><p>Rule condition</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FcxmXvWvI2rfWEu3VslUU%2Fimage.png?alt=media&#x26;token=4a9f6c99-6efb-47bd-94c9-dc19cf2a6bff" alt=""><figcaption><p>Addition configure for rule</p></figcaption></figure>

### Setup Authentication Server

* In **pfSense**, I configured an **Authentication Server**, which is the Active Directory (AD) server. This setup allows the firewall to use the AD server for authenticating VPN users, ensuring secure and centralized credential verification.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F0MTTzveJ91L2gPdPkWxP%2Fimage.png?alt=media&#x26;token=57d94642-8981-41a4-b909-9fde97e9c83c" alt=""><figcaption><p>Configure authentication server</p></figcaption></figure>

#### Test Authentication

* Here, I tested the account to ensure it was authenticated successfully through the configured authentication server.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FvpIt5zAmds5M0qDFhxCG%2Fimage.png?alt=media&#x26;token=856557e1-56cf-4a0d-9afa-7883b7d53edf" alt=""><figcaption><p>Tested my account</p></figcaption></figure>

### Setup OpenVPN

* Here, I provide some proof of successful creation. The entire process will be documented in detail in the resource section.
* The Certificate Authority (CA) is responsible for issuing and managing certificates, including the server certificate, to ensure secure communication and authentication.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FU2jKOoQPt6ZZunH1gIad%2Fimage.png?alt=media&#x26;token=e42ea9fb-4abb-4d62-bb06-291673da1177" alt=""><figcaption><p>CA</p></figcaption></figure>

{% hint style="info" %}
The firewall uses this entry as a root CA which can sign server and user certificates. Clients can use this CA to validate the server, and the server can use this CA to validate clients. Because this CA is self-signed, only clients which are supplied with a copy of this CA certificate will trust other certificates signed by this CA.
{% endhint %}

* The server certificate verifies the server's identity to clients and facilitates the establishment of a secure, encrypted connection. It ensures trustworthiness and protects data exchanged from eavesdropping or tampering.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FI16nZ8uUnIObs3qRzN3o%2Fimage.png?alt=media&#x26;token=5c78162e-f756-41b0-abf0-77066ab490cb" alt=""><figcaption><p>Server certificate</p></figcaption></figure>

{% hint style="info" %}
The CA will sign this certificate.
{% endhint %}

* This section outlines the configuration of OpenVPN servers. Detailed steps and settings are provided in the resource section for reference.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FwPSvN2jJJb0oPSsuyC0f%2Fimage.png?alt=media&#x26;token=0ba8ee08-b1c2-4098-9bd3-d4005bcaf3e1" alt=""><figcaption><p>OpenVPN Servers</p></figcaption></figure>

#### Verifying the Setup

* Some rules are created after successfully configuring the OpenVPN server.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FgFYyTHc9aQXAt5z1wCwk%2Fimage.png?alt=media&#x26;token=4ce64667-0e1a-47e1-b073-bef8b4b1e02f" alt=""><figcaption><p>WAN rule</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FBk7JcPuE6QGySxF8fD0Y%2Fimage.png?alt=media&#x26;token=525ab77e-f023-45c7-91bd-fb73961e8801" alt=""><figcaption><p>OpenVPN rule</p></figcaption></figure>

* After everything was successfully set up, I encountered an issue where I couldn't ping the local network. After several attempts, I found the solution by changing the outbound NAT from automatic to manual and creating a new NAT for it.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FHxG4NU5kLuzE7tpzkBzi%2Fimage.png?alt=media&#x26;token=3b984fb9-e2ec-4a34-b9ef-0aab77a40baf" alt=""><figcaption><p>Outbound NAT</p></figcaption></figure>

#### Export Cetificate

* Here, I use IP address-based hostname resolution, so if I change my WAN address, I will need to export the certificate again.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2Fx1wrq4qlGZUUcNaQWKNG%2Fimage.png?alt=media&#x26;token=e75cc7d2-3b2e-42d6-9cb1-3ffcf46e7213" alt=""><figcaption><p>Configure export</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2Fq9tdRmw7pw2Ktupim5qt%2Fimage.png?alt=media&#x26;token=70995e92-0aa7-4757-a049-009e62015927" alt=""><figcaption><p>Configure export</p></figcaption></figure>

* Export successfully

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FVmgUsDBbibesTaKpWuRM%2Fimage.png?alt=media&#x26;token=786c3e18-fc9c-40fa-b649-ce17fc926f94" alt=""><figcaption><p>Certificate OpenVPN Clients</p></figcaption></figure>

### Setup Web server and FTP server

* First, I installed the IIS (Internet Information Services) Web Server to host a website and set up an FTP server.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FC2F9d3DViQnEsPMfFtiX%2Fimage.png?alt=media&#x26;token=1081014a-b892-4424-9854-0a03bf295062" alt=""><figcaption><p>Roles and Features</p></figcaption></figure>

* Here, I set up two sites: one is a website, utilizing the default web server configuration, and the other is an `ftp_site`, a designated folder for file sharing between clients.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FMDbxw9Z5MJMMg32G3KLB%2Fimage.png?alt=media&#x26;token=aefcaf46-af42-47c8-b688-3e73f76f1f09" alt=""><figcaption><p>Sites</p></figcaption></figure>

* In the FTP server, I configured several settings as outlined below.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FapUWkYPvzIvt9KyUKN8Z%2Fimage.png?alt=media&#x26;token=7d92523a-2d75-4c12-8d22-fc8d6893f2fc" alt=""><figcaption><p>Permisson for ftproot</p></figcaption></figure>

{% hint style="info" %}
What is IUSR in IIS? By default, a new site in IIS utilizes the IUSR account for accessing files. This account is a built-in shared account typically used by IIS to access file content. This means that it will use the application pool's identity (user) to access file content.
{% endhint %}

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2Fv0oW7Tsz48gg2iykM3Tk%2Fimage.png?alt=media&#x26;token=c8c62f0a-314f-4ef2-86a6-61babec0d27f" alt=""><figcaption><p>Authorization rule</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2Fu0mHAnXiC6URB2FZRSvK%2Fimage.png?alt=media&#x26;token=9e925f1f-4a23-45d1-bf69-3aaaad501339" alt=""><figcaption><p>Authentication configuration</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FnGkrJhEcN0duN7q6joHP%2Fimage.png?alt=media&#x26;token=f3ed5797-f73a-4bc4-abcf-ed60c1e419ef" alt=""><figcaption><p>Advanced settings</p></figcaption></figure>

### Setup Telnet Server

* Here, I used Telnet to connect to the Internal Client (IC). On my device, I enabled the Telnet Client feature to establish a connection to the Telnet server. For the IC, I utilized Pragma Telnet Server as the Telnet server software.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FRjmZTID9JitYdkbSJVzL%2Fimage.png?alt=media&#x26;token=1e90f146-f479-4324-95a7-b92e150a4bd7" alt=""><figcaption><p>Windows Features</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FFkk1j3m8HEop5ARXzmIh%2Fimage.png?alt=media&#x26;token=3034b5a4-113c-4bbe-9e39-8f108a08a43f" alt=""><figcaption><p>GUI Pragma Telnet Server</p></figcaption></figure>

### Setup TightVNC Server

* TightVNC offers configurations for both clients and servers. It only requires installation and setup to run effectively.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FeQRWGvIYZna5KjejKhsi%2Fimage.png?alt=media&#x26;token=6dbb2527-5ef2-4d4a-be02-76c4a215a5ec" alt=""><figcaption><p>TightVNC Server</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F1eJjAJe4SWAGZBey4aAK%2Fimage.png?alt=media&#x26;token=21c5c981-b5f3-48de-b739-0b4405c71bfa" alt=""><figcaption><p>TightVNC Client</p></figcaption></figure>

## Result

### Establish a VPN connection and ping the Internal Client (IC).

* First, I imported the certificate and entered the account details.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F22CRFVBvgrqcW1AlQdUD%2Fimage.png?alt=media&#x26;token=b4f5202f-4292-4f59-b4b4-a13be74a2558" alt=""><figcaption><p>My Profile</p></figcaption></figure>

* Login successfully

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FmxI5rIWRJOPOtADHXN0w%2Fimage.png?alt=media&#x26;token=221f1624-023f-45d3-bd7a-a1f14172abf0" alt=""><figcaption><p>IP after login</p></figcaption></figure>

* Ping to local successfully

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2Fq8q8cwxsDIBr0kpjTOSO%2Fimage.png?alt=media&#x26;token=1af5a5a2-d0f6-405c-87d6-c957338ff87b" alt=""><figcaption><p>Ping to IC</p></figcaption></figure>

### Connecting to the Internal Website and Accessing File Sharing

#### Website

* If VPN is not connected, accessing the website will not be possible.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F0XI8gUI87xJ5QRJPAbXQ%2Fimage.png?alt=media&#x26;token=42c5bb06-dae5-4d49-89e9-d301bdda649f" alt=""><figcaption><p>Connect fail</p></figcaption></figure>

* If connected to the VPN, I can access the website.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FkVk2U35XPCJ5NhwsqF9m%2Fimage.png?alt=media&#x26;token=8108e3b1-2830-4599-a4d4-45dc63b28a86" alt=""><figcaption><p>Connect successfully</p></figcaption></figure>

#### File Sharing

* On the server, I have stored several files that are shared for access.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FyX1xyjOPpn4hj5QxHowN%2Fimage.png?alt=media&#x26;token=c0571de9-c23a-4cdc-8138-eedd66da0307" alt=""><figcaption><p>FIles on Server</p></figcaption></figure>

* Connect to the shared folder and upload a file.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FFTx3uni5aUA2yjqWSlH5%2Fimage.png?alt=media&#x26;token=39c93778-c370-49e9-a57b-0671de90d68e" alt=""><figcaption><p>Connect successfully</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FwemQMFALJTgCb1FZknOc%2Fimage.png?alt=media&#x26;token=bb50082f-8fcf-4551-bd1e-12377e9d3dce" alt=""><figcaption><p>Upload new file</p></figcaption></figure>

* Verify the server and IC; both can access and view the uploaded file.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F4JnMB5S8ncidWioYAFx2%2Fimage.png?alt=media&#x26;token=c5bc5308-deba-4db9-97e5-201e7548783c" alt=""><figcaption><p>Server</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F5x5lzVmm2jO8w4w5aFMP%2Fimage.png?alt=media&#x26;token=65fdd40f-9979-4e55-9d50-d28871cfd9ce" alt=""><figcaption><p>IC</p></figcaption></figure>

### Use Telnet to establish a connection to the Internal Client (IC)

* Access the Internal Client (IC) using the designated account credentials

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FGhgk6BTLeecExH6qiKSt%2Fimage.png?alt=media&#x26;token=fcca3820-4e29-4db9-9891-38fefa5ea626" alt=""><figcaption><p>Local account</p></figcaption></figure>

* Establishing the initial connection to the Internal Client (IC).

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FDFToKUmcYmePF2nxiNds%2Fimage.png?alt=media&#x26;token=58a1d751-d5fb-43ba-8686-b081248bc71e" alt=""><figcaption><p>Initiate connection</p></figcaption></figure>

* Log in by entering the account credentials.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FBi3AtSUJjvroyQqIyY2O%2Fimage.png?alt=media&#x26;token=fb2aa86e-8702-467d-af47-a21b4f969607" alt=""><figcaption><p> The account credentials</p></figcaption></figure>

* Connect successfully

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FxgfIuUSROtgKaPAh925B%2Fimage.png?alt=media&#x26;token=0987d5df-e7de-4ef0-968e-514d12286306" alt=""><figcaption><p>Connect successfully</p></figcaption></figure>

### Utilize TightVNC to establish a remote desktop connection between the client and IC&#x20;

* Input the IP address of the Internal Client (IC) to initiate the connection.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FdbG5MYN2ot3ex3Oa7eVG%2Fimage.png?alt=media&#x26;token=a0f97968-3cb9-4ff4-9f9a-87e4a1afea41" alt=""><figcaption><p>IP of IC</p></figcaption></figure>

* Provide authentication credentials to log in.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FZDRHBI1xJMrzmpErlv3T%2Fimage.png?alt=media&#x26;token=7e72141b-9b70-4d3d-ad44-b9715954188d" alt=""><figcaption><p>Entered password</p></figcaption></figure>

* Connect successfully

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2Fb7TpbidsL1AJzG6fzebJ%2Fimage.png?alt=media&#x26;token=adfaa143-a7f9-44aa-af20-f56e93dc6b48" alt=""><figcaption><p>Connect successfully</p></figcaption></figure>

### **User Roles and Access Control in OpenVPN**

* To ensure secure and efficient access, I’ve assigned users to specific roles and groups based on their needs:

1. **Dream**: Can access web resources but is restricted from the FTP server.
2. **Haochientin**: Has limited access and cannot ping internal clients.
3. **Walter Drake**: Has full, unrestricted access to all resources.

* For easier management, these roles are grouped:
  * **Full Access Group**: For users like Walter Drake, with unrestricted access.
  * **Ping-Only Access Group**: For limited access users like Haochientin.
  * **Web-Access-Only Group**: For web-only users like Dream.
* On pfSense, I created three **Client Specific Overrides** for each user, assigning them specific IPs. This ensures that the correct rules are applied based on the user’s assigned IP.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FUpsR5kj0MG1482Ril4kQ%2Fimage.png?alt=media&#x26;token=b2b1d3a1-7e36-4b9f-bcd9-4c811cfe7648" alt=""><figcaption><p>New Overrides configure</p></figcaption></figure>

* In **Active Directory Users and Computers**, this setup streamlines permission management by assigning users to specific groups, enforcing secure and role-based access policies for each user based on their assigned group.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FJttujzwi0dYiCU1u7zDZ%2Fimage.png?alt=media&#x26;token=d729cc09-1a3f-4b9f-8ec0-fd59022c9103" alt=""><figcaption><p>New created groups</p></figcaption></figure>

* On the NPS, I replace old group is groupVPN with each new created group.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FoQSnZMA6qesFaEkHwVLw%2Fimage.png?alt=media&#x26;token=367cb803-a959-4aa1-a86e-08971e00196a" alt=""><figcaption><p>New NPS configuration</p></figcaption></figure>

**Web-Access-Only Group**

* For the **Web-Access-Only Group**, where user Dream is restricted from accessing the FTP server, I updated the configuration by changing the permissions from **All Anonymous Users** to **Specified Roles or User Groups**. This ensures that only authorized users can access FTP, effectively blocking Dream’s access as required.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FkNOmumzrNKj0adETex5l%2Fimage.png?alt=media&#x26;token=d1ffa3ac-3ef0-4065-a7e5-282c89d01be6" alt=""><figcaption><p>New authorization rule</p></figcaption></figure>

* With this configuration, users in other groups who want to access the FTP server must log in using their VPN account credentials. This is because both the VPN and FTP server authenticate using accounts created on the same Active Directory (AD). This unified authentication ensures consistency and security across both services.

#### Demo **Web-Access-Only Group**

* In this demo, **Dream** can still access the website, but when attempting to log in to the FTP server, the connection is refused. This demonstrates how access controls effectively restrict Dream's FTP access while allowing web access.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FeJ7lL7eGGkpNLNWwWGtd%2Fimage.png?alt=media&#x26;token=2d97e1b0-c7f1-4af8-8442-741aaebd33af" alt=""><figcaption><p>Acess Web site</p></figcaption></figure>

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FCpl5tho5eiylKOMXUfH9%2Fimage.png?alt=media&#x26;token=9c497131-c452-40f9-b18f-25f238dcd4ef" alt=""><figcaption><p>Login FTP Server</p></figcaption></figure>

* After pressing the login button, if the account is not authorized, the system returns to the login interface, indicating that access has been denied.&#x20;

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FRLfFyJrzBFLivzTgk3uc%2Fimage.png?alt=media&#x26;token=8715531d-904a-416e-85c6-180ebc597fe3" alt=""><figcaption><p>Connect Failed</p></figcaption></figure>

**Ping-Only Access Group**

* For the **Ping-Only Access** **Group**, I created two new rules on pfSense: one to block ping requests to the internal clients (IC) and another to prevent Telnet access to it.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FkrLnBn3KziZKs43P8IT1%2Fimage.png?alt=media&#x26;token=b9d3d788-76e7-44b8-a03f-56d4d27fecbc" alt=""><figcaption><p>New rules</p></figcaption></figure>

#### Demo **Ping-Only Access**

* The connection times out when pinging internal clients (IC) due to the pfSense rule rejecting ping requests for the **Ping-Only Access** group.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2F2Dqx3KmzxMM4ZBGNgb6Q%2Fimage.png?alt=media&#x26;token=721be13d-03ce-46c5-b17c-bce720dd1087" alt=""><figcaption><p>Time out connection</p></figcaption></figure>

* The telnet connection cannot be established.

<figure><img src="https://2286692835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa64n68OpFEaDLckQtB2P%2Fuploads%2FGnfE2DXyskqfqSELUoYL%2Fimage.png?alt=media&#x26;token=94fe307c-57bb-47cb-86f8-ede61f299e90" alt=""><figcaption><p>Initialization failed</p></figcaption></figure>

* This user can still log in to both the website and FTP server, as demonstrated in the previous image. I won’t repeat the details here.

**Full Access Group**

* In the **Full Access Group**, the new configurations above do not affect the accounts in this group, so I won’t repeat the details here.

## Resource

{% hint style="success" %}

* [OpenVPN](https://docs.netgate.com/pfsense/en/latest/recipes/index.html#openvpn)
* [Secure Your Network: pfSense + Active Directory + RADIUS-NAPS](https://www.youtube.com/watch?v=n-sbwQ0KMQI)
* [How To Install And Setup pfSense Firewall On VMware Workstation Pro](https://www.youtube.com/watch?v=Ayr_av2EX_U\&t)
* [How to Setup OpenVPN on pfSense for Remote Users](https://www.youtube.com/watch?v=gnJgbwZGB8M)
  {% endhint %}
