leeloo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # leeloo
2
+ collaborative password manager
3
+
4
+ ![multi pass](https://media.giphy.com/media/dVneNbpJiD2AU/giphy.gif)
5
+
6
+ Leeloo known as the 5th element is a humble clone of [password-store](https://www.passwordstore.org/) _(and compatible with it)_ written in Ruby with ambition to offer a powerful collaborative password manager.
7
+
8
+ Leeloo is based on [GPG](https://gnupg.org/) and [Git](https://git-scm.com/). _(you have to get a private GPG key and Git installed before, [more details here](https://www.gnupg.org/gph/en/manual/c14.html))_
9
+
10
+ ## How to install leeloo ?
11
+
12
+ Please use "gem install leeloo" and have fun ;)
13
+
14
+ ## How to use it ?
15
+
16
+ ```
17
+ $> leeloo init
18
+ # will create your first keystore (stored in ~/.leeloo/private)
19
+
20
+ $> leeloo
21
+ # will display all your keystores
22
+ +----------------+----------------------------------------+
23
+ | Name | Path |
24
+ +----------------+----------------------------------------+
25
+ | private | /Users/sylvek/.leeloo/private |
26
+ +----------------+----------------------------------------+
27
+
28
+ $> leeloo add keystore password-store ~/.password-store
29
+ # will add password-store keystore
30
+ +----------------+----------------------------------------+
31
+ | Name | Path |
32
+ +----------------+----------------------------------------+
33
+ | private | /Users/sylvek/.leeloo/private |
34
+ | password-store | /Users/sylvek/.password-store |
35
+ +----------------+----------------------------------------+
36
+
37
+ # please make symbolic link to secrets if you use leeloo with password-store
38
+ $> ll ~/.password-store
39
+ drwx------ 35 sylvek staff 1,2K 4 sep 20:38 Personal
40
+ drwxr-xr-x 3 sylvek staff 102B 4 sep 23:04 keys
41
+ lrwxr-xr-x 1 sylvek staff 8B 4 sep 20:38 secrets -> Personal
42
+
43
+ $> leeloo add secret private my_secret
44
+ # will add a secret
45
+
46
+ $> leeloo read secret private my_secret
47
+ # display it
48
+ ```
49
+
50
+ ## How to share a keystore ?
51
+
52
+ Each action is commited on Git. To share your keystore, [create a remote repository and share it](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes).
53
+
54
+ By default, a new created keystore comes with all registered public keys on your system. So each owner should read your "shared" secret. To manage this list, you could remove or add new public GPG keys. It allows to share secret with someone who don't know you yet.
data/leeloo/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/leeloo/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at sylvain.maucourt@edelia.fr. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/leeloo/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in leeloo.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Sylvain
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/leeloo/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Leeloo
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/leeloo`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'leeloo'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install leeloo
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/leeloo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Leeloo project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/leeloo/blob/master/CODE_OF_CONDUCT.md).
data/leeloo/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "leeloo"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/leeloo/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "leeloo/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "leeloo"
8
+ spec.version = Leeloo::VERSION
9
+ spec.authors = ["Sylvek"]
10
+ spec.email = ["smaucourt@gmail.com"]
11
+
12
+ spec.summary = Leeloo::DESCRIPTION
13
+ spec.description = Leeloo::DESCRIPTION
14
+ spec.homepage = "https://github.com/sylvek"
15
+ spec.license = "MIT"
16
+
17
+ spec.required_ruby_version = '>= 2.0.0'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "commander", "~> 4.4"
27
+ spec.add_dependency "gpgme", "~> 2.0"
28
+ spec.add_dependency "git", "~> 1.3"
29
+ spec.add_dependency "terminal-table", "~> 1.8"
30
+ spec.add_dependency "tty-tree", "~> 0.1"
31
+
32
+ spec.add_development_dependency "bundler", "~> 1.15"
33
+ spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "rspec", "~> 3.0"
35
+ end
@@ -0,0 +1,14 @@
1
+ require 'leeloo/version'
2
+ require 'leeloo/command'
3
+ require 'leeloo/secret'
4
+ require 'leeloo/keystore'
5
+ require 'leeloo/config'
6
+
7
+ module Leeloo
8
+ def self.start
9
+ Config.load
10
+ Command.new.run
11
+ end
12
+ end
13
+
14
+ Leeloo.start
@@ -0,0 +1,91 @@
1
+ require 'commander/import'
2
+
3
+ module Leeloo
4
+ class Command
5
+ include Commander::Methods
6
+
7
+ def run
8
+ program :name, 'leeloo'
9
+ program :version, Leeloo::VERSION
10
+ program :description, [
11
+ "leeloo multipass - #{Leeloo::DESCRIPTION}",
12
+ "\tRun using `leeloo [action]`"
13
+ ].join("\n")
14
+ program :help, 'Author', 'Sylvain Maucourt <smaucourt@gmail.com>'
15
+ program :help, 'GitHub', 'https://github.com/sylvek'
16
+ program :help_formatter, :compact
17
+
18
+ default_command :list
19
+
20
+ command :"init" do |c|
21
+ c.syntax = 'leeloo init'
22
+ c.description = "Initialize leeloo and private keystore"
23
+ c.action do |args, options|
24
+
25
+ Config::init
26
+ end
27
+ end
28
+
29
+ command :"list" do |c|
30
+ c.syntax = 'leeloo list'
31
+ c.description = "Display keystores list"
32
+ c.action do |args, options|
33
+
34
+ Config::list_keystores
35
+ end
36
+ end
37
+
38
+ command :"list secret" do |c|
39
+ c.syntax = 'leeloo list secret <keystore>'
40
+ c.description = "Display secrets list"
41
+ c.action do |args, options|
42
+ abort "keytore is missing" unless args.length == 1
43
+
44
+ Secret::list Config.get_keystore(args.first)
45
+ end
46
+ end
47
+
48
+ command :"add keystore" do |c|
49
+ c.syntax = 'leeloo add keystore <name> <path>'
50
+ c.description = "add a new keystore"
51
+
52
+ c.action do |args, options|
53
+
54
+ abort "name or path are missing" unless args.length == 2
55
+
56
+ Keystore.add_keystore args.first, args.last
57
+ Config.add_keystore args.first, args.last
58
+ end
59
+ end
60
+
61
+ command :"add secret" do |c|
62
+ c.syntax = 'leeloo add secret <keystore> <name>'
63
+ c.description = "add a new secret in a keystore"
64
+
65
+ c.action do |args, options|
66
+ keystore = Config.get_keystore(args.first)
67
+
68
+ abort "keytore or name are missing" unless args.length == 2
69
+ secret = password "secret"
70
+ confirm = password "confirm it"
71
+ abort "not the same secret" unless secret == confirm
72
+
73
+ Secret.add_secret keystore, args.last, secret
74
+ end
75
+ end
76
+
77
+ command :"read secret" do |c|
78
+ c.syntax = 'leeloo read secret <keystore> <name>'
79
+ c.description = "read a secret from a keystore"
80
+
81
+ c.action do |args, options|
82
+ keystore = Config.get_keystore(args.first)
83
+
84
+ abort "keytore or name are missing" unless args.length == 2
85
+
86
+ Secret.read_secret keystore, args.last
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,47 @@
1
+ require 'yaml'
2
+ require 'terminal-table'
3
+
4
+ module Leeloo
5
+ class Config
6
+
7
+ PATH = "#{Dir.home}/.leeloo"
8
+
9
+ @@keystores
10
+
11
+ def self.init
12
+ Keystore::add_keystore "private", "#{PATH}/private"
13
+ Config::add_keystore "private", "#{PATH}/private"
14
+ say "Initialization completed"
15
+ end
16
+
17
+ def self.list_keystores
18
+ rows = []
19
+ @@keystores.each { |keystore| rows << [keystore['name'], keystore['path']] }
20
+ say Terminal::Table.new :headings => ['Name', 'Path'], :rows => rows
21
+ end
22
+
23
+ def self.load
24
+ FileUtils.mkdir_p PATH
25
+ if File.exist? "#{PATH}/keystores"
26
+ @@keystores = YAML.load_file "#{PATH}/keystores"
27
+ end
28
+ end
29
+
30
+ def self.add_keystore name, path
31
+ keystore = { 'name' => name, 'path' => path}
32
+ unless @@keystores.include? keystore
33
+ @@keystores << keystore
34
+ File.write("#{PATH}/keystores", @@keystores.to_yaml)
35
+ end
36
+ end
37
+
38
+ def self.get_keystore name
39
+ @@keystores.each do |keystore|
40
+ return keystore['path'] if keystore['name'] == name
41
+ end
42
+
43
+ raise "keystore not found"
44
+ end
45
+
46
+ end
47
+ end