-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b44d0f0
commit 0429ed7
Showing
8 changed files
with
413 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# CfnVpn for AWS Client-VPN | ||
|
||
`cfn-vpn` is a wrapper around [AWS Client-VPN](https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/what-is.html) to improve the management experience of the VPN. The tool utilises Cloudformation to manage the AWS resources required by the Client-VPN and automates the certificate management process with the [openvpn/easy-rsa](https://github.com/OpenVPN/easy-rsa) library. | ||
|
||
## VPN Scenarios | ||
|
||
For further AWS documentation please visit https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/scenario.html | ||
|
||
### Split Tunnel | ||
|
||
Split tunnel when enabled will only push the routes defined on the client vpn. This is useful if you only want to push routes from your vpc through the vpn. | ||
|
||
### Public Subnet with Internet Access | ||
|
||
This can be setup with default options selected. This will push all routes from through the vpn including all internet traffic. The ENI attached to the vpn client attaches a public IP which is used for natting between the vpn and the internet. This must be placed inside a public subnet with a internet gateway attached to the vpc. | ||
Please read the AWS [documentation](https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/scenario-internet.html) for troubleshooting any networking issues | ||
|
||
### Private Subnet with Internet Access | ||
|
||
This is the same as above but the vpn attached to a subnet in a private subnet with the public route being routed through a nat gateway. **NOTE** the dns on the vpn must be set to the dns server of the vpc you've attached the vpn to, the reserved IP address at the base of the VPC IPv4 network range plus two. For example if you VPC cidr is 10.0.0.0/16 then the dns server for that vpc is 10.0.0.2. | ||
|
||
```bash | ||
cfn-vpn init myvpn --bucket mybucket --server-cn myvpn.domain.tld --subnet-id subnet-123456ab --dns-servers 10.0.0.2 | ||
``` | ||
|
||
If you are experiencing issue connecting to the internet check to see if your local dns configurations are overriding the ones set by the vpn. You can test this by using `dig` to query a domain from the vpc dns server. For example: | ||
|
||
```bash | ||
dig @10.0.0.2 google.com | ||
``` | ||
|
||
## Authentication Types | ||
|
||
`cfn-vpn` supports certificate and federated type authentication for AWS Client-VPN. It currently doesn't support Active Directory type authentication. | ||
For further information on the authentication types please visit https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/client-authentication.html | ||
|
||
## CfnVpn Documentation | ||
|
||
1. [Getting Started](getting-started.md) | ||
2. [Modifying The Client-VPN](modifying.md) | ||
3. [Managing Certificate Users](certificate-users.md) | ||
4. [Managing Routes](routes.md) | ||
5. [Stop and Start Client-VPN](scheduling.md) | ||
6. [Managing Sessions](sessions.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Managing Certificate Authenticated Users | ||
|
||
This section explains how to generate, revoke VPN clients and share config the config with the users | ||
|
||
## Create a new user | ||
|
||
This will generate a new client certificate and key against the CA generated in the `init`. | ||
It will be bundled into a tar and stored encrypted in your provided s3 bucket. | ||
|
||
``` | ||
cfn-vpn client myvpn --client-cn user1 --bucket mybucket | ||
``` | ||
|
||
|
||
## Revoke a user | ||
|
||
This will revoke the client certificate and apply to the client VPN endpoint. | ||
Note this wont terminate the session but will stop the client from reconnecting using the certificate. | ||
|
||
```sh | ||
cfn-vpn revoke myvpn --client-cn user1 --bucket mybucket | ||
``` | ||
|
||
## Modify the Client VPN config | ||
|
||
This will modify some attributes of the client vpn endpoint. | ||
|
||
```sh | ||
cfn-vpn config myvpn --dns-servers 8.8.8.8 8.8.4.4 | ||
``` | ||
|
||
*Options:* | ||
|
||
```bash | ||
[--cidr=CIDR] # cidr from which to assign client IP addresses | ||
# Default: 10.250.0.0/16 | ||
[--dns-servers=DNS_SERVERS] # DNS Servers to push to clients. | ||
[--split-tunnel], [--no-split-tunnel] # only push routes to the client on the vpn endpoint | ||
[--internet-route], [--no-internet-route] # create a default route to the internet | ||
# Default: true | ||
[--protocol=PROTOCOL] # set the protocol for the vpn connections | ||
# Default: udp | ||
# Possible values: udp, tcp | ||
``` | ||
|
||
|
||
## Share client certificates with a user | ||
|
||
The users vpn config and certificates can be passed to the user securely using S3 signed URLs to allow the user to directly download them. | ||
There are 2 ways to generate the vpn config file, by having the certificates and config file separate or by embedding the certificates into the config file. | ||
|
||
|
||
### Certificate embedded into config | ||
|
||
This will pull the clients certificate and key archives from S3 and embed them into the config file, upload it back to S3 and generate a presigned URL for the user. | ||
This allows the you to download or share a single, ready to import config file into a OpenVPN client. | ||
|
||
```sh | ||
cfn-vpn embedded myvpn --client-cn user1 --bucket mybucket | ||
``` | ||
|
||
### Separate certificate and config | ||
|
||
This will generate a presigned url for the client's certificate and config file to allow them to download them to their local computer. | ||
|
||
```sh | ||
cfn-vpn share myvpn --client-cn user1 --bucket mybucket | ||
``` | ||
|
||
You can then share the output with your user | ||
|
||
``` | ||
Download the certificates and config from the bellow presigned URLs which will expire in 1 hour. | ||
Certificate: | ||
<presigned url> | ||
Config: | ||
<presigned url> | ||
Extract the certificates from the tar and place into a safe location. | ||
tar xzfv user1.tar.gz -C <path> | ||
Modify base2-ciinabox.config.ovpn to include the full location of your extracted certificates | ||
echo "key /<path>/user1.key" >> myvpn.config.ovpn | ||
echo "cert /<path>/user1.crt" >> myvpn.config.ovpn | ||
Open myvpn.config.ovpn with your favourite openvpn client. | ||
``` |
Oops, something went wrong.