summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-10-14 16:00:48 +0100
committerNick Thomas <nick@gitlab.com>2019-10-15 07:44:13 +0100
commit18096b5440e0818605add32538751c6be38e8343 (patch)
treeb4aebac9d7f752156ee4ec3d44ee990021a1b295 /bin
parent8db304b4919519bca60a5b18ffe9b88dcde845af (diff)
downloadgitlab-shell-18096b5440e0818605add32538751c6be38e8343.tar.gz
Remove dead Ruby code
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gitlab-shell-authorized-keys-check-ruby42
-rwxr-xr-xbin/gitlab-shell-authorized-principals-check-ruby36
-rwxr-xr-xbin/gitlab-shell-ruby28
-rwxr-xr-xbin/test-logger10
4 files changed, 0 insertions, 116 deletions
diff --git a/bin/gitlab-shell-authorized-keys-check-ruby b/bin/gitlab-shell-authorized-keys-check-ruby
deleted file mode 100755
index 2ea1a74..0000000
--- a/bin/gitlab-shell-authorized-keys-check-ruby
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env ruby
-
-#
-# GitLab shell authorized_keys helper. Query GitLab API to get the authorized
-# command for a given ssh key fingerprint
-#
-# Ex.
-# bin/gitlab-shell-authorized-keys-check <username> <public-key>
-#
-# Returns
-# command="/bin/gitlab-shell key-#",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAA...
-#
-# Expects to be called by the SSH daemon, via configuration like:
-# AuthorizedKeysCommandUser git
-# AuthorizedKeysCommand /bin/gitlab-shell-authorized-keys-check git %u %k
-
-abort "# Wrong number of arguments. #{ARGV.size}. Usage:
-# gitlab-shell-authorized-keys-check <expected-username> <actual-username> <key>" unless ARGV.size == 3
-
-expected_username = ARGV[0]
-abort '# No username provided' if expected_username.nil? || expected_username == ''
-
-actual_username = ARGV[1]
-abort '# No username provided' if actual_username.nil? || actual_username == ''
-
-# Only check access if the requested username matches the configured username.
-# Normally, these would both be 'git', but it can be configured by the user
-exit 0 unless expected_username == actual_username
-
-key = ARGV[2]
-abort "# No key provided" if key.nil? || key == ''
-
-require_relative '../lib/gitlab_init'
-require_relative '../lib/gitlab_net'
-require_relative '../lib/gitlab_keys'
-
-authorized_key = GitlabNet.new.authorized_key(key)
-if authorized_key.nil?
- puts "# No key was found for #{key}"
-else
- puts GitlabKeys.key_line("key-#{authorized_key['id']}", authorized_key['key'])
-end
diff --git a/bin/gitlab-shell-authorized-principals-check-ruby b/bin/gitlab-shell-authorized-principals-check-ruby
deleted file mode 100755
index 25ee612..0000000
--- a/bin/gitlab-shell-authorized-principals-check-ruby
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env ruby
-
-#
-# GitLab shell authorized principals helper. Emits the same sort of
-# command="..." line as gitlab-shell-authorized-principals-check, with
-# the right options.
-#
-# Ex.
-# bin/gitlab-shell-authorized-keys-check <key-id> <principal1> [<principal2>...]
-#
-# Returns one line per principal passed in, e.g.:
-# command="/bin/gitlab-shell username-{KEY_ID}",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty {PRINCIPAL}
-# [command="/bin/gitlab-shell username-{KEY_ID}",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty {PRINCIPAL2}]
-#
-# Expects to be called by the SSH daemon, via configuration like:
-# AuthorizedPrincipalsCommandUser root
-# AuthorizedPrincipalsCommand /bin/gitlab-shell-authorized-principals-check git %i sshUsers
-
-abort "# Wrong number of arguments. #{ARGV.size}. Usage:
-# gitlab-shell-authorized-principals-check <key-id> <principal1> [<principal2>...]" unless ARGV.size >= 2
-
-key_id = ARGV[0]
-abort '# No key_id provided' if key_id.nil? || key_id == ''
-
-principals = ARGV[1..-1]
-principals.each { |principal|
- abort '# An invalid principal was provided' if principal.nil? || principal == ''
-}
-
-require_relative '../lib/gitlab_init'
-require_relative '../lib/gitlab_net'
-require_relative '../lib/gitlab_keys'
-
-principals.each { |principal|
- puts GitlabKeys.principal_line("username-#{key_id}", principal.dup)
-}
diff --git a/bin/gitlab-shell-ruby b/bin/gitlab-shell-ruby
deleted file mode 100755
index 8d43cf1..0000000
--- a/bin/gitlab-shell-ruby
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/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)-[0-9]+|username-\S+)\b/.match(ARGV.join(' ')).to_s
-
-if GitlabShell.new(who).exec(original_cmd)
- exit 0
-else
- exit 1
-end
diff --git a/bin/test-logger b/bin/test-logger
deleted file mode 100755
index 11b2a55..0000000
--- a/bin/test-logger
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-
-# The purpose of this executable is to test that gitlab-shell logging
-# works correctly in combination with Kernel.exec.
-
-require_relative '../lib/gitlab_init'
-require_relative '../lib/gitlab_logger'
-
-$logger.info(ARGV.first)
-Kernel.exec('true')