train-awsssm 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87fb6b7111f611cc31aea97504e8617c055a696bd5f60b64a4a684454436d83a
4
- data.tar.gz: d9756ffccc53b4e438b7f5e8acc5b11d2c477d20360531bf2829e7a3e472b3e4
3
+ metadata.gz: c80692d5264b12a209c446350e189224beafd77f022b3b83a5be863120fa2830
4
+ data.tar.gz: 63d5691bf13b81f8819224d44b6b5a650deb9b9466135d5170fe4549254b7a16
5
5
  SHA512:
6
- metadata.gz: d080f63b75929c5e8b66874d0eb0320a3eb8e455866823de24f613712ec22e50337631fd104ae15530c506df8b12bbec4b58fa4b20aafed728fb20da67ed4fa9
7
- data.tar.gz: '028d2b8807d11ec343186344ee781736d17a34353fac07cc07be36fda94b6384f7a11f0de6bcd771daec7c676e6cf52b98564039e655ef9090fca889d1f8da33'
6
+ metadata.gz: 302e26f18826f458ff0ffdab020ee15533a269fdd5364e17b04a0e7698c49d4592fe94dcbc7b0b8a48fefa14a1daf717e449b9a84d59e6b67563bb9362b83a13
7
+ data.tar.gz: 5eed935063c8024ef395e0fbfd4f31143412ef926b788f2c84df748a828c41d71e0f2122be974ea18e6045e49ee4a1998a3bc0af9e2b015f75c7211d0455b719
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## Version 0.1.1
6
+
7
+ - Add support for passing in an instance-id instead of IP/DNS
8
+ - Add note on support for Linux only
9
+ - Add check for mandatory `host` parameter
10
+ - Add GitHub templates and workflows
11
+ - Add development tools (mdl, yamllint, editorconfig, ...)
12
+ - Fix style on Gemspec
13
+
14
+ ## Version 0.1.0
15
+
16
+ - Initial version
data/README.md CHANGED
@@ -1,44 +1,44 @@
1
1
  # train-awsssm - Train Plugin for using AWS Systems Manager Agent
2
2
 
3
- This plugin allows applications that rely on Train to communicate via AWS SSM.
3
+ This plugin allows applications that rely on Train to communicate via AWS SSM with Linux instances.
4
+
5
+ Windows is currently not yet supported
4
6
 
5
7
  ## Requirements
6
8
 
7
- The instance in question must run on AWS and you need to have all AWS credentials
8
- set up for the shell which executes the command. Please check the [AWS documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html)
9
- for appropriate configuration files and environment variables.
9
+ The instance in question must run on AWS and you need to have all AWS credentials set up for the shell which executes the command. Please check the [AWS documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) for appropriate configuration files and environment variables.
10
10
 
11
- You need the [SSM agent to be installed](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) on the machine (most current AMIs already
12
- have this integrated) and the machine needs to have the managed policy
13
- `AmazonSSMManagedInstanceCore` or a least privilege equivalent attached as
14
- IAM profile.
11
+ You need the [SSM agent to be installed](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) on the machine (most current AMIs already have this integrated) and the machine needs to have the managed policy `AmazonSSMManagedInstanceCore` or a least privilege equivalent attached as IAM profile.
15
12
 
16
- Commands will be executed under the `ssm-user` user.
13
+ Commands will be executed under the `root` user.
17
14
 
18
15
  ## Installation
19
16
 
20
- You will have to build this gem yourself to install it as it is not yet on
21
- Rubygems.Org. For this there is a rake task which makes this a one-liner:
17
+ If you use this Gem as a plain transport you can use `gem install train-awsssm` but if you need it for InSpec you will need to do it via `inspec plugin install train-awsssm`, as InSpec does not use the global/user Gem directory by default.
22
18
 
23
- ```bash
24
- rake install:local
25
- ```
19
+ You can build and install this gem on your local system as well via a Rake task: `rake install:local`.
26
20
 
27
21
  ## Transport parameters
28
22
 
29
23
  | Option | Explanation | Default |
30
24
  | -------------------- | --------------------------------------------- | ---------------- |
31
- | `host` | IP or DNS name of instance | (required) |
25
+ | `host` | IP, DNS name or EC2 ID of instance | (required) |
32
26
  | `execution_timeout` | Maximum time until timeout | 60 |
33
27
  | `recheck_invocation` | Interval of rechecking AWS command invocation | 1.0 |
34
28
  | `recheck_execution` | Interval of rechecking completion of command | 1.0 |
35
29
 
30
+ ## Limitations
31
+
32
+ Currently, this transport is limited to executing commands via the `AWS-RunShellScript` command which means there is no file upload/download capability.
33
+
34
+ Support for proper use of the AWS Session Manager, which allows complete tunneling, is planned.
35
+
36
36
  ## Example use
37
37
 
