From c40943b646f240b10b8dd2c10f6c19d6381d06d2 Mon Sep 17 00:00:00 2001 From: Robert Havelka Date: Tue, 19 Dec 2017 08:42:29 +0100 Subject: [PATCH 1/4] ruby gem dependency - swd 1.0.1 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index f3e221f..cacda83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ MAINTAINER Computer Science House # Install the OpenID Connect strategy for OmniAuth RUN cd /opt/gitlab/embedded/service/gitlab-rails \ + && printf "\ngem 'swd', '~> 1.0.1'" >> Gemfile \ && printf "\n# OpenID Connect OmniAuth strategy\ngem 'omniauth-openid-connect'" >> Gemfile \ && /opt/gitlab/embedded/bin/bundle install --without development test From 80c0d7ca49a18ca496e98558430f9021a8b7453e Mon Sep 17 00:00:00 2001 From: Robert Havelka Date: Tue, 19 Dec 2017 08:51:23 +0100 Subject: [PATCH 2/4] patch for user.rb for newer gitlab version --- patches/user.rb.patch | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/patches/user.rb.patch b/patches/user.rb.patch index bf8df89..95c39bc 100644 --- a/patches/user.rb.patch +++ b/patches/user.rb.patch @@ -1,13 +1,10 @@ -diff --git a/user.rb.orig b/user.rb -index 7704bf7..1315489 100644 ---- a/user.rb.orig -+++ b/user.rb -@@ -109,6 +109,8 @@ module Gitlab - +--- ./lib/gitlab/o_auth/user.rb ++++ ./lib/gitlab/o_auth/user-patched.rb +@@ -119,6 +119,7 @@ + def find_ldap_person(auth_hash, adapter) - by_uid = Gitlab::LDAP::Person.find_by_uid(auth_hash.uid, adapter) -+ # The `uid` might actually be a UUID. Try it next. -+ by_uid || Gitlab::LDAP::Person.find_by_uuid(auth_hash.uid, adapter) - # The `uid` might actually be a DN. Try it next. - by_uid || Gitlab::LDAP::Person.find_by_dn(auth_hash.uid, adapter) + Gitlab::LDAP::Person.find_by_uid(auth_hash.uid, adapter) || ++ Gitlab::LDAP::Person.find_by_uuid(auth_hash.uid, adapter) || + Gitlab::LDAP::Person.find_by_email(auth_hash.uid, adapter) || + Gitlab::LDAP::Person.find_by_dn(auth_hash.uid, adapter) end From 0ee12a25c55facf77e4da3c4f1228ed383d1c3fb Mon Sep 17 00:00:00 2001 From: Robert Havelka Date: Wed, 27 Dec 2017 08:54:12 +0100 Subject: [PATCH 3/4] updating swd to lastest tested version 1.1.2 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cacda83..5697828 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER Computer Science House # Install the OpenID Connect strategy for OmniAuth RUN cd /opt/gitlab/embedded/service/gitlab-rails \ - && printf "\ngem 'swd', '~> 1.0.1'" >> Gemfile \ + && printf "\ngem 'swd', '~> 1.1.2'" >> Gemfile \ && printf "\n# OpenID Connect OmniAuth strategy\ngem 'omniauth-openid-connect'" >> Gemfile \ && /opt/gitlab/embedded/bin/bundle install --without development test From 2764e15f1777e22f2e3a1c8a62c679b4e9aba274 Mon Sep 17 00:00:00 2001 From: Robert Havelka Date: Wed, 28 Mar 2018 08:27:54 +0200 Subject: [PATCH 4/4] new dir structure and small changes in code for 10.6 --- Dockerfile | 5 ++--- patches/person.rb.patch | 28 +++++++++++++--------------- patches/user.rb.patch | 18 +++++++++--------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5697828..3169c23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,6 @@ MAINTAINER Computer Science House # Install the OpenID Connect strategy for OmniAuth RUN cd /opt/gitlab/embedded/service/gitlab-rails \ - && printf "\ngem 'swd', '~> 1.1.2'" >> Gemfile \ && printf "\n# OpenID Connect OmniAuth strategy\ngem 'omniauth-openid-connect'" >> Gemfile \ && /opt/gitlab/embedded/bin/bundle install --without development test @@ -14,8 +13,8 @@ ADD patches/*.patch /tmp/ RUN apt-get -y update \ && apt-get -y install patch \ && patch /opt/gitlab/embedded/service/gitlab-rails/app/controllers/omniauth_callbacks_controller.rb /tmp/omniauth_callbacks_controller.patch \ - && patch /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/o_auth/user.rb /tmp/user.rb.patch \ - && patch /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ldap/person.rb /tmp/person.rb.patch \ + && patch /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/auth/o_auth/user.rb /tmp/user.rb.patch \ + && patch /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/auth/ldap/person.rb /tmp/person.rb.patch \ && apt-get -y remove patch \ && apt-get -y clean \ && rm -f /tmp/*.patch diff --git a/patches/person.rb.patch b/patches/person.rb.patch index b7fcd47..eada5be 100644 --- a/patches/person.rb.patch +++ b/patches/person.rb.patch @@ -1,16 +1,14 @@ -diff --git a/person.rb.orig b/person.rb -index 4d6f8ac..1a2cb35 100644 ---- a/person.rb.orig -+++ b/person.rb -@@ -8,6 +8,11 @@ module Gitlab - - attr_accessor :entry, :provider - -+ def self.find_by_uuid(uuid, adapter) -+ uuid = Net::LDAP::Filter.escape(uuid) -+ adapter.user('entryUUID', uuid) -+ end +--- ./lib/gitlab/auth/ldap/person.rb ++++ ./lib/gitlab/auth/ldap/person.rb.patched +@@ -11,6 +11,11 @@ + + attr_accessor :entry, :provider + ++ def self.find_by_uuid(uuid, adapter) ++ uuid = Net::LDAP::Filter.escape(uuid) ++ adapter.user('entryUUID', uuid) ++ end + - def self.find_by_uid(uid, adapter) - uid = Net::LDAP::Filter.escape(uid) - adapter.user(adapter.config.uid, uid) + def self.find_by_uid(uid, adapter) + uid = Net::LDAP::Filter.escape(uid) + adapter.user(adapter.config.uid, uid) diff --git a/patches/user.rb.patch b/patches/user.rb.patch index 95c39bc..2755ea4 100644 --- a/patches/user.rb.patch +++ b/patches/user.rb.patch @@ -1,10 +1,10 @@ ---- ./lib/gitlab/o_auth/user.rb -+++ ./lib/gitlab/o_auth/user-patched.rb -@@ -119,6 +119,7 @@ +--- ./lib/gitlab/auth/o_auth/user.rb ++++ ./lib/gitlab/auth/o_auth/user.rb.patched +@@ -122,6 +122,7 @@ - def find_ldap_person(auth_hash, adapter) - Gitlab::LDAP::Person.find_by_uid(auth_hash.uid, adapter) || -+ Gitlab::LDAP::Person.find_by_uuid(auth_hash.uid, adapter) || - Gitlab::LDAP::Person.find_by_email(auth_hash.uid, adapter) || - Gitlab::LDAP::Person.find_by_dn(auth_hash.uid, adapter) - end + def find_ldap_person(auth_hash, adapter) + Gitlab::Auth::LDAP::Person.find_by_uid(auth_hash.uid, adapter) || ++ Gitlab::Auth::LDAP::Person.find_by_uuid(auth_hash.uid, adapter) || + Gitlab::Auth::LDAP::Person.find_by_email(auth_hash.uid, adapter) || + Gitlab::Auth::LDAP::Person.find_by_dn(auth_hash.uid, adapter) + end