HyperCloud Gateway Appliance
Overview
The HyperCloud Gateway Appliance provides a high performance, lightweight
appliance for the purpose of functioning as a router, firewall, or VPN endpoint
in a small virtual machine. The intent is for the appliance to be used inside a
tenant network where a virtual router / firewall / appliance such as the Cisco ASAv
would normally be used.
High Level Features
- Packet Forwarding (Routing) (IPv6 and IPv4)
- Firewall (IPv6 and IPv4)
- VPN Endpoint Compatible with the following clients:
- OpenConnect
- Cisco AnyConnect
- NTP Daemon (Defaults to
time.nist.gov
, but can be updated usingSTARTUPSCRIPT
) - Recursive DNS Service (Using configured name servers from Network Contextualization)
- High availability using Virtual Router Redundancy Protocol when deployed in a pair
- IPsec Tunnel Service
Supported VM Attributes and Usage
All of the below are optional attributes:
FQDN
Set to already-added DNS FQDN of a PUBLICLY REACHABLE IPv4 and/or IPv6 address if you want to use Let's Encrypt rather than a self-signed certificate for VPN access.
Info
Use the IP address of the static IP assigned to the appliance, not the floating IP if using high availability.
Each Appliance functions as an individual unit in VPN gateway mode. Either can be used as a VPN gateway and the VPN client can be configured to connect to both in a fail over configuration.
VPNUSERS
Set to base64-encoded, space-delimited, username:password of all VPN users. This attribute is reread and applied every one minute. Passwords cannot contain ":" or " " characters.
Example
kvanalstyne:P@$$word spercle:)(@#KDSL23l45
as a3ZhbmFsc3R5bmU6UEAkJHdvcmQgc3BlcmNsZTopKEAjS0RTTDIzbDQ1Cg==
STARTUPSCRIPT
Set to a base64 encoded script to run on boot. This can include anything, but examples include:
- iptables / ip6tables rules to supplement the orchestrator's security groups.
- Addition of SSH keys to
/home/root/.ssh/authorized_keys
for service accounts to scan the appliance. - Enabling IPv6 packet forwarding.
- Creation of
/etc/ocserv/ocpasswd
embedding hashed passwords rather than clear text so that the administrator cannot read the obfuscated user passwords. - Creation of iptables / ip6tables NAT rules if using as a NAT router.
- Configuration of RADIUS for VPN users rather than the local user database. (See SPECIAL NOTES below.)
- Configuration of IPsec Tunnels, sometimes called Site-to-Site or LAN-to-LAN tunnels. (See SPECIAL NOTES below.)
- Peer IPs
- Set to a list of pair router IP addresses in space-delimited format if deployed in a high availability pair. Include static IPs of pair node's interfaces you want to configure
VRRP
for. Be sure to complete this on both nodes in the HA pair.
Ports and Protocols
-
22/tcp
Required to be allowed inbound on public interface if SSH management desired.
-
53/tcp
Required to be allowed on internal interfaces to allow for DNS resolution. MUST be BLOCKED on any external interfaces.
-
53/udp
Required to be allowed on internal interfaces to allow for DNS resolution. MUST be BLOCKED on any external interfaces.
-
80/tcp
Required to be allowed inbound on public interface if using Let's Encrypt for SSL certificate issuance.
-
123/udp
Required to be allowed on internal interfaces to allow for NTP services. MUST be BLOCKED on any external interfaces.
-
443/tcp
Required to be allowed inbound on public interface if using as VPN endpoint.
-
443/udp
Required to be allowed inbound on public interface if using as VPN endpoint. (For DTLS tunnel.)
-
ICMP
Recommended to be allowed inbound on all interfaces to allow for network troubleshooting, path MTU discovery, etc.
-
ICMPv6
Recommended to be allowed inbound on all interfaces to allow for network troubleshooting, path MTU discovery, etc.
-
ALL
Required between high availability pair nodes to allow for the Virtual Router Redundancy Protocol (VRRP) to function properly.
-
ALL
Required from source IP addresses used for IPsec tunnels in order for IPsec to function properly.
Danger
Use extreme caution not to expose internal-only services such as NTP and recursive DNS to the internet!
The easiest way to accomplish this is to create a security group dedicated to outside traffic of both appliances and update to allow ALL traffic between only the IP address pairs assigned to the interfaces once instantiated.
System Requirements
- 1 vCPU
- 1 GB RAM
- ~150 MB for OS Boot Disk
- 1 GB Data Disk
Resource guidance
These are just a minimum. Scale RAM and CPU as needed for user base. Our guidance here is approximately 1 vCPU and 1 GB RAM per 100 users.
Data disk is only required if using Let's Encrypt, to store certificate state data OR if retention of SSH key and/or log data is desired.
Usage
- Import appliance from HyperCloud Marketplace
- From the UI, navigate to Templates, then Virtual Routers, then select the appliance Virtual Router template and click "Update". Update resources for appliance based on system requirements above, being sure to attach a blank 1 GB disk if desired if not already done in the template.
- Create security groups for all networks that you want to protect -- these act as the firewall rules for the appliance. Note the ports and protocols above based on your usage.
- From the UI, navigate back to the template via the steps mentioned in step 2 and then click "+" and then click "Instantiate".
- Attach public network interface as the FIRST interface and all subsequent interfaces after the public interface, attaching the security groups created in step 3. Be sure to check the "Floating IP" box if deploying in an HA pair, otherwise HA will NOT work.
-
Complete the "name" and "virtual machine name" fields. Be sure number of instances is set to "2" if deploying in an HA pair.
Info
Click the "Start on Hold" box to allow for attribute and DNS configuration prior to first boot.
-
Deploy the Virtual Router
- Create VM attributes, based on VM attribute usage information above. None are included by default, as all are optional.
- If using Let's Encrypt, be sure to create DNS entries with the value of the FQDN attribute before deploying/releasing the VM from hold.
- If using as a virtual router for other networks, once instantiated be sure to notate the assigned IP address and update the other virtual networks with the appliance IP as the gateway address.
- Be sure to populate the
PEERIPS
of each node before deploying/releasing the VM from hold.
- Be sure to populate the
- Be sure to check the
STARTUPSCRIPT
attribute if using appliance as a VPN endpoint or NAT router especially. You will very likely need to write a startup script and encode with with "base64".
- "Release" the VMs individually.
RADIUS Configuration
Add these to STARTUPSCRIPT
:
RADIUS_SERVER_IP=RADIUS.SERVER.IP.ADDRESS
sed -i "s_localhost_${RADIUS_SERVER_IP}_g" /etc/radcli/radiusclient.conf
echo "${RADIUS_SERVER_IP} SECRET" >> /etc/radcli/servers
echo 'eJyVW1tv27gSfmZ+BYE8bBeoUkvydYEFjms7bXYdx8d20t19U2Ta0Yks6eiS1ufXnxlSF8oaxW5QoI34cUh+MxzODNnrq2v+GG2dVGz5aPCp0/9k2jwNue+9ecE+ScPAiJ2tlyWGddMx+cH7byb85F+ul6RxGNwE/tX11TXbvHgJ33m+4G4YpI4XJHzruakXBk585GnsBInv4K+ACmMeOXEC0qFjLEBekibcCbZ8LwIRAyzY81gkEaBFcsP52PeVCMdVIpxYQFc3PERhAtMOd3ycprH3nKXi05PjZ4IvHS/GrpsXwd/kFwAJx33hToEECTDnJBKut/NAipPwMJC4Lgc6HJ4eIzk8SPS22icc/je5aqAA52rwjmH1bB66qUgTlBu9dZ3tNjZAlPrIvYAHIv0exq/8+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nlOL5ass4SP+pwctLA4DCCU/YCTv4nWN4UEGk/xaSsE7xORTIF/ZJhjL4KtvjFnuZ6u7jSaXf/B2PAqTxIOM8dcb4ra9/g60SshsS/19egeYN2tPQ2upoG2/263xYLTo1r2wG74g1UbrXdhN3uRW3frvdiOfmWK3gWpv3LG29cvfnHJ7+HP98NUWjjd6d5rN55fqe/fMNInnmKrfsN7vmg8xanZOjeqmkezrN4i6MTTuMPPvw6v/A+kvpF0=' | base64 -d | openssl zlib -d > /etc/radcli/dictionary
sed -i 's_plain\[passwd=/etc/ocserv/ocpasswd\]_radius \[config=/etc/radcli/radiusclient.conf,groupconfig=true\]_g' /etc/ocserv/ocserv.conf
kill $(ps -efww | grep -i ocs | grep -v hypercloud | grep '1 0' | awk '{print $2}')
IPsec Tunnel Configuration
Add these to STARTUPSCRIPT
:
- Write out
/etc/swanctl/conf.d/swanctl.conf
(examples below) - Start
strongSwan
:sleep 10 && ipsec start && sleep 10 && swanctl --load-all
-
If using NAT behind the tunnel, be sure to omit IPsec traffic from the NAT rule!
iptables -t nat -I POSTROUTING -m policy --pol ipsec --dir out -j ACCEPT
Left Side Configuration
# cat << _EOF_ > /etc/swanctl/conf.d/swanctl.conf
connections {
gw-gw {
local_addrs = 97.107.236.177
remote_addrs = 97.107.236.180
local {
auth = psk
id = testsitea
}
remote {
auth = psk
id = testsiteb
}
children {
net-net {
local_ts = 100.127.255.0/24
remote_ts = 192.168.255.0/24
start_action = start
updown = /libexec/ipsec/_updown
rekey_time = 5400
rekey_bytes = 500000000
rekey_packets = 1000000
}
}
version = 2
mobike = no
reauth_time = 10800
}
}
secrets {
ike-1 {
id-1 = testsitea
secret = testsitepassword
}
ike-2 {
id-2 = testsiteb
secret = testsitepassword
}
}
_EOF_
Right Side Configuration
# cat << _EOF_ > /etc/swanctl/conf.d/swanctl.conf
connections {
gw-gw {
local_addrs = 97.107.236.180
remote_addrs = 97.107.236.177
local {
auth = psk
id = testsiteb
}
remote {
auth = psk
id = testsitea
}
children {
net-net {
local_ts = 192.168.255.0/24
remote_ts = 100.127.255.0/24
start_action = start
updown = /libexec/ipsec/_updown
rekey_time = 5400
rekey_bytes = 500000000
rekey_packets = 1000000
}
}
version = 2
mobike = no
reauth_time = 10800
}
}
secrets {
ike-1 {
id-1 = testsitea
secret = testsitepassword
}
ike-2 {
id-2 = testsiteb
secret = testsitepassword
}
}
Customer IKEv1 to Juniper
# cat << _EOF_ > /etc/swanctl/conf.d/swanctl.conf
connections {
gw-site1 {
local_addrs = 38.68.193.87
remote_addrs = 159.121.170.66
local {
auth = psk
id = 38.68.193.87
}
remote {
auth = psk
id = 159.121.170.66
}
children {
net1-site1 {
local_ts = 10.80.0.0/20
remote_ts = 10.34.84.0/24, 172.23.84.0/24
start_action = trap
updown = /libexec/ipsec/_updown
rekey_time = 5400
rekey_bytes = 500000000
rekey_packets = 1000000
esp_proposals = aes256-sha
}
}
version = 1
proposals = aes256-sha-modp1536
mobike = no
reauth_time = 28800
}
gw-site2 {
local_addrs = 38.68.193.87
remote_addrs = 199.201.92.35
local {
auth = psk
id = 38.68.193.87
}
remote {
auth = psk
id = 199.201.92.35
}
children {
net1-site2 {
local_ts = 10.80.0.0/20
remote_ts = 10.34.82.0/24, 172.23.82.0/24
start_action = trap
updown = /libexec/ipsec/_updown
rekey_time = 5400
rekey_bytes = 500000000
rekey_packets = 1000000
esp_proposals = aes256-sha
}
}
version = 1
proposals = aes256-sha-modp1536
mobike = no
reauth_time = 28800
}
}
secrets {
ike-1 {
id-1 = 38.68.193.87
id-2 = 159.121.170.66
id-3 = 199.201.92.35
secret = "Put your super-duper secret key here!"
}
}