大网数据广告活动
服务器运维问答

ssh-keygen: signing syntax - help needed with options

· 52CE 我爱测

I am trying to sign some SSH keys with restricted options. My initial attempt was as follows: ssh-keygen -s /path/to/ca-ssh.pem -D opensc-pkcs11.so -n barfoo -O no-agent-forwarding -O no-port-forwarding -O no-x11-forwarding -O no…

问题原文

原帖链接 · Little Code · CC BY-SA 4.0

I am trying to sign some SSH keys with restricted options.

My initial attempt was as follows:

ssh-keygen -s /path/to/ca-ssh.pem -D opensc-pkcs11.so -n barfoo -O no-agent-forwarding -O no-port-forwarding -O no-x11-forwarding -O no-user-rc -O no-pty -I foo -z 12345 /path/to/pub

However this yields a result with no options present:

    $ ssh-keygen -L -f
    Type: [email omitted] user certificate                                                                                                                           
    Public key: ED25519-CERT SHA256:secretsquirrel                                                                                                      
    Signing CA: RSA SHA256: secretsquirrel                                                                                                                
    Key ID: "foo"                                                                                                                                        
    Serial: 12345                                                                                                                                                       
    Valid: forever                                                                                                                                                                    
    Principals:                                                                                                                                                                       
            barfoo                                                                                                                                                                       
    Critical Options: (none)                                                                                                                                                          
    Extensions: (none)  

First I thought I would add -O clear before the other options. But that yielded the same result (none).

So I then thought I would try -O critical:no-agent-forwarding style syntax, but this yeilds:

Critical Options:
        no-agent-forwarding UNKNOWN OPTION (len 0)

Finally I tried -O critical:no-agent-forwarding=true, but this yields the same UNKNOWN OPTION as above.

Not that it should matter, but the versions I'm using are :

  • Debian 10 (buster)
  • OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d 10 Sep 2019

已采纳解答

原帖链接 · Sturban · CC BY-SA 4.0

You have actually already achieved what you want to do: disable all permissions, which means your list of "extensions" is empty. See what happens if you do not use -O at all, i.e ssh-keygen -s /path/to/ca-ssh.pem -D opensc-pkcs11.so -n barfoo -I foo -z 12345 /path/to/pub -What extensions are enabled then?

-All the options you are using are "no-xxxx" which means you are disabling extensions and thus emptying the list of extensions. -Instead of disabling/removing them one by one, you could use -O clear only. From the man-page:

clear ---- Clear all enabled permissions. This is useful for clearing the default set of permissions so permissions may be added individually.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-11-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。