[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating a script to test a local website

Posted on 2006-07-17
9
Medium Priority
?
255 Views
Last Modified: 2013-12-16
Hello all,

I have a requirement for a script to test certificate expiry on particular ports on a server.  However the server is located in a DMZ and is accessable only via SSH.  I thought about opening the ports up, but there are roughly about 100 of these servers, the over head is far too much, also the script uses specific SSLEAY and various other perl modules to work.  I'm looking to have a central reporting server that basically periodicaly logs on via SSH, creates a SSH Tunnel, Perl script executes and examines specific ports on the destination server out put is pushed into a file.  I know I can get around the SSH logon stuff with creating certificates on the client and destination servers, but how can I tunnel the ports in a script and keep them open to allow another script  to execute on the client server?

I have the Perl script etc.., I only want to know how the SSH stuff will work

More info if required.

And Thanks to all in advance.
0
Comment
Question by:london_mccourt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 15

Expert Comment

by:DonConsolio
ID: 17122280
you might want to have a look at "nessus"
0
 
LVL 40

Expert Comment

by:noci
ID: 17122374
man ssh

will show options like -L & -R You can experiment with that.

If you are looking for a more generic monitor nagios might be usefull for the reporting & monitoring.

0
 

Author Comment

by:london_mccourt
ID: 17122378
thanks Don, Nessus is a little colossus for me, I like the output I get from this script, I'd rather stick to it.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:london_mccourt
ID: 17122749
I'm kinda looking for a few examples, I've gone through the man pages.
0
 
LVL 40

Accepted Solution

by:
noci earned 1600 total points
ID: 17124723
ssh -L localhost:12345:anotherremotehost:5678 someuser@remotehost -f

I am assuming you have setup private/public keys ...

will open a tunnel from your host to the remotehost and build a tunnel ,
then allow connections on the localsystem to port 127.0.0.1:12345 to have the
remotehost connect to another remotehost port 5678

0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17124953
I know you said you were familiar with client and server certificates....but are you doing them properly, and protecting them with a password?

http://www.cvrti.utah.edu/~dustman/no-more-pw-ssh/

You can execute a command on the remote server:

ssh someuser@remotehost command

so if you want to ls a directory and put the data into a file on the local machine:

echo `ssh someuser@remotehost ls -al ` > output.txt

(   (()
(`-' _\
 ''  ''



0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17202429
..or alternatively, stick your perl script on the server concerned, and record the output locally:

echo `ssh someuser@serverindmz.com myscript.pl ` > output.txt

(   (()
(`-' _\
 ''  ''
0
 

Author Comment

by:london_mccourt
ID: 17295458
noci, thanks for your help

Oddly I'm using the below line in my script (cert passwordless connections working great.

$SERVNM = remote host name
$SERVPRT = remote post port

ssh -v -N -L 12345:$SERVNM:$SERVPRT user@$SERVNM -i $HOME/identity-test/id_rsa

I have done a combination of nohup, -f, sh, and traling & to have the tunnel 'spawned' off so that the rest of the script can execute, but the script stops everytime and doesn't continue until I break it.

The tunnel works really well, I can open another console and telnet to the new port no problem.

Any ideas?
0
 
LVL 40

Expert Comment

by:noci
ID: 17306941
a -n is required to disconnect the stdin from the controlling terminal.

a -f should imply a -n... (open ssh at least).
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question