summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG3
-rw-r--r--VERSION2
-rwxr-xr-xbin/authorized_keys28
-rwxr-xr-xbin/compile9
-rw-r--r--support/go_build.rb2
5 files changed, 17 insertions, 27 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 8d0fc1d..339d8b0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+v9.4.2
+ - Repurpose bin/authorized_keys script !330
+
v9.4.1
- Fix bug preventing gitlab-development-kit from updating !327
diff --git a/VERSION b/VERSION
index ccfb75e..3c40359 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-9.4.1
+9.4.2
diff --git a/bin/authorized_keys b/bin/authorized_keys
index ca01646..206a17d 100755
--- a/bin/authorized_keys
+++ b/bin/authorized_keys
@@ -1,25 +1,9 @@
-#!/usr/bin/env ruby
+#!/bin/sh
+# Legacy script used for AuthorizedKeysCommand when configured without username.
+# Executes gitlab-shell-authorized-keys-check with "git" as expected and actual
+# username and with the passed key.
#
-# GitLab shell authorized_keys. Query GitLab API to get the authorized command for a given ssh key fingerprint
-#
-# Ex.
-# /bin/authorized_keys BASE64-KEY
-#
-# Returns
-# command="/bin/gitlab-shell key-#",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQA...
-#
-
-key = ARGV[0]
-abort "# No key provided" if key.nil? || key.empty?
-
-require_relative "../lib/gitlab_init"
-require_relative "../lib/gitlab_net"
-require_relative "../lib/gitlab_keys"
+# TODO: Remove this in https://gitlab.com/gitlab-org/gitlab-shell/issues/209.
-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
+$(dirname $0)/gitlab-shell-authorized-keys-check git git $1
diff --git a/bin/compile b/bin/compile
index 229b8fd..e6eacca 100755
--- a/bin/compile
+++ b/bin/compile
@@ -5,13 +5,16 @@ require 'fileutils'
require_relative '../support/go_build'
include GoBuild
+BUILD_BIN_GLOB = File.join(BUILD_DIR, 'bin', '*')
+ROOT_BIN = File.join(ROOT_PATH, 'bin')
+
def main
ensure_build_dir_exists
- run!(GO_ENV, %W[go install ./cmd/...], chdir: File.join(ROOT_PATH, GO_DIR))
- executables = Dir[File.join(BUILD_DIR, 'bin', '*')]
+ run!(GO_ENV, %W[go install ./cmd/...], chdir: GO_DIR)
+ executables = Dir[BUILD_BIN_GLOB]
FileUtils.chmod(0755, executables)
- FileUtils.cp(executables, File.join(ROOT_PATH, 'bin'))
+ FileUtils.cp(executables, ROOT_BIN)
end
main
diff --git a/support/go_build.rb b/support/go_build.rb
index 1ef2e17..42e207a 100644
--- a/support/go_build.rb
+++ b/support/go_build.rb
@@ -6,7 +6,7 @@ require 'fileutils'
require_relative '../lib/gitlab_init'
module GoBuild
- GO_DIR = 'go'.freeze
+ GO_DIR = File.join(ROOT_PATH, 'go')
BUILD_DIR = File.join(ROOT_PATH, 'go_build')
GO_ENV = {