From 1f8556b2f86d7954f86f4a9a58f586a838f8ae21 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Tue, 28 Aug 2018 10:37:07 +0200 Subject: Initial feature-flagged go/ruby switch --- bin/gitlab-shell-ruby | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 bin/gitlab-shell-ruby (limited to 'bin/gitlab-shell-ruby') 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 -- cgit v1.2.1