Saturday, June 13, 2009

Setup more than one sshd daemon in one box

You have one Linux server and want to set two ssh daemon, may be two different ssh servers each with a different version.

1) Download the openssh from http://www.openssh.org/portable.html

2) Configure and make the sources:
# ./configure --with-kerberos5 --with-tcp-wrappers --with-pam
# ./make

2.1) Common errors:
"configure: error: PAM headers not found"
Solution: yum install pam-devel

3) You can do a "make install" but i wouldn't do that if you have already an ssh daemon installed, from sources or any package manager like rpm or apt.

4) Copy the ssh daemon directory or link to it from /usr/local/sbin/
# ln -s ./openssh-new /usr/local/sbin/sshd-new/

5) Supposing that you already have a /etc/ssh/sshd_config file, then you have to create
another configuration file for the new ssh server, lets put it in another directory:
/usr/local/etc/ssh/sshd_config

And edit this sshd_config file and put there this line, or edit it if it already exists:
# This line specifies which port you want to use:
Port 2253

6) Create the ssh key files:
# ssh-keygen -t rsa -f /usr/local/etc/ssh/ssh_host_rsa_key
# ssh-keygen -t dsa -f /usr/local/etc/ssh/ssh_host_dsa_key

7) Make sure that in the startup script /etc/init.d/sshd2 you instruct the daemon where to find its key files, something like this:

# Some functions to make the below more readable
KEYGEN=/usr/local/sbin/openssh-5.2p1/ssh-keygen
SSHD=/usr/local/sbin/openssh-5.2p1/sshd
RSA1_KEY=/usr/local/etc/ssh/ssh_host_key
RSA_KEY=/usr/local/etc/ssh/ssh_host_rsa_key
DSA_KEY=/usr/local/etc/ssh/ssh_host_dsa_key
PID_FILE=/var/run/sshd2.pid
OPTIONS="-f /usr/local/etc/ssh/sshd_config"

8) Finally, start the new ssh server.
/etc/init.d/sshd2 start

Friday, June 12, 2009

Public key for is not installed

The .rpm package has been signed with a private key to provide nonrepudiation and integrity, basically, its genuinety. The package should be verified with the public key.

You can use rpm to install the package:

# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# yum install ./mysqlclient10-3.23.58-9.2.c4.x86_64.rpm