Embedding code into ssh keys

Hi

Its been a long time since I worked with ssh keys containing embedded shell commands and cannot remember how it is done.

Does anyone know of any sites that have a good tutorial on the subject? I'm not having much luck searching Google for it.

Incidentally, searching this forum for the keyword ssh returns -

Thanks in advance

Brad

Could you clarify what exactly are you trying to do here? Not the method, but the goal?

Hi

Thanks for responding.

I remember that I used to use a code deployment mechanism that had to be locked down and secure. The way it had been implemented was that code would be delivered via ssh using a specific key and user. Embedded within the key was some code, korn shell as I recal and a call to a C program.

The shell commands basically deleted the directory structure and then untarred the new deployment in its place.

The idea was that as the permissions on the entire repo were only read and execute, nobody could hijack it to do anything malicious.

I now have a requirement to implement something similar, but I can't remember how the code was added to the key and I seem to be struggling to come up with a good search term for google to find examples.

Cheers

Steady

To force a command, you insert into authorized_keys like this:

command="/path/to/script",no-port-forwarding,no-X11-forwarding ssh-rsa ...

Thanks

That's got me looking at a whole bunch of stuff.

It's not what I was talking about though.

I remember picking the code out of the key itself and reading through it. About the only thing I do remember about it was that it was { between; }.

The command= syntax substitutes whatever command is passed via ssh.

Not the same thing.

I'll keep digging :slight_smile:

it's very likely shell code was placed directly in the command="" then. it replaces the clients requested command in that the client no longer has any choice of what is ran. it sounds like exactly what you were describing.

Come to think of it, the key was dedicated to the task of deploying the code. So I guess that was it.

Thanks for the help :slight_smile: