diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitano/config.lua | 11 | ||||
-rw-r--r-- | lib/gitano/sssc | 8 | ||||
-rw-r--r-- | lib/gitano/sssc.pub | 1 | ||||
-rw-r--r-- | lib/gitano/usercommand.lua | 9 | ||||
-rw-r--r-- | lib/gitano/util.lua | 16 |
5 files changed, 32 insertions, 13 deletions
diff --git a/lib/gitano/config.lua b/lib/gitano/config.lua index 7227866..b42bfba 100644 --- a/lib/gitano/config.lua +++ b/lib/gitano/config.lua @@ -39,6 +39,7 @@ local log = require 'gitano.log' local lace = require 'gitano.lace' local i18n = require 'gitano.i18n' local pat = require 'gitano.patterns' +local util = require 'gitano.util' local luxio = require 'luxio' local sio = require 'luxio.simple' local clod = require 'clod' @@ -163,12 +164,10 @@ local function parse_admin_config(commit) if not (keytype and keydata and keytag) then return nil, i18n.expand("ERROR_BAD_KEY_SMELL", {filename=filename}) end - if (keytype ~= "ssh-rsa") and (keytype ~= "ssh-dss") and - (keytype ~= "ecdsa-sha2-nistp256") and - (keytype ~= "ecdsa-sha2-nistp384") and - (keytype ~= "ecdsa-sha2-nistp521") then - return nil, i18n.expand("ERROR_BAD_KEY_TYPE", - {keytype=keytype, filename=filename}) + + if util.ssh_type_is_invalid(keytype) then + return nil, i18n.expand("ERROR_BAD_KEY_TYPE", + {keytype=keytype, filename=filename}) end if all_keys[this_key] then diff --git a/lib/gitano/sssc b/lib/gitano/sssc new file mode 100644 index 0000000..fc7698f --- /dev/null +++ b/lib/gitano/sssc @@ -0,0 +1,8 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jYmMAAAAGYmNyeXB0AAAAGAAAABB9boSOPS ++mgFH73l4a0IuEAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIIrdZLaik3mrc173 +N+GlqEjroqCbDUNmtVHDWrF74W85AAAAoKS76JOFvqS6YW/J0jFgbcURVWT0Tjfd+Z+qS/ +uMt+5DDkzAE1f/Z69Fc3GB03tN7TVlnEeVDkPhFk+BmCddef9vg7c1pOeU1ENtGc+5KAVP +MVmurIQEu9r9qUJjntz61joGnF+WdOUFMGrv79lyciInB9F7ObEpB/XksWLX5V/+PFdBFF +gdmvs3hAbkANNYlpvao0w0kyD/HZOfh7kkykY= +-----END OPENSSH PRIVATE KEY----- diff --git a/lib/gitano/sssc.pub b/lib/gitano/sssc.pub new file mode 100644 index 0000000..3fe440d --- /dev/null +++ b/lib/gitano/sssc.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIrdZLaik3mrc173N+GlqEjroqCbDUNmtVHDWrF74W85 phillipsmyth@ct-lt-577 diff --git a/lib/gitano/usercommand.lua b/lib/gitano/usercommand.lua index af7141c..9c005a0 100644 --- a/lib/gitano/usercommand.lua +++ b/lib/gitano/usercommand.lua @@ -218,12 +218,9 @@ local function builtin_sshkey_run(conf, _, cmdline, env) "did not smell like an OpenSSH v2 key") return "exit", 1 end - - if (keytype ~= "ssh-rsa") and (keytype ~= "ssh-dss") and - (keytype ~= "ecdsa-sha2-nistp256") and - (keytype ~= "ecdsa-sha2-nistp384") and - (keytype ~= "ecdsa-sha2-nistp521") then - log.error("Unknown key type", keytype) + + if util.ssh_type_is_invalid(keytype) then + log.error("Unknown key type", keytype) return "exit", 1 end diff --git a/lib/gitano/util.lua b/lib/gitano/util.lua index 76183e3..7e34178 100644 --- a/lib/gitano/util.lua +++ b/lib/gitano/util.lua @@ -584,6 +584,18 @@ local function unlockfile(fh) fh:close() end +local function ssh_type_is_invalid(keytype) + if (keytype ~= "ssh-rsa") and + (keytype ~= "ssh-dss") and + (keytype ~= "ecdsa-sha2-nistp256") and + (keytype ~= "ecdsa-sha2-nistp384") and + (keytype ~= "ecdsa-sha2-nistp521") and + (keytype ~= "ssh-ed25519") then + return true + end + return false +end + return { parse_cmdline = _parse_cmdline, @@ -623,4 +635,6 @@ return { lockfile = lockfile, unlockfile = unlockfile, -} + ssh_type_is_invalid = ssh_type_is_invalid, +} + |