lakitu 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -0
- data/lib/lakitu/generator.rb +1 -0
- data/lib/lakitu/providers/aws.rb +6 -1
- data/lib/lakitu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e641d8d58175c49337d22b7356b804deb469ade2
|
4
|
+
data.tar.gz: 371330d9bd424f9dc5af130b71cc5f085348e17d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 546102fd353cc2513848a2b1d2eb84ff723b98d1d1d959e162ba8d4b3412a7dd56163be79bb14c2de4aafcc63a66453742673ed6d1c329ac892028e178e941ca
|
7
|
+
data.tar.gz: 02b3fb23eed006859413e74f016989b36e2eddfdfb2eae12f685f8826fba386468ef8b86053f87e5abc44c6c3cf61b4d264161bb99560604d90698893891887f
|
data/README.md
CHANGED
@@ -20,6 +20,23 @@ $ lakitu configure
|
|
20
20
|
$ lakitu edit
|
21
21
|
```
|
22
22
|
|
23
|
+
## How It Works
|
24
|
+
Lakitu parses your AWS credentials file, and for each configured profile will pull a list of Public IP addresses. It will also try look for files in `~/.ssh/` matching the keypair listed for each instance, and if it exists will add the key to the generated config output. For example, if your instance has a keypair listed on the console as `acme-production`, and you have a local file at `~/.ssh/acme-production.pem`, Lakitu will configure that key to be used when connecting to the specified instance.
|
25
|
+
|
26
|
+
It's not possible for Lakitu to determine usernames or proxy commands to use when connecting to instances. To allow configuration of this and other SSH related things, lakitu looks for a `~/.ssh/local.sshconfig` file and prepends it to the generated ssh config. When first run, Lakitu will back up your old SSH config to this location. You can also edit this file via `lakitu edit`, which will then regenerate your primary config after editing.
|
27
|
+
|
28
|
+
A common `local.sshconfig` might include things like the following:
|
29
|
+
```
|
30
|
+
Host acme-*
|
31
|
+
User ubuntu
|
32
|
+
|
33
|
+
Host enron-*
|
34
|
+
ForwardAgent yes
|
35
|
+
ProxyCommand nohup ssh ubuntu@gateway.enron.com nc %h %p
|
36
|
+
```
|
37
|
+
|
38
|
+
Which would then be prepended to the generated global SSH config.
|
39
|
+
|
23
40
|
## Periodic Refresh
|
24
41
|
Simply add the following line to your `.bashrc`
|
25
42
|
```
|
@@ -42,6 +59,11 @@ There are several projects that will generate an SSH config from AWS instance da
|
|
42
59
|
- **Extensibility**: A simple Provider API allows easy support for new providers.
|
43
60
|
- **Reliability**: A robust test suite ensures that Lakitu probably won't cause your machine to combust unexpectedly.
|
44
61
|
|
62
|
+
## Why do you have to clobber my SSH config?
|
63
|
+
One major goal of this project is to support `bash-completion` "out of the box". Unfortunately, most versions of SSH in use right now don't support the `Include` directive, and `bash-completion` will only look at the main ssh config. Changes have been prepared for when `Include` becomes more commonly supported which will simply add an Include directive and will put lakitu output into its own isolated file. However, this branch remains unmerged due to overwhelming lack of support for this directive.
|
64
|
+
|
65
|
+
It's important to note that lakitu has several checks to prevent clobbering or destroying an unmanaged ssh config. However, once lakitu is managing the config (`# Managed by lakitu` is found in the file) it will overwrite the file ruthlessly. For this reason, you should always make custom changes via the `laktiu edit` command, or by editing `local.sshconfig`.
|
66
|
+
|
45
67
|
## Other Options
|
46
68
|
You could also check out the folowing if this is too much hubbub for you:
|
47
69
|
- https://rubygems.org/gems/knife-ec2-ssh-config
|
data/lib/lakitu/generator.rb
CHANGED
@@ -11,6 +11,7 @@ Host <%= host %><% if keyfile %>
|
|
11
11
|
def self.generate
|
12
12
|
([ Lakitu::MANAGED_SSH_CONFIG_TOKEN, Lakitu::FileOperator::local_ssh_config ] + instances.map do |instance|
|
13
13
|
instance[:host] = format_for(instance[:provider], instance[:profile]) % instance
|
14
|
+
instance[:host].gsub!(/[ \W-]+/, '-')
|
14
15
|
key_path = Lakitu::FileOperator.key_path instance[:key]
|
15
16
|
instance[:keyfile] = key_path if key_path
|
16
17
|
ERB.new(CLAUSE_TEMPLATE).result(OpenStruct.new(instance).instance_eval { binding })
|
data/lib/lakitu/providers/aws.rb
CHANGED
@@ -4,6 +4,11 @@ require 'lakitu/provider'
|
|
4
4
|
|
5
5
|
class Lakitu::Provider::Aws < Lakitu::Provider
|
6
6
|
CREDENTIALS_PATH = '~/.aws/credentials'
|
7
|
+
REGIONS = %w(
|
8
|
+
us-east-1
|
9
|
+
us-west-1
|
10
|
+
us-west-2
|
11
|
+
)
|
7
12
|
def profiles
|
8
13
|
IniParse.parse(File.read(File.expand_path(CREDENTIALS_PATH))).to_hash.keys.reject() do |x| x == '__anonymous__' end
|
9
14
|
rescue Errno::ENOENT
|
@@ -26,7 +31,7 @@ class Lakitu::Provider::Aws < Lakitu::Provider
|
|
26
31
|
end
|
27
32
|
|
28
33
|
def regions
|
29
|
-
|
34
|
+
REGIONS
|
30
35
|
end
|
31
36
|
|
32
37
|
private
|
data/lib/lakitu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lakitu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Conrad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|