diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-09-28 15:46:09 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-09-28 15:46:09 +0000 |
commit | 3cf936123cda48a8856fb6cd534331f2dabe9e15 (patch) | |
tree | c4b4754790e619082ca935cef0bb489f3a6470b6 /bin/gitlab-shell-ruby | |
parent | 1cc2993f357c4467e4d45c54c01d2307103efb3e (diff) | |
parent | f435c4644abc167cdfe6bfe3d320ff840f468c09 (diff) | |
download | gitlab-shell-3cf936123cda48a8856fb6cd534331f2dabe9e15.tar.gz |
Merge branch '74-go-go-go-go-go' into 'master'
Feature flag for go/ruby gitlab-shell implementations
Closes #74
See merge request gitlab-org/gitlab-shell!233
Diffstat (limited to 'bin/gitlab-shell-ruby')
-rwxr-xr-x | bin/gitlab-shell-ruby | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/gitlab-shell-ruby b/bin/gitlab-shell-ruby new file mode 100755 index 0000000..93a79f6 --- /dev/null +++ b/bin/gitlab-shell-ruby @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby + +unless ENV['SSH_CONNECTION'] + puts "Only ssh allowed" + exit +end + +original_cmd = ENV.delete('SSH_ORIGINAL_COMMAND') + +require_relative '../lib/gitlab_init' + +# +# +# GitLab shell, invoked from ~/.ssh/authorized_keys or from an +# AuthorizedPrincipalsCommand in the key-less SSH CERT mode. +# +# +require File.join(ROOT_PATH, 'lib', 'gitlab_shell') + +# We must match e.g. "key-12345" anywhere on the command-line. See +# https://gitlab.com/gitlab-org/gitlab-shell/issues/145 +who = /\b(?:(?:key|user)-[0-9]+|username-\S+)\b/.match(ARGV.join(' ')).to_s + +if GitlabShell.new(who).exec(original_cmd) + exit 0 +else + exit 1 +end |