Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jjohn (22)

jjohn
  (email not shown publicly)
http://taskboy.com/
AOL IM: taskboy3000 (Add Buddy, Send Message)

Perl hack/Linux buff/OSS junkie.

Journal of jjohn (22)

Wednesday May 18, 2005
02:42 PM

automating openssh/openssl installation

[ #24759 ]

Warning: technical content ahoy!

Here's a handy shell hack I use to update openssh/openssl on various machine under my care. Further hacks could be made to determine the latest version numbers of the ssl/ssh to fetch. Become one with the primative shell hacking vestiges in your modern Perl brain, oh Perlescent Brethren!

  #!/bin/sh

  build=/tmp
  dest=/opt
  lynx=/usr/bin/lynx
  wget=/usr/bin/wget

  ssl_url="http://www.openssl.org/source/openssl-0.9.7g.tar.gz"
  ssh_url="ftp://ftp.tux.org/bsd/openbsd/OpenSSH/portable/openssh-4.0p1.tar.gz"
  ssl_version=`basename $ssl_url ".tar.gz"`
  ssh_version=`basename $ssh_url ".tar.gz"`
  ssl_dir="$build/$ssl_version"
  ssh_dir="$build/$ssh_version"

  cd $build;

  echo "Finding $ssl_version and $ssh_version...";
  if [ -e $wget ];
  then
    for url in $ssl_url $ssh_url;
    do
      file=`basename $url`
      if [ -e $file ] ;
      then
        echo "Using existing $file";
      else
        echo `$wget $url`
      fi
    done;

  else
    if [ -e $lynx ];
    then

      for url in $ssl_url $ssh_url;
      do
        file=`basename $url`
        if [ -e $file ] ;
        then
          echo "Using existing $file";
        else
          echo `$lynx -source $url > $file`
        fi
      done;

    else
      echo "Oops.  No URL fetchers!";
    exit 1;
    fi
  fi

  # unpacking
  echo "Unpacking archives";
  tar xzvf `basename $ssl_url`;
  tar xzvf `basename $ssh_url`;

  echo "Cleaning";
  cd $ssl_dir && make clean;
  cd $ssh_dir && make clean;

  echo "Building SSL";
  # build ssl first; sshd depends on it
  cd $ssl_dir && ./config --prefix=$dest && make install

  echo "Building SSH";
  cd $ssh_dir && ./configure --prefix=$dest --with-ssl=$dest \
     --with-sysconfig=/usr/local/etc && make install

  # adjust ?
  if [ -e "/etc/rc.d/init.d/sshd" ];
  then
    echo "You may need to adjust your sshd"
  fi

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.