<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/9157">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">redmine: Add OpenID Digest::HMAC fix<br><br>From Holger:<br>Digest: This seems a bit of the magic of ruby but I vaguely remember having seen this before. I have<br>either patched or backported a fix. In newer Ruby versions "Digest" has been deprecated. The diff to<br>"stock" openid 2.3.0 is:<br><br>Change-Id: Idaca479140846481372ad0e1bff741bb09010847<br>Related: OS#3081<br>---<br>M redmine/Dockerfile<br>A redmine/redmine-openid-hmac-digest.diff<br>2 files changed, 49 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/57/9157/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/redmine/Dockerfile b/redmine/Dockerfile</span><br><span>index 67b00a8..81976c6 100644</span><br><span>--- a/redmine/Dockerfile</span><br><span>+++ b/redmine/Dockerfile</span><br><span>@@ -9,3 +9,6 @@</span><br><span> </span><br><span> COPY  redmine-issue-2047-svg-image-support.diff /tmp/redmine-issue-2047-svg-image-support.diff</span><br><span> RUN cd app && patch -p1 < /tmp/redmine-issue-2047-svg-image-support.diff</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+COPY redmine-openid-hmac-digest.diff /tmp/</span><br><span style="color: hsl(120, 100%, 40%);">+RUN      cd /usr/local/bundle/gems/ruby-openid-2.3.0 && patch -p0 < /tmp/redmine-openid-hmac-digest.diff</span><br><span>diff --git a/redmine/redmine-openid-hmac-digest.diff b/redmine/redmine-openid-hmac-digest.diff</span><br><span>new file mode 100644</span><br><span>index 0000000..e5b22dc</span><br><span>--- /dev/null</span><br><span>+++ b/redmine/redmine-openid-hmac-digest.diff</span><br><span>@@ -0,0 +1,46 @@</span><br><span style="color: hsl(120, 100%, 40%);">+diff -Nurd lib/openid/cryptutil.rb</span><br><span style="color: hsl(120, 100%, 40%);">+/usr/local/lib/ruby/gems/2.3/gems/ruby-openid-2.3.0/lib/openid/cryptutil.rb</span><br><span style="color: hsl(120, 100%, 40%);">+--- lib/openid/cryptutil.rb     1970-01-01 00:00:00.000000000 +0000</span><br><span>++++ /usr/local/lib/ruby/gems/2.3/gems/ruby-openid-2.3.0/lib/openid/cryptutil.rb 2017-07-17</span><br><span style="color: hsl(120, 100%, 40%);">+18:25:45.146746571 +0000</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -2,7 +2,7 @@</span><br><span style="color: hsl(120, 100%, 40%);">+ require "digest/sha1"</span><br><span style="color: hsl(120, 100%, 40%);">+ require "digest/sha2"</span><br><span style="color: hsl(120, 100%, 40%);">+ begin</span><br><span style="color: hsl(120, 100%, 40%);">+-  require "digest/hmac"</span><br><span style="color: hsl(120, 100%, 40%);">++  require "openssl"</span><br><span style="color: hsl(120, 100%, 40%);">+ rescue LoadError</span><br><span style="color: hsl(120, 100%, 40%);">+   begin</span><br><span style="color: hsl(120, 100%, 40%);">+     # Try loading the ruby-hmac files if they exist</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -33,27 +33,19 @@</span><br><span style="color: hsl(120, 100%, 40%);">+     end</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     def CryptUtil.sha1(text)</span><br><span style="color: hsl(120, 100%, 40%);">+-      return Digest::SHA1.digest(text)</span><br><span style="color: hsl(120, 100%, 40%);">++      return OpenSSL::Digest.new('sha1').digest(text)</span><br><span style="color: hsl(120, 100%, 40%);">+     end</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     def CryptUtil.hmac_sha1(key, text)</span><br><span style="color: hsl(120, 100%, 40%);">+-      if Digest.const_defined? :HMAC</span><br><span style="color: hsl(120, 100%, 40%);">+-        Digest::HMAC.new(key,Digest::SHA1).update(text).digest</span><br><span style="color: hsl(120, 100%, 40%);">+-      else</span><br><span style="color: hsl(120, 100%, 40%);">+-        return HMAC::SHA1.digest(key, text)</span><br><span style="color: hsl(120, 100%, 40%);">+-      end</span><br><span style="color: hsl(120, 100%, 40%);">++      return OpenSSL::HMAC.digest('sha1', key, text)</span><br><span style="color: hsl(120, 100%, 40%);">+     end</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     def CryptUtil.sha256(text)</span><br><span style="color: hsl(120, 100%, 40%);">+-      return Digest::SHA256.digest(text)</span><br><span style="color: hsl(120, 100%, 40%);">++      return OpenSSL::Digest.new('sha256').digest(text)</span><br><span style="color: hsl(120, 100%, 40%);">+     end</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     def CryptUtil.hmac_sha256(key, text)</span><br><span style="color: hsl(120, 100%, 40%);">+-      if Digest.const_defined? :HMAC</span><br><span style="color: hsl(120, 100%, 40%);">+-        Digest::HMAC.new(key,Digest::SHA256).update(text).digest</span><br><span style="color: hsl(120, 100%, 40%);">+-      else</span><br><span style="color: hsl(120, 100%, 40%);">+-        return HMAC::SHA256.digest(key, text)</span><br><span style="color: hsl(120, 100%, 40%);">+-      end</span><br><span style="color: hsl(120, 100%, 40%);">++      return OpenSSL::HMAC.digest('sha256', key, text)</span><br><span style="color: hsl(120, 100%, 40%);">+     end</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     # Generate a random string of the given length, composed of the</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9157">change 9157</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/9157"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: docker-playground </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Idaca479140846481372ad0e1bff741bb09010847 </div>
<div style="display:none"> Gerrit-Change-Number: 9157 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>