gritano 0.5.4 → 0.6.0
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.
- data/.gritano/config.yml +2 -0
- data/LICENSE.txt +1 -1
- data/README.rdoc +10 -2
- data/TODO +0 -14
- data/VERSION +1 -1
- data/bin/gritano-pub-key +15 -0
- data/features/data/config_true.yml +2 -0
- data/features/data/local_commands/addon_list.txt +5 -0
- data/features/data/local_commands/addon_ssh_install.txt +0 -0
- data/features/data/local_help.txt +3 -0
- data/features/data/remote_commands/admin_addon_list_igorbonadio.txt +5 -0
- data/features/data/remote_commands/admin_addon_list_jessicaeto.txt +1 -0
- data/features/data/remote_commands/admin_help_igorbonadio.txt +3 -0
- data/features/data/remote_commands/admin_help_jessicaeto.txt +3 -0
- data/features/local.feature +1 -0
- data/features/pub_key.feature +25 -0
- data/features/remote.feature +2 -0
- data/features/step_definitions/background_step.rb +1 -1
- data/features/step_definitions/local_step.rb +1 -1
- data/features/step_definitions/pub_key_step.rb +15 -0
- data/features/step_definitions/remote_step.rb +1 -1
- data/gritano.gemspec +15 -4
- data/lib/gritano/cli.rb +10 -0
- data/lib/gritano/console/executor.rb +30 -1
- data/lib/gritano/console/ssh_install.txt +7 -0
- data/lib/gritano/models/key.rb +17 -1
- data/spec/cli_spec.rb +5 -0
- data/spec/console_executor_spec.rb +2 -2
- data/spec/model_config_spec.rb +10 -0
- data/spec/model_key_spec.rb +8 -2
- metadata +16 -4
data/.gritano/config.yml
ADDED
data/LICENSE.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Gritano v0.
|
1
|
+
= Gritano v0.6.0
|
2
2
|
|
3
3
|
Gritano is the simplest way to configure a git server over ssh. You can create repositories and manage user access using this practical tool.
|
4
4
|
|
@@ -85,6 +85,14 @@ Starting from Gritano 0.3.0, administrators can execute commands via ssh:
|
|
85
85
|
|
86
86
|
$ ssh git@host.com admin:repo:list
|
87
87
|
|
88
|
+
= Custom SSH
|
89
|
+
|
90
|
+
Gritano 0.6.0 introduces Gritano-SSH (https://github.com/igorbonadio/gritano-openssh), a custom SSH that you can use to improve user authentication. It look up for users' keys in the gritano's database.
|
91
|
+
|
92
|
+
To enable this feature, you need to install Gritano-SSH and execute:
|
93
|
+
|
94
|
+
$ gritano addon:ssh:install
|
95
|
+
|
88
96
|
== For more Information
|
89
97
|
|
90
98
|
http://igorbonadio.com.br/gritano/
|
@@ -101,5 +109,5 @@ http://igorbonadio.com.br/gritano/
|
|
101
109
|
|
102
110
|
== Copyright
|
103
111
|
|
104
|
-
Copyright (c) 2012 Ígor Bonadio. See LICENSE.txt for
|
112
|
+
Copyright (c) 2012-2013 Ígor Bonadio. See LICENSE.txt for
|
105
113
|
further details.
|
data/TODO
CHANGED
@@ -1,14 +0,0 @@
|
|
1
|
-
v0.6.0
|
2
|
-
- melhorar o instalador/updater
|
3
|
-
- escolha de db
|
4
|
-
gritano setup:prepare -db sqlite
|
5
|
-
|
6
|
-
v0.7.0
|
7
|
-
- gritano-openssh
|
8
|
-
- gritano ssh:install
|
9
|
-
gritano ssh:config:show
|
10
|
-
gritano ssh config:set:port 22
|
11
|
-
...
|
12
|
-
gritano ssh:start
|
13
|
-
gritano ssh:stop
|
14
|
-
gritano ssh:restart
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/bin/gritano-pub-key
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
3
|
+
|
4
|
+
require 'gritano'
|
5
|
+
|
6
|
+
key = nil
|
7
|
+
STDIN.readlines.each do |line|
|
8
|
+
if line =~ /^ssh-(?:dss|rsa) [A-Za-z0-9+\/]+$/
|
9
|
+
key = line
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
if key
|
14
|
+
STDOUT.print Gritano::CLI::check_pub_key(key, File.dirname(File.dirname(ARGV[0])))
|
15
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
error: access denied
|
@@ -22,6 +22,9 @@
|
|
22
22
|
ssh git@host.com admin:repo:write:add reponame.git username
|
23
23
|
ssh git@host.com admin:repo:read:rm reponame.git username
|
24
24
|
ssh git@host.com admin:repo:write:rm reponame.git username
|
25
|
+
ssh git@host.com admin:addon:list
|
26
|
+
ssh git@host.com admin:addon:ssh:install
|
27
|
+
ssh git@host.com admin:addon:ssh:uninstall
|
25
28
|
|
26
29
|
--
|
27
30
|
v{{VERSION}}
|
@@ -22,6 +22,9 @@
|
|
22
22
|
ssh git@host.com admin:repo:write:add reponame.git username
|
23
23
|
ssh git@host.com admin:repo:read:rm reponame.git username
|
24
24
|
ssh git@host.com admin:repo:write:rm reponame.git username
|
25
|
+
ssh git@host.com admin:addon:list
|
26
|
+
ssh git@host.com admin:addon:ssh:install
|
27
|
+
ssh git@host.com admin:addon:ssh:uninstall
|
25
28
|
|
26
29
|
--
|
27
30
|
v{{VERSION}}
|
data/features/local.feature
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: Public Key
|
2
|
+
In order to allow users to user gritano
|
3
|
+
As a ssh
|
4
|
+
I want to check public keys
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given the following users exist:
|
8
|
+
| login | admin |
|
9
|
+
| igorbonadio | true |
|
10
|
+
| jessicaeto | false |
|
11
|
+
|
12
|
+
And the following keys exist:
|
13
|
+
| login | key |
|
14
|
+
| igorbonadio | eva |
|
15
|
+
| jessicaeto | hal |
|
16
|
+
|
17
|
+
Scenario: Valid key
|
18
|
+
Given I start the public key checker
|
19
|
+
When I receive "eva" public key
|
20
|
+
Then I should see "igorbonadio"'s "eva" pubkey entry
|
21
|
+
|
22
|
+
Scenario: Invalid key
|
23
|
+
Given I start the public key checker
|
24
|
+
When I receive "invalid" public key
|
25
|
+
Then I should see an invalid pubkey
|
data/features/remote.feature
CHANGED
@@ -100,6 +100,7 @@ Feature: Remote access
|
|
100
100
|
| admin:repo:write:rm tmp/gritano.git arybonadio |
|
101
101
|
| admin:repo:write:rm tmp/p-lang.git igorbonadio |
|
102
102
|
| admin:repo:user:list tmp/ruby.git |
|
103
|
+
| admin:addon:list |
|
103
104
|
|
104
105
|
Scenario Outline: Admin user execute command
|
105
106
|
Given I start the remote console with "igorbonadio"
|
@@ -154,3 +155,4 @@ Feature: Remote access
|
|
154
155
|
| admin:repo:write:rm tmp/gritano.git arybonadio |
|
155
156
|
| admin:repo:write:rm tmp/p-lang.git igorbonadio |
|
156
157
|
| admin:repo:user:list tmp/ruby.git |
|
158
|
+
| admin:addon:list |
|
@@ -6,7 +6,7 @@ end
|
|
6
6
|
|
7
7
|
Given /^the following keys exist:$/ do |table|
|
8
8
|
table.hashes.each do |key|
|
9
|
-
Gritano::User.find_by_login(key['login']).keys.create(name: key["key"], key: "key")
|
9
|
+
Gritano::User.find_by_login(key['login']).keys.create(name: key["key"], key: key["key"])
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Given /^I start the gritano console$/ do
|
2
2
|
@stdin = double()
|
3
|
-
@stdin.stub(:read).and_return("
|
3
|
+
@stdin.stub(:read).and_return("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9UnnlDwmvid+WRAyIhVzFhIjUUxA3Wul7LN8mk18dHZDv5HSVADmM4EoqbVSbpeVIyTIchqS3y3XF1rh8dfM41f/W3lcTcFihHM6RDx45Q3Lz9hfyrT8tttlWRA7prvlXu6bUOqMmNtvFFow+bJEo/HgCZHshvoDHcnlHfziU7bDCo+p50SdafFwZRe3AWp/f4TsxiP7jpBnluQM0Dl9Om8jfW8IYAJ+WxlKBsKLMkRH/HWSuigs4AQBD4ADiQfOm2RO4yeSiVFNwGFmgG7NmEq1sNALLAQw+ijN9vyiD99ybr0pqoJX3vhyRBWvCrgQdHjh8ucaoMXI89LxyYts/ igorbonadio@marvin.local")
|
4
4
|
@home_dir = '.'
|
5
5
|
@repo_dir = 'tmp'
|
6
6
|
@console = Gritano::CLI
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Given /^I start the public key checker$/ do
|
2
|
+
@console = Gritano::CLI
|
3
|
+
end
|
4
|
+
|
5
|
+
When /^I receive "(.*?)" public key$/ do |key|
|
6
|
+
@output = @console.check_pub_key(key, '.')
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^I should see an invalid pubkey$/ do
|
10
|
+
@output.should be == "invalid"
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^I should see "(.*?)"'s "(.*?)" pubkey entry$/ do |user, key|
|
14
|
+
@output.should be == "command=\"gritano-remote #{user}\" #{key}"
|
15
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Given /^I start the remote console with "(.*?)"$/ do |login|
|
2
2
|
@stdin = double()
|
3
|
-
@stdin.stub(:read).and_return("
|
3
|
+
@stdin.stub(:read).and_return("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9UnnlDwmvid+WRAyIhVzFhIjUUxA3Wul7LN8mk18dHZDv5HSVADmM4EoqbVSbpeVIyTIchqS3y3XF1rh8dfM41f/W3lcTcFihHM6RDx45Q3Lz9hfyrT8tttlWRA7prvlXu6bUOqMmNtvFFow+bJEo/HgCZHshvoDHcnlHfziU7bDCo+p50SdafFwZRe3AWp/f4TsxiP7jpBnluQM0Dl9Om8jfW8IYAJ+WxlKBsKLMkRH/HWSuigs4AQBD4ADiQfOm2RO4yeSiVFNwGFmgG7NmEq1sNALLAQw+ijN9vyiD99ybr0pqoJX3vhyRBWvCrgQdHjh8ucaoMXI89LxyYts/ igorbonadio@marvin.local")
|
4
4
|
@home_dir = '.'
|
5
5
|
@repo_dir = 'tmp'
|
6
6
|
@login = login
|
data/gritano.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "gritano"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Igor Bonadio"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-02-18"
|
13
13
|
s.description = "Gritano is the simplest way to configure your git server over ssh. You can create repositories and manage user access."
|
14
14
|
s.email = "igorbonadio@gmail.com"
|
15
|
-
s.executables = ["gritano", "gritano-remote"]
|
15
|
+
s.executables = ["gritano", "gritano-pub-key", "gritano-remote"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE.txt",
|
18
18
|
"README.rdoc",
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
+
".gritano/config.yml",
|
23
24
|
".gritano/database.yml",
|
24
25
|
".rspec",
|
25
26
|
".ssh/.gitignore",
|
@@ -30,12 +31,16 @@ Gem::Specification.new do |s|
|
|
30
31
|
"Rakefile",
|
31
32
|
"VERSION",
|
32
33
|
"bin/gritano",
|
34
|
+
"bin/gritano-pub-key",
|
33
35
|
"bin/gritano-remote",
|
34
36
|
"db/migrate/001_create_users.rb",
|
35
37
|
"db/migrate/002_create_repositories.rb",
|
36
38
|
"db/migrate/003_create_permissions.rb",
|
37
39
|
"db/migrate/004_create_keys.rb",
|
38
40
|
"db/migrate/005_add_admin_to_users.rb",
|
41
|
+
"features/data/config_true.yml",
|
42
|
+
"features/data/local_commands/addon_list.txt",
|
43
|
+
"features/data/local_commands/addon_ssh_install.txt",
|
39
44
|
"features/data/local_commands/repo_add_tmp_jeka_git.txt",
|
40
45
|
"features/data/local_commands/repo_add_tmp_p_lang_git.txt",
|
41
46
|
"features/data/local_commands/repo_add_tmp_p_lang_git_igorbonadio.txt",
|
@@ -76,6 +81,8 @@ Gem::Specification.new do |s|
|
|
76
81
|
"features/data/local_commands/user_rm_jose.txt",
|
77
82
|
"features/data/local_commands/version.txt",
|
78
83
|
"features/data/local_help.txt",
|
84
|
+
"features/data/remote_commands/admin_addon_list_igorbonadio.txt",
|
85
|
+
"features/data/remote_commands/admin_addon_list_jessicaeto.txt",
|
79
86
|
"features/data/remote_commands/admin_help_igorbonadio.txt",
|
80
87
|
"features/data/remote_commands/admin_help_jessicaeto.txt",
|
81
88
|
"features/data/remote_commands/admin_repo_add_tmp_jeka_git_igorbonadio.txt",
|
@@ -173,10 +180,12 @@ Gem::Specification.new do |s|
|
|
173
180
|
"features/data/remote_help.txt",
|
174
181
|
"features/install.feature",
|
175
182
|
"features/local.feature",
|
183
|
+
"features/pub_key.feature",
|
176
184
|
"features/remote.feature",
|
177
185
|
"features/step_definitions/background_step.rb",
|
178
186
|
"features/step_definitions/install_step.rb",
|
179
187
|
"features/step_definitions/local_step.rb",
|
188
|
+
"features/step_definitions/pub_key_step.rb",
|
180
189
|
"features/step_definitions/remote_step.rb",
|
181
190
|
"features/support/database_cleaner.rb",
|
182
191
|
"features/support/env.rb",
|
@@ -189,6 +198,7 @@ Gem::Specification.new do |s|
|
|
189
198
|
"lib/gritano/console/gritano.rb",
|
190
199
|
"lib/gritano/console/installer.rb",
|
191
200
|
"lib/gritano/console/remote.rb",
|
201
|
+
"lib/gritano/console/ssh_install.txt",
|
192
202
|
"lib/gritano/models.rb",
|
193
203
|
"lib/gritano/models/key.rb",
|
194
204
|
"lib/gritano/models/permission.rb",
|
@@ -202,6 +212,7 @@ Gem::Specification.new do |s|
|
|
202
212
|
"spec/console_remote_spec.rb",
|
203
213
|
"spec/console_spec.rb",
|
204
214
|
"spec/data/help_command_name.txt",
|
215
|
+
"spec/model_config_spec.rb",
|
205
216
|
"spec/model_key_spec.rb",
|
206
217
|
"spec/model_permission_spec.rb",
|
207
218
|
"spec/model_repository_spec.rb",
|
@@ -211,7 +222,7 @@ Gem::Specification.new do |s|
|
|
211
222
|
s.homepage = "http://igorbonadio.com.br/gritano"
|
212
223
|
s.licenses = ["MIT"]
|
213
224
|
s.require_paths = ["lib"]
|
214
|
-
s.rubygems_version = "1.8.
|
225
|
+
s.rubygems_version = "1.8.25"
|
215
226
|
s.summary = "Gritano is a tool to configure your git server over ssh"
|
216
227
|
|
217
228
|
if s.respond_to? :specification_version then
|
data/lib/gritano/cli.rb
CHANGED
@@ -23,5 +23,15 @@ module Gritano
|
|
23
23
|
Gritano::Console.remote_console(true)
|
24
24
|
_execute(cmd + [login], Gritano::Console::Remote.new(stdin, home_dir, repo_dir))
|
25
25
|
end
|
26
|
+
|
27
|
+
def CLI.check_pub_key(key, home_dir = Etc.getpwuid.dir)
|
28
|
+
ActiveRecord::Base.establish_connection(YAML::load(File.open(File.join(home_dir, '.gritano', 'database.yml'))))
|
29
|
+
k = Key.find_by_key(key)
|
30
|
+
if k
|
31
|
+
return "command=\"gritano-remote #{k.user.login}\" #{k.key}"
|
32
|
+
else
|
33
|
+
return "invalid"
|
34
|
+
end
|
35
|
+
end
|
26
36
|
end
|
27
37
|
end
|
@@ -92,7 +92,12 @@ module Gritano
|
|
92
92
|
login, key_name, key_file = argv
|
93
93
|
user = User.find_by_login(login)
|
94
94
|
if user
|
95
|
-
|
95
|
+
begin
|
96
|
+
key_str = "#{@stdin.read.scan(/^ssh-(?:dss|rsa) [A-Za-z0-9+\/]+/)[0]}"
|
97
|
+
rescue
|
98
|
+
return [false, "Key could not be added."]
|
99
|
+
end
|
100
|
+
key = user.keys.create(name: key_name, key: key_str)
|
96
101
|
if key.valid?
|
97
102
|
File.open(File.join(@ssh_path, 'authorized_keys'), 'w').write(Key.authorized_keys)
|
98
103
|
return [true, "Key added successfully."]
|
@@ -241,6 +246,30 @@ module Gritano
|
|
241
246
|
end
|
242
247
|
return [false, "An error occurred. Permissions was not modified."]
|
243
248
|
end
|
249
|
+
|
250
|
+
add_command "addon:list" do |argv|
|
251
|
+
msg = Terminal::Table.new do |t|
|
252
|
+
t << ['add-ons']
|
253
|
+
t << :separator
|
254
|
+
t.add_row ['ssh']
|
255
|
+
end
|
256
|
+
return [true, msg]
|
257
|
+
end
|
258
|
+
|
259
|
+
add_command "addon:ssh:install" do |argv|
|
260
|
+
File.open(File.join(@home_dir, '.gritano', 'config.yml'), "w").write({'ssh' => true}.to_yaml)
|
261
|
+
File.open(File.join(@ssh_path, 'authorized_keys'), "w").write('')
|
262
|
+
gritano_pub_key_path = `which gritano-pub-key`[0..-2]
|
263
|
+
`ln -s #{gritano_pub_key_path} #{File.join(@home_dir, '.gritano', 'gritano-pub-key')}`
|
264
|
+
[true, File.open(File.join(File.dirname(__FILE__), 'ssh_install.txt')).readlines.join.gsub('{{GRITANO_PUB_KEY}}', File.join(@home_dir, '.gritano', 'gritano-pub-key'))]
|
265
|
+
end
|
266
|
+
|
267
|
+
add_command "addon:ssh:uninstall" do |argv|
|
268
|
+
File.open(File.join(@home_dir, '.gritano', 'config.yml'), "w").write({'ssh' => false}.to_yaml)
|
269
|
+
File.open(File.join(@ssh_path, 'authorized_keys'), 'w').write(Key.authorized_keys)
|
270
|
+
FileUtils.rm(File.join(@home_dir, '.gritano', 'gritano-pub-key')) if File.exist?(File.join(@home_dir, '.gritano', 'gritano-pub-key'))
|
271
|
+
[true, 'Now Gritano is configured to use the authorized_keys file to authenticate users.']
|
272
|
+
end
|
244
273
|
end
|
245
274
|
end
|
246
275
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Now Gritano is configured to use a custom ssh that can authenticate users that are registered in Gritano's database.
|
2
|
+
|
3
|
+
Don't forget to add the following line to your sshd_config:
|
4
|
+
|
5
|
+
AuthorizedKeysScript {{GRITANO_PUB_KEY}}
|
6
|
+
|
7
|
+
For more information: https://github.com/igorbonadio/gritano-openssh.
|
data/lib/gritano/models/key.rb
CHANGED
@@ -1,11 +1,27 @@
|
|
1
1
|
module Gritano
|
2
2
|
class Key < ActiveRecord::Base
|
3
|
+
|
3
4
|
validates :name, :key, presence: true
|
4
5
|
validates :name, :uniqueness => { :scope => :user_id, :message => "should happen once per user" }
|
5
6
|
|
6
7
|
belongs_to :user
|
7
8
|
|
9
|
+
def self.config=(cfg)
|
10
|
+
@config = cfg
|
11
|
+
end
|
12
|
+
|
8
13
|
def self.authorized_keys
|
14
|
+
if @config
|
15
|
+
unless @config['ssh']
|
16
|
+
return generate_authorized_keys
|
17
|
+
end
|
18
|
+
else
|
19
|
+
return generate_authorized_keys
|
20
|
+
end
|
21
|
+
return ""
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.generate_authorized_keys
|
9
25
|
authorized_keys = ""
|
10
26
|
keys = Key.find(:all)
|
11
27
|
keys.each do |k|
|
@@ -13,7 +29,7 @@ module Gritano
|
|
13
29
|
unless k.key[-1] == "\n"
|
14
30
|
user_key = user_key + "\n"
|
15
31
|
end
|
16
|
-
authorized_keys += "command=\"gritano-remote #{k.user.login}\" #{user_key}"
|
32
|
+
authorized_keys += "command=\"gritano-remote #{k.user.login}\" #{user_key}\n"
|
17
33
|
end
|
18
34
|
return authorized_keys
|
19
35
|
end
|
data/spec/cli_spec.rb
CHANGED
@@ -17,5 +17,10 @@ module Gritano
|
|
17
17
|
Gritano::Console::Remote.should_receive(:new).and_return(console)
|
18
18
|
CLI.check(["repo:list"], "login")
|
19
19
|
end
|
20
|
+
|
21
|
+
it "should check public keys" do
|
22
|
+
Key.should_receive(:find_by_key).and_return(nil)
|
23
|
+
CLI.check_pub_key("key", ".")
|
24
|
+
end
|
20
25
|
end
|
21
26
|
end
|
@@ -5,7 +5,7 @@ module Gritano
|
|
5
5
|
describe Executor do
|
6
6
|
def create_executor(home, repo_dir)
|
7
7
|
stdin = double()
|
8
|
-
stdin.stub(:read).and_return("
|
8
|
+
stdin.stub(:read).and_return("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9UnnlDwmvid+WRAyIhVzFhIjUUxA3Wul7LN8mk18dHZDv5HSVADmM4EoqbVSbpeVIyTIchqS3y3XF1rh8dfM41f/W3lcTcFihHM6RDx45Q3Lz9hfyrT8tttlWRA7prvlXu6bUOqMmNtvFFow+bJEo/HgCZHshvoDHcnlHfziU7bDCo+p50SdafFwZRe3AWp/f4TsxiP7jpBnluQM0Dl9Om8jfW8IYAJ+WxlKBsKLMkRH/HWSuigs4AQBD4ADiQfOm2RO4yeSiVFNwGFmgG7NmEq1sNALLAQw+ijN9vyiD99ybr0pqoJX3vhyRBWvCrgQdHjh8ucaoMXI89LxyYts/ igorbonadio@marvin.local")
|
9
9
|
Executor.new(stdin, home, repo_dir)
|
10
10
|
end
|
11
11
|
|
@@ -47,7 +47,7 @@ module Gritano
|
|
47
47
|
keys = double()
|
48
48
|
key = double()
|
49
49
|
key.should_receive(:valid?).and_return(true)
|
50
|
-
keys.should_receive(:create).with(name: "keyname", key: "
|
50
|
+
keys.should_receive(:create).with(name: "keyname", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9UnnlDwmvid+WRAyIhVzFhIjUUxA3Wul7LN8mk18dHZDv5HSVADmM4EoqbVSbpeVIyTIchqS3y3XF1rh8dfM41f/W3lcTcFihHM6RDx45Q3Lz9hfyrT8tttlWRA7prvlXu6bUOqMmNtvFFow+bJEo/HgCZHshvoDHcnlHfziU7bDCo+p50SdafFwZRe3AWp/f4TsxiP7jpBnluQM0Dl9Om8jfW8IYAJ+WxlKBsKLMkRH/HWSuigs4AQBD4ADiQfOm2RO4yeSiVFNwGFmgG7NmEq1sNALLAQw+ijN9vyiD99ybr0pqoJX3vhyRBWvCrgQdHjh8ucaoMXI89LxyYts/").and_return(key)
|
51
51
|
user.should_receive(:keys).and_return(keys)
|
52
52
|
User.should_receive(:find_by_login).with("login").and_return(user)
|
53
53
|
create_executor('.', 'tmp').execute(["user:key:add", "login", "keyname"])
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
module Gritano
|
4
|
+
describe Config do
|
5
|
+
it "should have a ssh configuration" do
|
6
|
+
config = YAML::load(File.open(File.join('.gritano', 'config.yml')))
|
7
|
+
config['ssh'].should be_false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/spec/model_key_spec.rb
CHANGED
@@ -30,9 +30,15 @@ module Gritano
|
|
30
30
|
key.user.should == user
|
31
31
|
end
|
32
32
|
|
33
|
-
it "should generate the authorized_keys files" do
|
33
|
+
it "should generate the authorized_keys files if ssh's configurations is false" do
|
34
34
|
create_new_user_and_key
|
35
|
-
Key.authorized_keys.should == "command=\"gritano-remote igor\" sshkey\n"
|
35
|
+
Key.authorized_keys.should == "command=\"gritano-remote igor\" sshkey\n\n"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should not generate the authorized_keys files if ssh's configurations is true" do
|
39
|
+
user, key = create_new_user_and_key
|
40
|
+
Key.config = YAML::load(File.open(File.join('features', 'data', 'config_true.yml')))
|
41
|
+
Key.authorized_keys.should == ""
|
36
42
|
end
|
37
43
|
end
|
38
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gritano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -192,6 +192,7 @@ description: Gritano is the simplest way to configure your git server over ssh.
|
|
192
192
|
email: igorbonadio@gmail.com
|
193
193
|
executables:
|
194
194
|
- gritano
|
195
|
+
- gritano-pub-key
|
195
196
|
- gritano-remote
|
196
197
|
extensions: []
|
197
198
|
extra_rdoc_files:
|
@@ -200,6 +201,7 @@ extra_rdoc_files:
|
|
200
201
|
- TODO
|
201
202
|
files:
|
202
203
|
- .document
|
204
|
+
- .gritano/config.yml
|
203
205
|
- .gritano/database.yml
|
204
206
|
- .rspec
|
205
207
|
- .ssh/.gitignore
|
@@ -210,12 +212,16 @@ files:
|
|
210
212
|
- Rakefile
|
211
213
|
- VERSION
|
212
214
|
- bin/gritano
|
215
|
+
- bin/gritano-pub-key
|
213
216
|
- bin/gritano-remote
|
214
217
|
- db/migrate/001_create_users.rb
|
215
218
|
- db/migrate/002_create_repositories.rb
|
216
219
|
- db/migrate/003_create_permissions.rb
|
217
220
|
- db/migrate/004_create_keys.rb
|
218
221
|
- db/migrate/005_add_admin_to_users.rb
|
222
|
+
- features/data/config_true.yml
|
223
|
+
- features/data/local_commands/addon_list.txt
|
224
|
+
- features/data/local_commands/addon_ssh_install.txt
|
219
225
|
- features/data/local_commands/repo_add_tmp_jeka_git.txt
|
220
226
|
- features/data/local_commands/repo_add_tmp_p_lang_git.txt
|
221
227
|
- features/data/local_commands/repo_add_tmp_p_lang_git_igorbonadio.txt
|
@@ -256,6 +262,8 @@ files:
|
|
256
262
|
- features/data/local_commands/user_rm_jose.txt
|
257
263
|
- features/data/local_commands/version.txt
|
258
264
|
- features/data/local_help.txt
|
265
|
+
- features/data/remote_commands/admin_addon_list_igorbonadio.txt
|
266
|
+
- features/data/remote_commands/admin_addon_list_jessicaeto.txt
|
259
267
|
- features/data/remote_commands/admin_help_igorbonadio.txt
|
260
268
|
- features/data/remote_commands/admin_help_jessicaeto.txt
|
261
269
|
- features/data/remote_commands/admin_repo_add_tmp_jeka_git_igorbonadio.txt
|
@@ -353,10 +361,12 @@ files:
|
|
353
361
|
- features/data/remote_help.txt
|
354
362
|
- features/install.feature
|
355
363
|
- features/local.feature
|
364
|
+
- features/pub_key.feature
|
356
365
|
- features/remote.feature
|
357
366
|
- features/step_definitions/background_step.rb
|
358
367
|
- features/step_definitions/install_step.rb
|
359
368
|
- features/step_definitions/local_step.rb
|
369
|
+
- features/step_definitions/pub_key_step.rb
|
360
370
|
- features/step_definitions/remote_step.rb
|
361
371
|
- features/support/database_cleaner.rb
|
362
372
|
- features/support/env.rb
|
@@ -369,6 +379,7 @@ files:
|
|
369
379
|
- lib/gritano/console/gritano.rb
|
370
380
|
- lib/gritano/console/installer.rb
|
371
381
|
- lib/gritano/console/remote.rb
|
382
|
+
- lib/gritano/console/ssh_install.txt
|
372
383
|
- lib/gritano/models.rb
|
373
384
|
- lib/gritano/models/key.rb
|
374
385
|
- lib/gritano/models/permission.rb
|
@@ -382,6 +393,7 @@ files:
|
|
382
393
|
- spec/console_remote_spec.rb
|
383
394
|
- spec/console_spec.rb
|
384
395
|
- spec/data/help_command_name.txt
|
396
|
+
- spec/model_config_spec.rb
|
385
397
|
- spec/model_key_spec.rb
|
386
398
|
- spec/model_permission_spec.rb
|
387
399
|
- spec/model_repository_spec.rb
|
@@ -403,7 +415,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
403
415
|
version: '0'
|
404
416
|
segments:
|
405
417
|
- 0
|
406
|
-
hash:
|
418
|
+
hash: 3059222236769811934
|
407
419
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
408
420
|
none: false
|
409
421
|
requirements:
|
@@ -412,7 +424,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
424
|
version: '0'
|
413
425
|
requirements: []
|
414
426
|
rubyforge_project:
|
415
|
-
rubygems_version: 1.8.
|
427
|
+
rubygems_version: 1.8.25
|
416
428
|
signing_key:
|
417
429
|
specification_version: 3
|
418
430
|
summary: Gritano is a tool to configure your git server over ssh
|