Accept DSA public keys ("ssh-dss"), not just RSA.
authorTom Clegg <tom@curoverse.com>
Fri, 17 Jan 2014 21:02:35 +0000 (13:02 -0800)
committerTom Clegg <tom@curoverse.com>
Fri, 17 Jan 2014 21:02:35 +0000 (13:02 -0800)
refs #1880

services/api/app/models/authorized_key.rb

index 14db0b112668a036b9e4454c44de78d8038a922f..a6bc06593a58d15cfa0ae854669613650666424f 100644 (file)
@@ -33,10 +33,10 @@ class AuthorizedKey < ArvadosModel
 
   def public_key_must_be_unique
     if self.public_key
-      key = /ssh-rsa [A-Za-z0-9+\/]+/.match(self.public_key)
+      key = /^ssh-(rsa|dss) [A-Za-z0-9+\/=\+]+\b/.match(self.public_key)
       
       if not key
-        errors.add(:public_key, "does not appear to be a valid ssh-rsa key")
+        errors.add(:public_key, "does not appear to be a valid ssh-rsa or dsa public key")
       else
         # Valid if no other rows have this public key
         if self.class.where('public_key like ?', "%#{key[0]}%").any?