Nova automates the setup of a VPN server using Terraform, Ansible, Bash, and Python3 on OpenStack, with optional DNS management via Cloudflare. The project simplifies VPN deployment and configuration through a unified automation script, handling everything from infrastructure provisioning to domain setup.
- Prerequisites
- Setup Instructions
- Usage
- Verify Installation
- Environment Configuration
- Detailed Configuration Steps
- Troubleshooting
Before you begin, ensure the following software is installed on your system:
You will also need accounts for:
- OpenStack (for infrastructure)
- Cloudflare (if using domain-based setup)
-
Clone the repository to your local machine:
git clone https://github.com/0xAFz/nova.git cd nova/
-
Copy the
.env.example
file to.env
:cp .env.example .env
-
Edit the
.env
file and replace the placeholders with actual values (refer to the Environment Configuration section). -
Make the
nova.sh
script executable:chmod +x nova.sh
-
You are now ready to run the script and deploy the VPN server!
Nova supports two main operations: up
and down
.
-
To start and deploy the VPN server, run:
./nova.sh up
This will:
- Initialize Terraform and create the infrastructure.
- Set up the server with VPN capabilities.
- Optionally configure DNS records through Cloudflare (if a domain is provided).
-
To destroy the VPN server and associated resources, run:
./nova.sh down
- Check 3x-ui service status
systemctl status x-ui
- Check Open ports
ss -ntlp
- Open 3x-UI panel in browser
Warning
For the security reasons, we blocked all public traffic to panel
You should open a SSH
tunnel between local machine and server
# forwarding local port 8080 to server 127.0.0.1:2053
ssh -L 8080:127.0.0.1:2053 user@ip
# now you can open this url in your browser
http://localhost:8080
Note
To be able to do SSH port forwarding, you must allow tcp forwarding AllowTcpForwarding yes
in /etc/ssh/sshd_config
By default we enabled it in the preparing tasks
The .env
file contains crucial environment variables needed for the project. You must update the placeholder values with your actual credentials and information.
The variables in .env
are used across the Terraform, Ansible, and Python scripts to automate the setup. Ensure that all values are accurate before running the automation.
-
XUI Panel Credentials:
- Set the username and password you want for the XUI panel.
- Specify the port for the XUI panel (e.g.,
2053
).
-
Domain and Cloudflare Setup (Optional):
- If you are using a domain with Cloudflare, fill in your Cloudflare email, API key, and Zone ID. Leave
DOMAIN
empty if you’re not using DNS.
- If you are using a domain with Cloudflare, fill in your Cloudflare email, API key, and Zone ID. Leave
-
OpenStack Configuration:
- Replace the placeholders with your OpenStack credentials, which can be obtained from the OpenStack dashboard or the OpenRC file.
-
SSH and VM Configuration:
- Ensure the path to your SSH public key is correct (usually
~/.ssh/id_rsa.pub
). - Specify the name, image, flavor, and network for the VM that will be created.
- Ensure the path to your SSH public key is correct (usually
To use DNS management via Cloudflare:
- Log into your Cloudflare account.
- Go to My Profile > API Tokens.
- Create a new API token with DNS edit permissions.
- Copy the API key, email, and Zone ID into the
.env
file.
Reference: Cloudflare API Documentation
To obtain OpenStack credentials:
- Log into the OpenStack dashboard.
- Go to Access & Security > API Access and download the OpenRC file.
- Source the OpenRC file and copy the values into your
.env
file.
Alternatively, use the OpenStack CLI:
openstack credentials show
Reference: OpenStack CLI Documentation
If you don’t already have an SSH key pair:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
This will generate id_rsa
(private key) and id_rsa.pub
(public key) in your ~/.ssh/
directory.
- General Failures: Check the error messages and logs to understand the cause of the failure.
- Environment Variables: Ensure all values in the
.env
file are correct. - SSH Issues: Verify that your SSH key pair is generated correctly and located in the right directory (
~/.ssh/id_rsa.pub
). - Cloudflare DNS: If using a domain, confirm that your DNS records are correctly set up in Cloudflare.
- Permissions: Ensure that your OpenStack and Cloudflare accounts have the necessary permissions.