cfn-vpn 0.5.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build-gem.yml +25 -0
  3. data/.github/workflows/release-gem.yml +34 -0
  4. data/.github/workflows/release-image.yml +33 -0
  5. data/Gemfile.lock +33 -39
  6. data/README.md +1 -247
  7. data/cfn-vpn.gemspec +4 -4
  8. data/docs/README.md +44 -0
  9. data/docs/certificate-users.md +89 -0
  10. data/docs/getting-started.md +128 -0
  11. data/docs/modifying.md +67 -0
  12. data/docs/routes.md +98 -0
  13. data/docs/scheduling.md +32 -0
  14. data/docs/sessions.md +27 -0
  15. data/lib/cfnvpn.rb +31 -27
  16. data/lib/cfnvpn/{client.rb → actions/client.rb} +5 -6
  17. data/lib/cfnvpn/{embedded.rb → actions/embedded.rb} +15 -15
  18. data/lib/cfnvpn/actions/init.rb +144 -0
  19. data/lib/cfnvpn/actions/modify.rb +169 -0
  20. data/lib/cfnvpn/actions/params.rb +73 -0
  21. data/lib/cfnvpn/{revoke.rb → actions/revoke.rb} +6 -6
  22. data/lib/cfnvpn/actions/routes.rb +196 -0
  23. data/lib/cfnvpn/{sessions.rb → actions/sessions.rb} +5 -5
  24. data/lib/cfnvpn/{share.rb → actions/share.rb} +10 -10
  25. data/lib/cfnvpn/actions/subnets.rb +78 -0
  26. data/lib/cfnvpn/certificates.rb +5 -5
  27. data/lib/cfnvpn/clientvpn.rb +49 -65
  28. data/lib/cfnvpn/compiler.rb +23 -0
  29. data/lib/cfnvpn/config.rb +34 -78
  30. data/lib/cfnvpn/{cloudformation.rb → deployer.rb} +47 -19
  31. data/lib/cfnvpn/log.rb +26 -26
  32. data/lib/cfnvpn/s3.rb +34 -4
  33. data/lib/cfnvpn/s3_bucket.rb +48 -0
  34. data/lib/cfnvpn/string.rb +33 -0
  35. data/lib/cfnvpn/templates/helper.rb +14 -0
  36. data/lib/cfnvpn/templates/lambdas.rb +35 -0
  37. data/lib/cfnvpn/templates/lambdas/auto_route_populator/app.py +175 -0
  38. data/lib/cfnvpn/templates/lambdas/scheduler/app.py +36 -0
  39. data/lib/cfnvpn/templates/vpn.rb +449 -0
  40. data/lib/cfnvpn/version.rb +1 -1
  41. metadata +73 -23
  42. data/lib/cfnvpn/cfhighlander.rb +0 -49
  43. data/lib/cfnvpn/init.rb +0 -109
  44. data/lib/cfnvpn/modify.rb +0 -103
  45. data/lib/cfnvpn/routes.rb +0 -84
  46. 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