diff --git a/debian/patches/Add-support-for-md5-and-sha256-cypted-passwords.patch b/debian/patches/Add-support-for-md5-and-sha256-cypted-passwords.patch
new file mode 100644
index 0000000000000000000000000000000000000000..fd9276e5558af9bc880e677bff8cb9e26927acb3
--- /dev/null
+++ b/debian/patches/Add-support-for-md5-and-sha256-cypted-passwords.patch
@@ -0,0 +1,42 @@
+From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+Date: Mon, 20 Feb 2017 10:40:34 +0100
+Subject: Add support for md5 and sha256 cypted() passwords
+
+In some of our deployments we synchronize passwords as crypted by the
+standard unix crypt into the OBS accounts database. This patch adds
+support for the OBS side to recognize/support md5 and sha256 crypted
+passwords, sha512 should be trivial to add but needs a database schema
+update (the password_crypted is too small)
+
+Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+---
+ src/api/app/models/user.rb | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/api/app/models/user.rb b/src/api/app/models/user.rb
+index 44f44e0..3cfa026 100644
+--- a/src/api/app/models/user.rb
++++ b/src/api/app/models/user.rb
+@@ -1026,7 +1026,7 @@ class User < ActiveRecord::Base
+ 
+   # This method returns an array which contains all valid hash types.
+   def self.default_password_hash_types
+-    %w(md5)
++    %w(md5, md5crypt, sha256crypt)
+   end
+ 
+   def self.update_notifications(params, user = nil)
+@@ -1058,8 +1058,12 @@ class User < ActiveRecord::Base
+   # Hashes the given parameter by the selected hashing method. It uses the
+   # "password_salt" property's value to make the hashing more secure.
+   def hash_string(value)
++    crypt2index = { "md5crypt" => 1,
++                    "sha256crypt" => 5 }
+     if password_hash_type == "md5"
+-      Digest::MD5.hexdigest(value + self.password_salt)
++      Digest::MD5.hexdigest(value + password_salt)
++    elsif crypt2index.keys.include?(password_hash_type)
++      value.crypt("$#{crypt2index[password_hash_type]}$#{password_salt}$").split("$")[3]
+     end
+   end
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 4d88fe8c14b9656e5739c8ef9eb306fc237294e8..993222bbd9326c6a352c96e675721a547f2df961 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -23,3 +23,4 @@ BSConfig.pm.template_include_a_skeleton_reprepro.patch
 Include_ddebs_in_reprepro_too_and_fix_inclusion_of_udebs.patch
 bs_publish_improve-logging_for_reprepro_invocations.patch
 publisher_reprepro_set_surprising_binary.patch
+Add-support-for-md5-and-sha256-cypted-passwords.patch