38
38
  ```ruby
39
39
  require "train-awsssm"
40
40
  train = Train.create("awsssm", {
41
- host: '172.16.3.12',
41
+ host: "172.16.3.12",
42
42
  logger: Logger.new($stdout, level: :info)
43
43
  })
44
44
  conn = train.connection
@@ -9,6 +9,8 @@ module TrainPlugins
9
9
  def initialize(options)
10
10
  super(options)
11
11
 
12
+ check_options
13
+
12
14
  @ssm = Aws::SSM::Client.new
13
15
  end
14
16
 
@@ -114,7 +116,11 @@ module TrainPlugins
114
116
 
115
117
  # Execute a command via SSM
116
118
  def execute_command(address, command)
117
- instance_id = instance_id(address)
119
+ instance_id = if address.start_with? "i-"
120
+ address
121
+ else
122
+ instance_id(address)
123
+ end
118
124
 
119
125
  cmd = @ssm.send_command(instance_ids: [instance_id], document_name: "AWS-RunShellScript", parameters: { "commands": [command] })
120
126
  cmd_id = cmd.command.command_id
@@ -138,6 +144,13 @@ module TrainPlugins
138
144
 
139
145
  result
140
146
  end
147
+
148
+ # Check if options are as needed
149
+ def check_options
150
+ unless options[:host]
151
+ raise format("Missing required option :host for train-awsssm")
152
+ end
153
+ end
141
154
  end
142
155
  end
143
156
  end
@@ -1,5 +1,5 @@
1
1
  module TrainPlugins
2
2
  module AWSSSM
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.1.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,87 +1,100 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-awsssm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Heinen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-10 00:00:00.000000000 Z
11
+ date: 2020-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: train
14
+ name: bump
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :runtime
19
+ version: '0.9'
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '0.9'
27
27
  - !ruby/object:Gem::Dependency
28
- name: aws-sdk-ec2
28
+ name: chefstyle
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.129'
34
- type: :runtime
33
+ version: '0.14'
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.129'
40
+ version: '0.14'
41
41
  - !ruby/object:Gem::Dependency
42
- name: aws-sdk-ssm
42
+ name: guard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.69'
48
- type: :runtime
47
+ version: '2.16'
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.69'
54
+ version: '2.16'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bump
56
+ name: mdl
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.8'
61
+ version: '0.9'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.8'
69
- description: 'Train plugin to use the AWS Systems Manager Agent to execute commands
70
- on machines without SSH/WinRM '
68
+ version: '0.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '13.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '13.0'
83
+ description: Train plugin to use the AWS Systems Manager Agent to execute commands
84
+ on machines without SSH/WinRM
71
85
  email:
72
86
  - theinen@tecracer.de
73
87
  executables: []
74
88
  extensions: []
75
89
  extra_rdoc_files: []
76
90
  files:
77
- - Gemfile
91
+ - CHANGELOG.md
78
92
  - README.md
79
93
  - lib/train-awsssm.rb
80
94
  - lib/train-awsssm/connection.rb
81
95
  - lib/train-awsssm/transport.rb
82
96
  - lib/train-awsssm/version.rb
83
- - train-awsssm.gemspec
84
- homepage: https://github.com/tecracer_theinen/train-awsssm
97
+ homepage: https://github.com/tecracer-chef/train-awsssm
85
98
  licenses:
86
99
  - Apache-2.0
87
100
  metadata: {}
@@ -93,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
106
  requirements:
94
107
  - - ">="
95
108
  - !ruby/object:Gem::Version
96
- version: '0'
109
+ version: '2.6'
97
110
  required_rubygems_version: !ruby/object:Gem::Requirement
98
111
  requirements:
99
112
  - - ">="
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem "pry"
7
- gem "bundler"
8
- gem "rake"
9
- gem "chefstyle"
10
- end
@@ -1,27 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "train-awsssm/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "train-awsssm"
7
- spec.version = TrainPlugins::AWSSSM::VERSION
8
- spec.authors = ["Thomas Heinen"]
9
- spec.email = ["theinen@tecracer.de"]
10
- spec.summary = "Train Transport for AWS Systems Manager Agents"
11
- spec.description = "Train plugin to use the AWS Systems Manager Agent to execute commands on machines without SSH/WinRM "
12
- spec.homepage = "https://github.com/tecracer_theinen/train-awsssm"
13
- spec.license = "Apache-2.0"
14
-
15
- spec.files = %w{
16
- README.md train-awsssm.gemspec Gemfile
17
- } + Dir.glob(
18
- "lib/**/*", File::FNM_DOTMATCH
19
- ).reject { |f| File.directory?(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- spec.add_dependency "train", "~> 2.0"
23
- spec.add_dependency "aws-sdk-ec2", "~> 1.129"
24
- spec.add_dependency "aws-sdk-ssm", "~> 1.69"
25
-
26
- spec.add_development_dependency "bump", "~> 0.8"
27
- end