1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
====================
openvpn3-service-aws
====================
---------------------------------------------
OpenVPN 3 Linux - AWS VPC integration service
---------------------------------------------
:Manual section: 8
:Manual group: OpenVPN 3 Linux
SYNOPSIS
========
| ``openvpn3-service-aws`` ``[OPTIONS]``
| ``openvpn3-service-aws`` ``-h`` | ``--help``
DESCRIPTION
===========
The ``openvpn3-service-aws`` is a backend service for OpenVPN 3 Linux,
which enables hosts in VPN subnet to communicate to hosts in VPC subnet.
Upon start, it reads its configuration file and subscribes to
:code:`ROUTE_ADDED` and :code:`ROUTE_REMOVED` signals from
``openvpn3-service-netcfg`` service. On receiving those signals, this helper
service will add and delete VPN routes to/from VPC subnet using Amazon EC2
API. The service is able to add routes to a different route table (not "main"),
which can be created on demand.
This service is normally started automatically on boot, which is achieved by enabling it
with provided **openvpn3-aws.service** *systemd* unit file. This process will run as the
*@OPENVPN_USERNAME@* user and will automatically switch to this user account if it has the
needed privileges to do so. Beware that changing this to another user account will require
updating the D-Bus policy for the ``net.openvpn.v3.aws`` service as well.
CONFIGURATION
=============
To use Amazon EC2 API, service uses temporary security credentials, which are retrieved from
instance metadata. Credentials are tied to an IAM role, which must be assigned to the EC2
instance where the service is running.
Below is a part of a CloudFormation template, which creates role and instance profile:
::
"RouteManagerRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"ec2.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
},
"Policies": [
{
"PolicyName": "RouteManagerPolicy",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:CreateRoute",
"ec2:DescribeNetworkInterfaceAttribute",
"ec2:DescribeNetworkInterfaces",
"ec2:DescribeRouteTables",
"ec2:ModifyNetworkInterfaceAttribute",
"ec2:ReplaceRoute",
"ec2:DeleteRoute"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ec2messages:GetMessages",
"ssm:UpdateInstanceInformation",
"ssm:ListInstanceAssociations",
"ssm:ListAssociations",
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel"
],
"Resource": "*"
}
]
}
}
]
}
},
"InstanceProfile": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"Roles": [
{
"Ref": "RouteManagerRole"
}
]
}
}
If you want service to create route table, you need to add following actions to policy:
::
"ec2:CreateRouteTable",
"ec2:CreateTags"
An instance profile must be associated with the instance:
::
"Resources": {
"EC2Instance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"IamInstanceProfile": {
"Ref": "InstanceProfile"
}
}
}
}
In order to retrieve the credentials needed, the ``openvpn3-service-aws``
service requires a role name, which is read from the configuration file
(:code:`/etc/openvpn/openvpn3-aws.json`). Here is a CloudFormation
snippet which creates this file:
::
"Metadata": {
"AWS::CloudFormation::Init": {
"config": {
"files": {
"/etc/openvpn3/openvpn3-aws.json": {
"content": {
"Fn::Join": [
"",
[
"{\n",
"\"role\": \"",
{
"Ref": "RouteManagerRole"
},
"\"\n",
"}\n"
]
]
},
"mode": "000644",
"owner": "root",
"group": "root"
}
}
}
}
}
Below is an example of configuration file, generated by the script above:
::
{
"role": "lev1-RouteManagerRole-1QGQ76R9S4C11"
}
To add routes to another route table, you need to specify the name in the config. For example:
::
{
"role": "RouteManagerRole",
"route-table-name": "OpenVPN3-Linux-AWS-Route"
}
OPTIONS
=======
-h, --help Print usage and help details to the terminal
--version Prints the version of the program and exists
-c FILE, --config FILE
Path of configuration file from where role name is read.
The default is :code:`/etc/openvpn/openvpn3-aws.json`.
--log-level LEVEL
Sets the default log verbosity for log events generated by
this service. The default is :code:`3`. Valid values are
:code:`0` to :code:`6`. Higher log levels results in more
verbose logs and log level :code:`6` will contain all debug
log events.
--log-file LOG_DESTINATION
By default, logging will go via the ``openvpn3-service-log``
service. By providing this argument, logging will also be sent
to *LOG_DESTINATION*, which can be either a filename or
:code:`stdout:` where the latter one sends log data to the
console.
--colour
This will add colours to log events when logging to file
or console. Log events will be coloured based on the log
level of the event.
SEE ALSO
========
``openvpn3-linux``\(7)
``openvpn3-service-netcfg``\(8)
|