On 1/6/22, 18:29, "Damien Miller" <djm@xxxxxxxxxxx> wrote: On Fri, 7 Jan 2022, Morgan, Iain (ARC-TN)[InuTeq, LLC] wrote: > Hi Damien, > > The restricted agent keys functionality sounds really interesting. > Are there any plans to support embedding the restrictions in the keys > themselves at some point? That would make this much easier to use, but > it would require extending the key format and adding the appropriate > parsing in ssh-agent or ssh-add. I hadn't considered that before - how would it envision it working? Yes, the key format would require extension and that isn't a trivial change because of backwards-compatibility :( -d I haven't given the details much thought and haven't delved into the OpenSSH code in quite a while, so my idea is rather sketchy at this point. What we would want is some way of associating the restrictions with a key so that they are automatically applied when the key is loaded into the agent, either by ssh-add or when triggered by AddKeysToAgent. That would either mean adding the restrictions to the private key, or adding another file that is associated with the key which contains the restrictions. The latter would be easier to implement from a backwards-compatibility standpoint, but I'm not particularly happy about adding another file type. The file containing the options would be assumed to be in the same directory as the private key, and would be formed by adding an extension such as ".opts" or ".cfg" to the name of the private key. I don't have any specific ideas as to how to express the restrictions, but we would probably want one line for each allowed path. Also, the ssh-add command line should be able to override the restrictions. Perhaps the syntax might be something like: AllowedPath: foo.example.com > bar.example.com ... Alternatively, perhaps it would be possible to include the restrictions as plain-text in the private key, before the "-----BEGIN" line. That assumes that any text outside of the BEGIN ... END sequence is ignored by existing implementations. As an aside, either approach should allow for adding support for other kinds of restrictions. For example, it might be convenient to add a Timeout parameter that would correspond to the -t option with ssh-add. -- Iain _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@xxxxxxxxxxx https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev