Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: OpenSSH: Dev

OpenSSH and X.509 Certificate Support

 

 

OpenSSH dev RSS feed   Index | Next | Previous | View Threaded


sankalp_karpe at persistent

Feb 20, 2008, 2:32 AM

Post #1 of 16 (4467 views)
Permalink
OpenSSH and X.509 Certificate Support

Hi,

I need to add X.509 Certificate support to OpenSSH.

I came across the following post on the openssh-unix-dev mailing list
that is very useful:
http://marc.info/?l=openssh-unix-dev&m=120298135706959&w=2
<http://marc.info/?l=openssh-unix-dev&m=120298135706959&w=2>

And also, http://marc.info/?l=openssh-unix-dev&m=104395024824680&w=2
<http://marc.info/?l=openssh-unix-dev&m=104395024824680&w=2> that
provides the required patches to dowload for OpenSSH to support X.509
certificates.

I am using FC6 and have followed the steps mentioned in the above post,
but I am unable to successfully complete the task :(
Is there any step-by-step procedure that I could refer to to achieve the
same?

Thanks and Regards,
Sankalp
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


openssh at roumenpetrov

Feb 20, 2008, 11:47 AM

Post #2 of 16 (4104 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

sankalp_karpe wrote:
> Hi,
>
> I need to add X.509 Certificate support to OpenSSH.
>
> I came across the following post on the openssh-unix-dev mailing list
> that is very useful:
> http://marc.info/?l=openssh-unix-dev&m=120298135706959&w=2
> <http://marc.info/?l=openssh-unix-dev&m=120298135706959&w=2>
>
> And also, http://marc.info/?l=openssh-unix-dev&m=104395024824680&w=2
> <http://marc.info/?l=openssh-unix-dev&m=104395024824680&w=2> that
> provides the required patches to dowload for OpenSSH to support X.509
> certificates.
>
> I am using FC6 and have followed the steps mentioned in the above post,
> but I am unable to successfully complete the task :(
> Is there any step-by-step procedure that I could refer to to achieve the
> same?
>
> Thanks and Regards,
> Sankalp
>
Please, could you clarify "successfully complete the task".

RedHat OpenSSH sources are heavy patched and chance patch to be applied
without problem is zero.

References:
- README.x509v3 for specified version
http://roumenpetrov.info/openssh/download.html
- http://roumenpetrov.info/domino_CA/

Roumen

--
Get X.509 certificates support in OpenSSH:
http://roumenpetrov.info/openssh/


_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


sankalp_karpe at persistent

Feb 21, 2008, 4:43 AM

Post #3 of 16 (4123 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

Hi Roumen,

I could successfully add X.509 Certificate support to OpenSSH.
Earlier, the error I was facing was with "ssh-add": unable to open a
connection to your authentication agent.

I found some help on
"http://funkaoshi.com/blog/could-not-open-a-connection-to-your-authentication-agent"
with which I could resolve the same.

Here is the entire step by step procedure that I followed to add X.509
certificate support to OpenSSH (implemented for "root" login on both the
machines)
Could you please confirm and suggest changes required if any.

(1) Download OpenSSH-4.7p1 from:
http://openbsd.md5.com.ar/pub/OpenBSD/OpenSSH/portable/

(2) Download x.509 patch for this version from:
http://roumenpetrov.info/openssh/download.html

(3) Patch the OpenSSH source with this patch and install it on both
Server and Client machines (./configure --prefix=/opt/ssh && make &&
make install)

Now on the Server machine perform the following:

(4) Gnereate the ca, server, client certificates using the following
procedure:

mkdir certs && cd certs

CA certificate generation
openssl genrsa -out ca-key.pem 2048
openssl req -new -x509 -nodes -days 50000 -key ca-key.pem -out cacert.pem
Answer questions with appropriate data.
Openssl commands generate a 2048 bit key and a certificate valid for a
fifty thousand day period.

Server certificate generation
openssl req -newkey rsa:2048 -days 50000 -nodes -keyout server-key.pem
-out server-req.pem
openssl x509 -req -in server-req.pem -days 50000 -CA cacert.pem -CAkey
ca-key.pem -set_serial 01 -out server.pem

Client certificate generation
openssl req -newkey rsa:2048 -days 50000 -nodes -keyout client-key.pem
-out client-req.pem
openssl x509 -req -in client-req.pem -days 50000 -CA cacert.pem -CAkey
ca-key.pem -set_serial 01 -out client.pem

(5) Copy the generated certificates under /opt/ssh/etc/ca

(6) Build server host id using (cd to /opt/ssh/etc):

cat ca/server-key.pem > ssh_host_key_cert
cat ca/server.pem >> ssh_host_key_cert
chmod 0600 ssh_host_key_cert
../bin/ssh-keygen -y > ssh_host_key_cert.pub
// entering 'ssh_host_key_cert' as key when prompted

(7) Add the following directives in /opt/ssh/etc/sshd_config

HostKey /opt/ssh/etc/ssh_host_key_cert
CACertificateFile /opt/ssh/etc/ca/crt/cacert.pem
Port 22
X509KeyAlgorithm x509v3-sign-rsa,rsa-md5
X509KeyAlgorithm x509v3-sign-rsa,rsa-sha1
AllowedCertPurpose sslclient
PasswordAuthentication no


Now on client machine perform the following:

(8) under /root/.ssh/, copy client.pem, client-key.pem and cacert.pem
from the Server

Build identity,

As root, execute the following commands:

cat ~/.ssh/client-key.pem > ~/.ssh/id_rsa
cat ~/.ssh/client.pem >> ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
/opt/ssh/bin/ssh-keygen -y > ~/.ssh/id_rsa.pub
// entering ~/.ssh/id_rsa as key when prompted


(9) Introduce following changes in /opt/ssh/etc/ssh_config:

Port 22
IdentityFile ~/.ssh/id_rsa
UserCACertificateFile ~/.ssh/cacert.pem

(10) Copy /root/.ssh/id_rsa.pub from the Client to the Server (/root/)
and append to authorized keys file.

cat /root/id_rsa.pub >> ~/.ssh/authorized_keys

(11) Finally launch sshd on Server with either of the following commands:

/opt/ssh/sbin/sshd -f /opt/ssh/etc/sshd_config -d -d -d

- to view the debug messages

OR

/opt/ssh/sbin/sshd -f /opt/ssh/etc/sshd_config

- to run the daemon in background

(11) On the Client execute the following commands:
/opt/ssh/bin/ssh-agent
eval `/opt/ssh/bin/ssh-add`
/opt/ssh/bin/ssh-add

(12) ssh to the Server machine from the Client,

Here is the output that we see:

[root [at] localhos ~]# /opt/ssh/bin/ssh root [at] 10
The authenticity of host '10.244.8.83 (10.244.8.83)' can't be established.
RSA+cert key fingerprint is 6d:15:9f:26:fe:5c:16:4f:5e:80:12:80:54:cb:49:56.
Distinguished name is
'C=IN,ST=GOA,L=GOA,O=PSL,OU=VLSI,CN=10.244.8.83,emailAddre
ss=joviserver [at] jovi'.
Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '10.244.8.83' (RSA+cert) to the list of known
hosts.
Last login: Mon Jan 21 21:09:28 2008 from 10.244.8.167
debug1: permanently_set_uid: 0/0
Environment:
USER=root
LOGNAME=root
HOME=/root
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/ssh/bin
MAIL=/var/mail/root
SHELL=/bin/bash
SSH_CLIENT=10.244.8.167 41513 22
SSH_CONNECTION=10.244.8.167 41513 10.244.8.83 22
SSH_TTY=/dev/pts/2
TERM=xterm
debug3: channel 0: close_fds r -1 w -1 e -1 c -1
[root [at] localhos ~]#


*ISSUES faced:*

The following commands did not execute and gave errors:

(a) /opt/ssh/bin/ssh -vvv -f /opt/ssh/etc/ssh_config -d -d -d
myuser [at] myserve

OpenSSH_4.7p1, OpenSSL 0.9.8b 04 May 2006
ssh: illegal option -- d
usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-i identity_file] [-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-w local_tun[:remote_tun]] [user@]hostname [command]


(b) /opt/ssh/bin/ssh -vvv -f /opt/ssh/etc/ssh_config myuser [at] myserve

OpenSSH_4.7p1, OpenSSL 0.9.8b 04 May 2006
debug1: Reading configuration data /opt/ssh//etc/ssh_config
debug2: hash dir '/root/.ssh/crt' added to x509 store
debug2: file '/root/.ssh/ca-cert.pem' added to x509 store
debug2: hash dir '/root/.ssh/crl' added to x509 revocation store
debug2: hash dir '/opt/ssh//etc/ca/crt' added to x509 store
debug2: hash dir '/opt/ssh//etc/ca/crl' added to x509 revocation store
debug1: ssh_set_validator: ignore responder url
debug2: ssh_connect: needpriv 0
ssh: /opt/ssh/etc/ssh_config: Name or service not known


Thanks,
Sankalp



Roumen Petrov wrote:

>sankalp_karpe wrote:
>
>
>>Hi,
>>
>>I need to add X.509 Certificate support to OpenSSH.
>>
>>I came across the following post on the openssh-unix-dev mailing list
>>that is very useful:
>>http://marc.info/?l=openssh-unix-dev&m=120298135706959&w=2
>><http://marc.info/?l=openssh-unix-dev&m=120298135706959&w=2>
>>
>>And also, http://marc.info/?l=openssh-unix-dev&m=104395024824680&w=2
>><http://marc.info/?l=openssh-unix-dev&m=104395024824680&w=2> that
>>provides the required patches to dowload for OpenSSH to support X.509
>>certificates.
>>
>>I am using FC6 and have followed the steps mentioned in the above post,
>>but I am unable to successfully complete the task :(
>>Is there any step-by-step procedure that I could refer to to achieve the
>>same?
>>
>>Thanks and Regards,
>>Sankalp
>>
>>
>>
>Please, could you clarify "successfully complete the task".
>
>RedHat OpenSSH sources are heavy patched and chance patch to be applied
>without problem is zero.
>
>References:
>- README.x509v3 for specified version
>http://roumenpetrov.info/openssh/download.html
>- http://roumenpetrov.info/domino_CA/
>
>Roumen
>
>
>

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


openssh at roumenpetrov

Feb 21, 2008, 12:10 PM

Post #4 of 16 (4093 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

sankalp_karpe wrote:
> Hi Roumen,
>
> I could successfully add X.509 Certificate support to OpenSSH.
> [SKIP]
>

> *ISSUES faced:*
>
> The following commands did not execute and gave errors:
>
> (a) /opt/ssh/bin/ssh -vvv -f /opt/ssh/etc/ssh_config -d -d -d
> myuser [at] myserve
>
> OpenSSH_4.7p1, OpenSSL 0.9.8b 04 May 2006
> ssh: illegal option -- d
> usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
> [-D [bind_address:]port] [-e escape_char] [-F configfile]
> [-i identity_file] [-L [bind_address:]port:host:hostport]
> [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
> [-R [bind_address:]port:host:hostport] [-S ctl_path]
> [-w local_tun[:remote_tun]] [user@]hostname [command]
>
Yes, expected. The option -d in not in vanilla.
Vanilla OpenSSH use -v as verbose mode for client and -d as debug mode
for daemon (server).

What is ssh option -d on RedHat distribution ?


> (b) /opt/ssh/bin/ssh -vvv -f /opt/ssh/etc/ssh_config myuser [at] myserve
>
> OpenSSH_4.7p1, OpenSSL 0.9.8b 04 May 2006
> debug1: Reading configuration data /opt/ssh//etc/ssh_config
> debug2: hash dir '/root/.ssh/crt' added to x509 store
> debug2: file '/root/.ssh/ca-cert.pem' added to x509 store
> debug2: hash dir '/root/.ssh/crl' added to x509 revocation store
> debug2: hash dir '/opt/ssh//etc/ca/crt' added to x509 store
> debug2: hash dir '/opt/ssh//etc/ca/crl' added to x509 revocation store
> debug1: ssh_set_validator: ignore responder url
> debug2: ssh_connect: needpriv 0
> ssh: /opt/ssh/etc/ssh_config: Name or service not known
>
Sorry but OpenSSH -f option is not so consistent with other program.
Usually -f is for file in many applications but OpenSSH.
OpenSSH is inconsistent and options is: -F config_file.
Option -f is "requests ssh to go to background just before command
execution."
So that client try to connect to host "/opt/ssh/etc/ssh_config" and to
execute command "myuser [at] myserve"

Did on RedHat option -f is followed by config-file ?

> [SNIP]

Sorry but reported issues is not related to X.509 certificate support.

Roumen

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


sankalp_karpe at persistent

Feb 28, 2008, 4:33 AM

Post #5 of 16 (4064 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

Hi Roumen,

Thanks for your comments.
The issues reported by me were not X.509 specific. Sorry about that.

So now I have SSH Server & Client, both patched with X.509 and I can
successfully connect to the Server using X.509 Certificates.

I have several Linux clients some of which are patched with x.509 patch.

Is it possible for those linux machines (not patched with x.509) to
log-in to the server with username/password since they do not support
x.509 certificates (by doing some configuration changes on the Server)?
I have tried to log-in from a ssh client (without X.509 patch) to a ssh
server (with X.509 patch), but the server refuses connection with the
following error on the console:

"no hostkey alg"

My goal, is to make the OpenSSH Server (with X.509 patch) compatible
with all SSH Clients irrespective of whether the client is patched with
X.509 or not.
Would there be any workaround?

Your help would be highly appreciated.
Thanking you in anticipation.

Thanks and Best Regards,
Sankalp


Roumen Petrov wrote:

> sankalp_karpe wrote:
>
>> Hi Roumen,
>>
>> I could successfully add X.509 Certificate support to OpenSSH.
>> [SKIP]
>>
>
>
>> *ISSUES faced:*
>>
>> The following commands did not execute and gave errors:
>>
>> (a) /opt/ssh/bin/ssh -vvv -f /opt/ssh/etc/ssh_config -d -d -d
>> myuser [at] myserve
>>
>> OpenSSH_4.7p1, OpenSSL 0.9.8b 04 May 2006
>> ssh: illegal option -- d
>> usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
>> [-D [bind_address:]port] [-e escape_char] [-F configfile]
>> [-i identity_file] [-L [bind_address:]port:host:hostport]
>> [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p
>> port]
>> [-R [bind_address:]port:host:hostport] [-S ctl_path]
>> [-w local_tun[:remote_tun]] [user@]hostname [command]
>>
>
> Yes, expected. The option -d in not in vanilla.
> Vanilla OpenSSH use -v as verbose mode for client and -d as debug mode
> for daemon (server).
>
> What is ssh option -d on RedHat distribution ?
>
>
>> (b) /opt/ssh/bin/ssh -vvv -f /opt/ssh/etc/ssh_config myuser [at] myserve
>>
>> OpenSSH_4.7p1, OpenSSL 0.9.8b 04 May 2006
>> debug1: Reading configuration data /opt/ssh//etc/ssh_config
>> debug2: hash dir '/root/.ssh/crt' added to x509 store
>> debug2: file '/root/.ssh/ca-cert.pem' added to x509 store
>> debug2: hash dir '/root/.ssh/crl' added to x509 revocation store
>> debug2: hash dir '/opt/ssh//etc/ca/crt' added to x509 store
>> debug2: hash dir '/opt/ssh//etc/ca/crl' added to x509 revocation store
>> debug1: ssh_set_validator: ignore responder url
>> debug2: ssh_connect: needpriv 0
>> ssh: /opt/ssh/etc/ssh_config: Name or service not known
>>
>
> Sorry but OpenSSH -f option is not so consistent with other program.
> Usually -f is for file in many applications but OpenSSH.
> OpenSSH is inconsistent and options is: -F config_file.
> Option -f is "requests ssh to go to background just before command
> execution."
> So that client try to connect to host "/opt/ssh/etc/ssh_config" and to
> execute command "myuser [at] myserve"
>
> Did on RedHat option -f is followed by config-file ?
>
>> [SNIP]
>
>
> Sorry but reported issues is not related to X.509 certificate support.
>
> Roumen
>
>

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


openssh at roumenpetrov

Feb 28, 2008, 11:23 AM

Post #6 of 16 (4073 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

sankalp_karpe wrote:
> Hi Roumen,
>
> Thanks for your comments.
> The issues reported by me were not X.509 specific. Sorry about that.
>
> So now I have SSH Server & Client, both patched with X.509 and I can
> successfully connect to the Server using X.509 Certificates.
>
> I have several Linux clients some of which are patched with x.509 patch.
>
> Is it possible for those linux machines (not patched with x.509) to
> log-in to the server with username/password since they do not support
> x.509 certificates (by doing some configuration changes on the Server)?
> I have tried to log-in from a ssh client (without X.509 patch) to a
> ssh server (with X.509 patch), but the server refuses connection with
> the following error on the console:
>
> "no hostkey alg"
>
> My goal, is to make the OpenSSH Server (with X.509 patch) compatible
> with all SSH Clients irrespective of whether the client is patched
> with X.509 or not.
> Would there be any workaround?
>
> Your help would be highly appreciated.
> Thanking you in anticipation.
>
> Thanks and Best Regards,
> Sankalp
>
> Roumen Petrov wrote:
>
>> sankalp_karpe wrote:
>> [SNIP]

You could list in sshd_config all supported key types:
$ grep ^HostKey /etc/ssh/sshd_config
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/SAVE/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key


Also you could check key-types supported by server:
$ ssh-keyscan localhost
# localhost SSH-2.0-OpenSSH_4.7
localhost x509v3-sign-rsa Subject:C=XX,...
# localhost SSH-2.0-OpenSSH_4.7
localhost x509v3-sign-dss Subject:C=XX,...
# localhost SSH-2.0-OpenSSH_4.7
localhost ssh-rsa AAAAB3Nza....
# localhost SSH-2.0-OpenSSH_4.7
no hostkey alg


Command ssh-keyscan (see man page) scan for protocol version 2 keys by
default.

Roumen
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


sankalp_karpe at persistent

Mar 12, 2008, 4:51 AM

Post #7 of 16 (3968 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

Hi Roumen,

I tried your suggestions and could successfully connect to the OpenSSH
Server with X.509 patch from a non-patched SSH Client using
username/password.

The main requirement that I have is for the Client to be authenticated
via a Client certificate using SSH and Apache.

I have been able to successfully achieve the same using Apache + mod_ssl
for web server access to my system.
In order to enable the same authentication mechanism for command-line
access to my system that uses OpenSSH, I patched OpenSSH with the X.509
patch you developed between two Linux FC6 machines.

Ideally I would like it to be something like:

1. The client sends the user certificate (which includes the user's
public key) to the server. The packet also contains data unique to the
session and it is signed by the user's private key.
2. The server uses the CA certificate to check that the user's
certificate is valid.
3. The server verifies that the user has a valid private key by checking
the signature in the initial packet.
4. The server matches the user certificate against the rules in the
server configuration file to decide whether login is allowed or not.

When looking for information on X.509 Certificate support for SSH, I had
come across a commercial version of SSH (SSH Tectia Client/Server) which
claims to support the above authentication sequence. Also, it supports
selective field based authentication of the Client Certificates, for
example:

<authentication-methods>
<authentication action="allow" repeat-block="yes">
<auth-publickey />
<authentication action="allow">
<selector>
<certificate field="ca-list" pattern="exa-ca1,exa-ca2" />
<certificate field="issuer-name" pattern="C=FI, O=SSH, CN=*" />
<certificate field="subject-name" pattern="C=FI, O=SSH, CN=%username%" />
<certificate field="serial-number" pattern="123456" />
<certificate field="altname-email" pattern="%username%@ssh.com" />
<certificate field="altname-upn" pattern="%username-without-domain%@ssh" />
</selector>
</authentication>
<authentication action="deny" />
</authentication>
</authentication-methods>

However, I need to see how I can extend the OpenSSH of my system to
support X.509 Certificates and cannot use any commercial version of SSH.

Implementing X.509 Certificate support for OpenSSH (using the X.509
patch you developed) requires that the client certificate be appended to
the Client key in id_rsa and public part of the client key+certificate
(i.e. id_rsa.pub) to be appended to the authorized_keys file on the
server, and each time a new client (OpenSSH patched with X.509) is added
to the network, its corresponding id_rsa.pub has to be appended to the
server's authorized_keys.

So, I have the following concerns and would request your comments on the
same:

(1) Isn't this an overhead as compared to what we would do in Web Server
Authentication (Apache) where-in we provide the client with just a
certificate, and not having to create a custom file containing the
Client key+certificate (id_rsa) like we do for OpenSSH patched with X.509.

(2) If we need to have the "client key + client certificate" in id_rsa,
then, is there any workaround to eliminate the need to append the ".pub"
part of it to the "authorized_keys" file on the Server.

(3) Also how can we authenticate clients selectively using the fields of
the client certificate in case of OpenSSH (with X.509 support).

Your help would be highly appreciated.
Thanking you in anticipation.

Thanks and Best Regards,
Sankalp



Roumen Petrov wrote:

>sankalp_karpe wrote:
>
>
>>Hi Roumen,
>>
>>Thanks for your comments.
>>The issues reported by me were not X.509 specific. Sorry about that.
>>
>>So now I have SSH Server & Client, both patched with X.509 and I can
>>successfully connect to the Server using X.509 Certificates.
>>
>>I have several Linux clients some of which are patched with x.509 patch.
>>
>>Is it possible for those linux machines (not patched with x.509) to
>>log-in to the server with username/password since they do not support
>>x.509 certificates (by doing some configuration changes on the Server)?
>>I have tried to log-in from a ssh client (without X.509 patch) to a
>>ssh server (with X.509 patch), but the server refuses connection with
>>the following error on the console:
>>
>>"no hostkey alg"
>>
>>My goal, is to make the OpenSSH Server (with X.509 patch) compatible
>>with all SSH Clients irrespective of whether the client is patched
>>with X.509 or not.
>>Would there be any workaround?
>>
>>Your help would be highly appreciated.
>>Thanking you in anticipation.
>>
>>Thanks and Best Regards,
>>Sankalp
>>
>>Roumen Petrov wrote:
>>
>>
>>
>>>sankalp_karpe wrote:
>>>[SNIP]
>>>
>>>
>
>You could list in sshd_config all supported key types:
>$ grep ^HostKey /etc/ssh/sshd_config
>HostKey /etc/ssh/ssh_host_rsa_key
>HostKey /etc/ssh/SAVE/ssh_host_rsa_key
>HostKey /etc/ssh/ssh_host_dsa_key
>
>
>Also you could check key-types supported by server:
>$ ssh-keyscan localhost
># localhost SSH-2.0-OpenSSH_4.7
>localhost x509v3-sign-rsa Subject:C=XX,...
># localhost SSH-2.0-OpenSSH_4.7
>localhost x509v3-sign-dss Subject:C=XX,...
># localhost SSH-2.0-OpenSSH_4.7
>localhost ssh-rsa AAAAB3Nza....
># localhost SSH-2.0-OpenSSH_4.7
>no hostkey alg
>
>
>Command ssh-keyscan (see man page) scan for protocol version 2 keys by
>default.
>
>Roumen
>_______________________________________________
>openssh-unix-dev mailing list
>openssh-unix-dev [at] mindrot
>https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
>
>
>

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


stuge-openssh-unix-dev at cdy

Mar 12, 2008, 6:03 PM

Post #8 of 16 (3959 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

On Wed, Mar 12, 2008 at 05:21:26PM +0530, sankalp_karpe wrote:
> (1) Isn't this an overhead as compared to what we would do in Web
> Server Authentication (Apache) where-in we provide the client with
> just a certificate, and not having to create a custom file
> containing the Client key+certificate (id_rsa) like we do for
> OpenSSH patched with X.509.

Disregarding the file format issue, a certificate does not make sense
if there is no private key. The certificate is just a "face" to go
with the key. If Roumen's patch doesn't already support .pem files
with key and cert I think it would be trivial to add.


> (2) If we need to have the "client key + client certificate" in
> id_rsa,

Yes, the client will always need both key and cert.


> then, is there any workaround to eliminate the need to append the
> ".pub" part of it to the "authorized_keys" file on the Server.

Here I agree with you - the administrative advantages of PKI seem to
be lost if each client's cert needs to be distributed to all servers.

But on the other hand - how will the certificate->username mapping be
done otherwise? (Each cert should only be allowed for one username.)


> (3) Also how can we authenticate clients selectively using the
> fields of the client certificate in case of OpenSSH (with X.509
> support).

Again I suspect this would be trivial to add, depending on the
criterias you would like to use.


//Peter
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


tusker at tusker

Mar 12, 2008, 7:17 PM

Post #9 of 16 (3948 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

Peter Stuge wrote:
>> then, is there any workaround to eliminate the need to append the
>> ".pub" part of it to the "authorized_keys" file on the Server.
>>
>
> Here I agree with you - the administrative advantages of PKI seem to
> be lost if each client's cert needs to be distributed to all servers.
>
> But on the other hand - how will the certificate->username mapping be
> done otherwise? (Each cert should only be allowed for one username.)
>
Hi Peter,

Wouldn't you be able to do this with the certificate signature, rather
than the entire certificate ?

Cheers,

Damien

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


stuge-openssh-unix-dev at cdy

Mar 12, 2008, 9:13 PM

Post #10 of 16 (3953 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

On Thu, Mar 13, 2008 at 10:17:44AM +0800, Damien Mascord wrote:
> > But on the other hand - how will the certificate->username mapping be
> > done otherwise? (Each cert should only be allowed for one username.)

First a correction; one cert might be allowed for several usernames,
but not neccessarily all usernames.


> Wouldn't you be able to do this with the certificate signature,
> rather than the entire certificate ?

Where is/are username(s) stored? How will sshd match cert with
username once the CA signature has been validated?


//Peter
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


openssh at roumenpetrov

Mar 15, 2008, 2:41 PM

Post #11 of 16 (3934 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

joviano_dias [at] persistent wrote:
> Roumen,
>
> While using Distinguished Names in authorized_keys:
> Is it possible that all clients possessing a valid certificate are
> authenticated, and not just those clients who have certificates containing
> subject lines specified in authorized_keys?
>
> Shouldn't it be sufficient that the client certificate signature is
> checked against the CA certificate on the server, i.e server
> authenticating without having to perform any sort of specific
> configuration to the server's authorized_keys file.

Sure, if you like every client with valid certificate to login into
every logon account on the server.


> I know the above would be quite possible with wildcards, but is there any
> other way it can be done, that is accepting all Client Certificates signed
> by the CA whose CA certificate is present on the Server?
>
> -Joviano Dias
>
>> [SNIP]


Roumen
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


joviano_dias at persistent

Mar 16, 2008, 10:46 AM

Post #12 of 16 (3926 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

> joviano_dias [at] persistent wrote:
>> Roumen,
>>
>> While using Distinguished Names in authorized_keys:
>> Is it possible that all clients possessing a valid certificate are
>> authenticated, and not just those clients who have certificates
>> containing
>> subject lines specified in authorized_keys?
>>
>> Shouldn't it be sufficient that the client certificate signature is
>> checked against the CA certificate on the server, i.e server
>> authenticating without having to perform any sort of specific
>> configuration to the server's authorized_keys file.
>
> Sure, if you like every client with valid certificate to login into
> every logon account on the server.
>
i should be able to do that,but i cant quite figure out how to do that...
right now i am using DN's in authorized keys and for every client, i need
to put the subject line of the client certificate in authorized_keys.

how do i authenticate all client's having a valid certificate, and not
just those clients possessing a valid client cert.

I tried removing all entries from authorized_keys, but the the sshd server
would not authenticate any client, even if they had a valid certificate

any idea on this?...
>
>> I know the above would be quite possible with wildcards, but is there
>> any
>> other way it can be done, that is accepting all Client Certificates
>> signed
>> by the CA whose CA certificate is present on the Server?
>>
>> -Joviano Dias
>>
>>> [SNIP]
>
>
> Roumen
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev [at] mindrot
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
>
-Joviano
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


stuge-openssh-unix-dev at cdy

Mar 16, 2008, 11:15 AM

Post #13 of 16 (3925 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

On Sun, Mar 16, 2008 at 11:16:00PM +0530, joviano_dias [at] persistent wrote:
> > Sure, if you like every client with valid certificate to login
> > into every logon account on the server.
>
> i should be able to do that,but i cant quite figure out how to do that...
..

> any idea on this?...

That should only need a small change to the patch.


//Peter
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


joviano_dias at persistent

Mar 18, 2008, 8:03 AM

Post #14 of 16 (3917 views)
Permalink
RE: OpenSSH and X.509 Certificate Support [In reply to]

As I had mentioned previously that I building a system with OpenSSH + X.509
using the patch provided by Roumen,
I have to have the subject lines in my authorized keys in order to
authenticate clients based on the match of these subject lines.

I wanted to authenticate all clients who were issued a client certificate by
the CA whose CA certificate is present on the Server as I believe that this
should be sufficient and would avoid the overhead of adding subject lines
(to authorized_keys on the server) of each client certificate issued...

Here is what I am considering...

-----Original Message-----
From: openssh-unix-dev-bounces+joviano_dias=persistent.co.in [at] mindrot
[mailto:openssh-unix-dev-bounces+joviano_dias=persistent.co.in [at] mindrot]
On Behalf Of Peter Stuge
Sent: Sunday, March 16, 2008 11:46 PM
To: OpenSSH Devel List
Subject: Re: OpenSSH and X.509 Certificate Support

On Sun, Mar 16, 2008 at 11:16:00PM +0530, joviano_dias [at] persistent
wrote:
> > Sure, if you like every client with valid certificate to login
> > into every logon account on the server.
>
> i should be able to do that,but i cant quite figure out how to do that...
..

> any idea on this?...

That should only need a small change to the patch.

I see that I would have to modify ssh-x509.c, however I was just wondering
if there were any configuration options available to achieve the same.
Switching between authenticating the client using "client cert subject
lines" and "without any selective authentication (no subject lines in
authorized_keys)" in authorized_keys on the server would be really good for
me.

Anyone ever did this before, or any suggestions on the same?

//Peter
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


openssh at roumenpetrov

Mar 18, 2008, 1:18 PM

Post #15 of 16 (3911 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

Joviano Dias wrote:
> As I had mentioned previously that I building a system with OpenSSH + X.509
> using the patch provided by Roumen,
> I have to have the subject lines in my authorized keys in order to
> authenticate clients based on the match of these subject lines.
>
> I wanted to authenticate all clients who were issued a client certificate by
> the CA whose CA certificate is present on the Server as I believe that this
> should be sufficient and would avoid the overhead of adding subject lines
> (to authorized_keys on the server) of each client certificate issued...
>
> Here is what I am considering...
>
> [SNIP]
>>> Sure, if you like every client with valid certificate to login
>>> into every logon account on the server.

Did you like every client with valid and verified certificate to log
into every logon account even as root ?
If you don't like this, then you should create a map between certificate
distinguished name or public part and logon accounts.
Also note that authorized-keys file is such map.

Roumen

--
Get X.509 certificates support in OpenSSH:
http://roumenpetrov.info/openssh/
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


joviano_dias at persistent

Mar 22, 2008, 1:30 PM

Post #16 of 16 (3881 views)
Permalink
Re: OpenSSH and X.509 Certificate Support [In reply to]

> Joviano Dias wrote:
>> As I had mentioned previously that I building a system with OpenSSH +
>> X.509
>> using the patch provided by Roumen,
>> I have to have the subject lines in my authorized keys in order to
>> authenticate clients based on the match of these subject lines.
>>
>> I wanted to authenticate all clients who were issued a client
>> certificate by
>> the CA whose CA certificate is present on the Server as I believe that
>> this
>> should be sufficient and would avoid the overhead of adding subject
>> lines
>> (to authorized_keys on the server) of each client certificate issued...
>>
>> Here is what I am considering...
>>
>> [SNIP]
>>>> Sure, if you like every client with valid certificate to login
>>>> into every logon account on the server.
>
> Did you like every client with valid and verified certificate to log
> into every logon account even as root ?

Yes i would like to implement such a scenario, as all users issued a
client certificate have root privileges and they should be able to login
into all accounts on the server with the same certificate, even root
(Don't mind clients with certificate being able to access as root.)

> If you don't like this, then you should create a map between certificate
> distinguished name or public part and logon accounts.
> Also note that authorized-keys file is such map.

I agree that this would be a good approach, however i am trying to
eliminate the need for any kind of checking of the "authorized_keys" file.
To achieve this and after analyzing the code, I had originally planned to
modify the file ssh-x509.c since this was the place where the subject
lines (of authorized_keys) are checked.
However, the checking of the key type (RSA/DSA x509-key which precedes the
subject lines for every entry in the authorized_keys file) would still be
performed if would have done this.

So in order to eliminate the checking of entire strings in
authorized_keys(key type+subject line), I figured out that I could short
circuit the function "user_key_allowed2()" in the file "auth2-pubkey.c"
(return 1 for all scenarios).

I am yet to implement this, just wanted to know if whether it would
actually work and if this approach is fine considering i don't need to
check the authorized_keys file?...

Thanks,
Joviano



_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

OpenSSH dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.