Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Secure-Shell
[Top] [All Lists]

creating ssh-wise identical machines

Subject: creating ssh-wise identical machines
Date: Wed, 14 Dec 2005 00:52:35 +0100
I work on debian with openssh 1:3.8.1p1-8.sarge.4

I am building an UserModeLinux machine for automated test
purposes and copy the dsa and rsa files from /etc/ssh/ onto the
uml (and set the permissions correctly).  I also put my personal
ssh public key into the uml's root dir during install.  Now I
get this warning when I connect to the uml from my host machine:

WARNING: DSA key found for host 10.0.2.2
in /home/andreas/.ssh/known_hosts:38
DSA key fingerprint e9:d7:8b:fa:79:70:8c:cf:05:c2:09:70:49:0c:3a:cd.
The authenticity of host '10.0.2.2 (10.0.2.2)' can't be established
but keys of different type are already known for this host.
RSA key fingerprint is 95:10:a8:18:68:74:75:3a:db:33:0c:cd:18:e0:87:bf.

I dont really understand what the problem might be. All four keys
are there and fine after each uml install and identical with the
originals (checked the sha1sum of them).  do i need more files to
make the uml machines appear identical after reinstall?


======================
for entertainment, this is how i handle the copying of the files:

ome reason the user's homedir is a read only filesystem during 
# the rootstrap run.

if [ ! -d $data ]; then
    mkdir $data
fi

if [ -f $data/ssh_host_rsa_key -a -f  $data/ssh_host_rsa_key.pub ]; then
    cat $data/ssh_host_rsa_key     | \
        chroot $TARGET sh -c "cat > /etc/ssh/ssh_host_rsa_key"
    cat $data/ssh_host_rsa_key.pub | \
        chroot $TARGET sh -c "cat > /etc/ssh/ssh_host_rsa_key.pub"
    chroot $TARGET chmod 600 /etc/ssh/ssh_host_rsa_key
    chroot $TARGET chmod 644 /etc/ssh/ssh_host_rsa_key.pub
else
    chroot $TARGET cat /etc/ssh/ssh_host_rsa_key \
        > $data/ssh_host_rsa_key
    chroot $TARGET cat /etc/ssh/ssh_host_rsa_key.pub \
        > $data/ssh_host_rsa_key.pub
fi

if [ -f $data/ssh_host_dsa_key -a -f  $data/ssh_host_dsa_key.pub ]; then
    cat $data/ssh_host_dsa_key     | \
        chroot $TARGET sh -c "cat > /etc/ssh/ssh_host_dsa_key"
    cat $data/ssh_host_dsa_key.pub | \
        chroot $TARGET sh -c "cat > /etc/ssh/ssh_host_dsa_key.pub"
    chroot $TARGET chmod 600 /etc/ssh/ssh_host_dsa_key
    chroot $TARGET chmod 644 /etc/ssh/ssh_host_dsa_key.pub
else
    chroot $TARGET cat /etc/ssh/ssh_host_dsa_key     > $data/ssh_host_dsa_key
    chroot $TARGET cat /etc/ssh/ssh_host_dsa_key.pub > 
$data/ssh_host_dsa_key.pub
fi


if [ -f $home/.ssh/id_rsa.pub ]; then
    cat $home/.ssh/id_rsa.pub | chroot $TARGET sh -c "mkdir /root/.ssh; chmod 
700 /root/.ssh; cat >> /root/.ssh/authorized_keys"
fi

if  [ -f $home/.ssh/id_dsa.pub ]; then
    cat $home/.ssh/id_dsa.pub | chroot $TARGET sh -c "mkdir /root/.ssh; chmod 
700 /root/.ssh; cat >> /root/.ssh/authorized_keys"
fi

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>
  • creating ssh-wise identical machines, Andreas Schuldei <=