lastpass-ansible 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/lastpass-ansible +61 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 16cd08f7e1f4147c11a52d2f92537638d352760f
|
4
|
+
data.tar.gz: 3979ff14fda741b9a02d5357f635f2742df0e75a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 17ade26dba10294aaddccad5d05c9ca4f82e0169aaa3bc35a3637973aa73572843a550bb99fd9c0bbdec127fbd5ed0e5c251cf80b79e1b7cad671640ce6f13fc
|
7
|
+
data.tar.gz: dc6b70251b02f325247a61c54b6f7d89670aa08b7e33bdb1b59638e6a76e9e924b3fb357bccb0db742afeba2a008fd447e5de1b3dda104076dea3a69ff7a9e28
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# Copyright 2017 Wojciech Adam Koszek <wojciech@koszek.com>
|
3
|
+
|
4
|
+
EX_USAGE = 64
|
5
|
+
NAME = "lastpass-ansible"
|
6
|
+
CONFIG_NAME = ".lastpass-ansible.conf"
|
7
|
+
|
8
|
+
def main
|
9
|
+
if `which lpass`.length() == 0 then
|
10
|
+
errfail("You don't have the 'lpass' command tool")
|
11
|
+
end
|
12
|
+
|
13
|
+
lastpass_ansible_name = read_config_file_recurse(Dir.pwd())
|
14
|
+
var_name = "LASTPASS_ANSIBLE_NAME"
|
15
|
+
if ENV.has_key?(var_name) then
|
16
|
+
lastpass_ansible_name = ENV[var_name]
|
17
|
+
end
|
18
|
+
if lastpass_ansible_name.nil? then
|
19
|
+
errfail("Set Lastpass Vault account name via #{var_name}")
|
20
|
+
end
|
21
|
+
|
22
|
+
stdout = IO.try_convert(STDOUT)
|
23
|
+
if stdout == nil or stdout.isatty then
|
24
|
+
errfail("Won't print Ansible Vault password to terminal")
|
25
|
+
end
|
26
|
+
|
27
|
+
var_name = "LASTPASS_ANSIBLE_WRONG_PASS_SIM"
|
28
|
+
if ENV.has_key?(var_name) then
|
29
|
+
print "WrongPassword"
|
30
|
+
exit 0
|
31
|
+
end
|
32
|
+
|
33
|
+
system("lpass show --password #{lastpass_ansible_name}")
|
34
|
+
end
|
35
|
+
|
36
|
+
#--------
|
37
|
+
|
38
|
+
def errfail(s)
|
39
|
+
STDERR.puts "#{NAME}: #{s}\n"
|
40
|
+
exit EX_USAGE
|
41
|
+
end
|
42
|
+
|
43
|
+
def read_config_file_recurse(directory)
|
44
|
+
path_chunks = directory.split("/")
|
45
|
+
config_file_body = nil
|
46
|
+
path_chunks.length().downto(1) { |path_index|
|
47
|
+
new_path_chunks = path_chunks
|
48
|
+
new_path_chunks[path_index] = CONFIG_NAME
|
49
|
+
cfg_file_name = new_path_chunks[0..path_index].join("/")
|
50
|
+
#print "#{cfg_file_name}\n"
|
51
|
+
if File.exists?(cfg_file_name) then
|
52
|
+
#print "#{cfg_file_name} exists\n"
|
53
|
+
config_file_body = File.read(cfg_file_name).strip
|
54
|
+
end
|
55
|
+
}
|
56
|
+
return config_file_body
|
57
|
+
end
|
58
|
+
|
59
|
+
#--------
|
60
|
+
|
61
|
+
main
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lastpass-ansible
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Wojciech Adam Koszek
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: The lastpass-ansible lets you unlock Ansible Vault with password from
|
14
|
+
LastPass
|
15
|
+
email: wojciech@koszek.com
|
16
|
+
executables:
|
17
|
+
- lastpass-ansible
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/lastpass-ansible
|
22
|
+
homepage: http://github.com/wkoszek/lastpass-ansible
|
23
|
+
licenses:
|
24
|
+
- BSD-2-Clause
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- "."
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.5.1
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Use LastPass to unlock Ansible Vault
|
46
|
+
test_files: []
|