cfn-vpn 0.5.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build-gem.yml +25 -0
- data/.github/workflows/release-gem.yml +34 -0
- data/.github/workflows/release-image.yml +33 -0
- data/Gemfile.lock +33 -39
- data/README.md +1 -232
- data/cfn-vpn.gemspec +4 -4
- data/docs/README.md +44 -0
- data/docs/certificate-users.md +89 -0
- data/docs/getting-started.md +128 -0
- data/docs/modifying.md +67 -0
- data/docs/routes.md +98 -0
- data/docs/scheduling.md +32 -0
- data/docs/sessions.md +27 -0
- data/lib/cfnvpn.rb +31 -27
- data/lib/cfnvpn/{client.rb → actions/client.rb} +5 -6
- data/lib/cfnvpn/{embedded.rb → actions/embedded.rb} +15 -15
- data/lib/cfnvpn/actions/init.rb +144 -0
- data/lib/cfnvpn/actions/modify.rb +169 -0
- data/lib/cfnvpn/actions/params.rb +73 -0
- data/lib/cfnvpn/{revoke.rb → actions/revoke.rb} +6 -6
- data/lib/cfnvpn/actions/routes.rb +196 -0
- data/lib/cfnvpn/{sessions.rb → actions/sessions.rb} +5 -5
- data/lib/cfnvpn/{share.rb → actions/share.rb} +10 -10
- data/lib/cfnvpn/actions/subnets.rb +78 -0
- data/lib/cfnvpn/certificates.rb +5 -5
- data/lib/cfnvpn/clientvpn.rb +49 -65
- data/lib/cfnvpn/compiler.rb +23 -0
- data/lib/cfnvpn/config.rb +34 -78
- data/lib/cfnvpn/{cloudformation.rb → deployer.rb} +48 -20
- data/lib/cfnvpn/log.rb +26 -26
- data/lib/cfnvpn/s3.rb +34 -4
- data/lib/cfnvpn/s3_bucket.rb +48 -0
- data/lib/cfnvpn/string.rb +33 -0
- data/lib/cfnvpn/templates/helper.rb +14 -0
- data/lib/cfnvpn/templates/lambdas.rb +35 -0
- data/lib/cfnvpn/templates/lambdas/auto_route_populator/app.py +175 -0
- data/lib/cfnvpn/templates/lambdas/scheduler/app.py +36 -0
- data/lib/cfnvpn/templates/vpn.rb +449 -0
- data/lib/cfnvpn/version.rb +1 -1
- metadata +73 -23
- data/lib/cfnvpn/cfhighlander.rb +0 -49
- data/lib/cfnvpn/init.rb +0 -109
- data/lib/cfnvpn/modify.rb +0 -103
- data/lib/cfnvpn/routes.rb +0 -84
- data/lib/cfnvpn/templates/cfnvpn.cfhighlander.rb.tt +0 -27
data/lib/cfnvpn/routes.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'cfnvpn/log'
|
3
|
-
require 'cfnvpn/s3'
|
4
|
-
require 'cfnvpn/globals'
|
5
|
-
|
6
|
-
module CfnVpn
|
7
|
-
class Routes < Thor::Group
|
8
|
-
include Thor::Actions
|
9
|
-
include CfnVpn::Log
|
10
|
-
|
11
|
-
argument :name
|
12
|
-
|
13
|
-
class_option :profile, aliases: :p, desc: 'AWS Profile'
|
14
|
-
class_option :region, aliases: :r, default: ENV['AWS_REGION'], desc: 'AWS Region'
|
15
|
-
class_option :verbose, desc: 'set log level to debug', type: :boolean
|
16
|
-
|
17
|
-
class_option :add, desc: 'add cidr to route through the client vpn'
|
18
|
-
class_option :del, desc: 'delete cidr route from the client vpn'
|
19
|
-
class_option :desc, desc: 'description of the route'
|
20
|
-
|
21
|
-
def self.source_root
|
22
|
-
File.dirname(__FILE__)
|
23
|
-
end
|
24
|
-
|
25
|
-
def set_loglevel
|
26
|
-
Log.logger.level = Logger::DEBUG if @options['verbose']
|
27
|
-
end
|
28
|
-
|
29
|
-
def set_directory
|
30
|
-
@build_dir = "#{CfnVpn.cfnvpn_path}/#{@name}"
|
31
|
-
end
|
32
|
-
|
33
|
-
def add_route
|
34
|
-
if !@options['add'].nil?
|
35
|
-
if @options['desc'].nil?
|
36
|
-
Log.logger.error "--desc option must be provided if adding a new route"
|
37
|
-
exit 1
|
38
|
-
end
|
39
|
-
|
40
|
-
vpn = CfnVpn::ClientVpn.new(@name,@options['region'])
|
41
|
-
|
42
|
-
if vpn.route_exists?(@options['add'])
|
43
|
-
Log.logger.error "route #{@options['add']} already exists in the client vpn"
|
44
|
-
exit 1
|
45
|
-
end
|
46
|
-
|
47
|
-
Log.logger.info "Adding new route for #{@options['add']}"
|
48
|
-
vpn.add_route(@options['add'],@options['desc'])
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def del_route
|
53
|
-
if !@options['del'].nil?
|
54
|
-
vpn = CfnVpn::ClientVpn.new(@name,@options['region'])
|
55
|
-
|
56
|
-
if !vpn.route_exists?(@options['del'])
|
57
|
-
Log.logger.error "route #{@options['del']} doesn't exist in the client vpn"
|
58
|
-
exit 1
|
59
|
-
end
|
60
|
-
delete = yes? "Delete route #{@options['del']}?", :yellow
|
61
|
-
if delete
|
62
|
-
Log.logger.info "Deleting route for #{@options['del']}"
|
63
|
-
vpn.del_route(@options['del'])
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def get_routes
|
69
|
-
vpn = CfnVpn::ClientVpn.new(@name,@options['region'])
|
70
|
-
@routes = vpn.get_routes()
|
71
|
-
end
|
72
|
-
|
73
|
-
def display_routes
|
74
|
-
rows = @routes.collect do |s|
|
75
|
-
[ s.destination_cidr, s.description, s.status.code, s.target_subnet, s.type, s.origin ]
|
76
|
-
end
|
77
|
-
table = Terminal::Table.new(
|
78
|
-
:headings => ['Route', 'Description', 'Status', 'Target', 'Type', 'Origin'],
|
79
|
-
:rows => rows)
|
80
|
-
puts table
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
CfhighlanderTemplate do
|
2
|
-
|
3
|
-
Parameters do
|
4
|
-
ComponentParam 'EnvironmentName'
|
5
|
-
ComponentParam 'AssociationSubnetId'
|
6
|
-
ComponentParam 'ClientCidrBlock'
|
7
|
-
ComponentParam 'DnsServers'
|
8
|
-
ComponentParam 'SplitTunnel'
|
9
|
-
ComponentParam 'InternetRoute'
|
10
|
-
ComponentParam 'Protocol'
|
11
|
-
ComponentParam 'ServerCertificateArn'
|
12
|
-
ComponentParam 'ClientCertificateArn'
|
13
|
-
end
|
14
|
-
|
15
|
-
Component template: 'client-vpn@<%= @config['template_version'] %>', name: 'vpn', render: Inline do
|
16
|
-
parameter name: 'EnvironmentName', value: Ref('EnvironmentName')
|
17
|
-
parameter name: 'AssociationSubnetId', value: Ref('AssociationSubnetId')
|
18
|
-
parameter name: 'ClientCidrBlock', value: Ref('ClientCidrBlock')
|
19
|
-
parameter name: 'DnsServers', value: Ref('DnsServers')
|
20
|
-
parameter name: 'SplitTunnel', value: Ref('SplitTunnel')
|
21
|
-
parameter name: 'InternetRoute', value: Ref('InternetRoute')
|
22
|
-
parameter name: 'Protocol', value: Ref('Protocol')
|
23
|
-
parameter name: 'ServerCertificateArn', value: Ref('ServerCertificateArn')
|
24
|
-
parameter name: 'ClientCertificateArn', value: Ref('ClientCertificateArn')
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|