a shell script for review.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting a shell script for review.
# 8  
Old 10-07-2009
Computer

Quote:
Originally Posted by robsonde
I have written a bit of shell that lets our company check all our SSL certs.
Very nice! I did this in perl a while back but an sh version is very cool Smilie

I found a couple of places where there's a little bit of room for simplification, pasted snips from my old solution as examples.
  • Quote:
    Originally Posted by robsonde
    Code:
            FULL_SSL_BLOB=`echo "HEAD / HTTP/1.0\n Host: $1:443\n\n EOT\n" | openssl s_client -connect $1:443 2>&1`

    I found I could just echo a blank line to s_client for this:
    Code:
    `echo | $OPENSSL s_client -connect ${server}:${port} 2>&1`

  • Quote:
    Originally Posted by robsonde
    Code:
    `echo "$SSL_CERT" | openssl x509 -noout -text -certopt no_signame 2>&1 | grep "Not After"  `

    You can also save a cycle or three by using the x509 module's 'enddate' option:
    Code:
    `echo "$cert" | $OPENSSL x509 -enddate -noout`

Might I also suggest you don't force it to use port 443 and allow user-specified ports ah-la a plain old URL on the commandline.
That way you can use it to test things like weblogic / websphere internal SSL certs - the kind of things that often get forgotten Smilie (That's what my one got written to test for)

This is also a very under-used feature of many commercial monitoring apps out there to do similar, take a look at the webserver monitoring modules on your monitoring app of choice. It might save you some support overhead.

---------- Post updated at 05:13 PM ---------- Previous update was at 05:11 PM ----------

Quote:
Originally Posted by robsonde
I don't think you can do the $(( syntax in bourne shell...

my code was written for bourne shell as we dont run ksh or bash in our network.
Bravo! Smilie
# 9  
Old 10-07-2009
Quote:
Originally Posted by robsonde
I don't think you can do the $(( syntax in bourne shell...

my code was written for bourne shell as we dont run ksh or bash in our network.

It runs in the standard Unix shell, which is a POSIX shell.

The Bourne shell is obsolete, and, while a few systems still have a Bourne shell in /bin/sh, they will also have a conforming shell.

The conforming shell may not be either ksh or bash.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Cybersecurity

Log Review- SU

Hi, Can some please provide some hints on what to look for in unix/Linux logs such as sulog from a Information security perspective. Regards (2 Replies)
Discussion started by: Tilus
2 Replies

2. Shell Programming and Scripting

Peer Review File/Folder Script

Hello *nix friends, I've written a shell script that allow web admin's to copy file/folder from a development site to the production site. It's more or less a poor man SVN. I'm posting the script here because I was able to get many questions answered through this forum and also, I want to... (4 Replies)
Discussion started by: rwhite35
4 Replies

3. Shell Programming and Scripting

Please review error routines in my ksh script

The script distributes files from an AIX server using iether ftp or sftp depending on the constraint of the destination server. I am interested in having the error checking routine critically reviewed. I will only include an excerpt from the script concerning error trapping: (where $FTP_OUT is the... (7 Replies)
Discussion started by: peleton
7 Replies

4. UNIX for Dummies Questions & Answers

Question/review my script: removing bad chars from filenames

The task: remove undesirable characters from filenames. Restrictions: Must use basic RE, base utilities (non-GNU) and /bin/sh (ash). No ksh, zsh, perl, etc. Below is what I've come up with. It seems to work OK but I'm open to shorter, more efficient alternatives. Inside the square... (4 Replies)
Discussion started by: uiop44
4 Replies

5. Shell Programming and Scripting

Please review script for search in all files

I have written a little script to scan users home directories for certain commands located inside a file. The script is setup to include a small help section and allows for passing a username argument to override scanning of all users home directories. A lot of searching and trial and error has... (7 Replies)
Discussion started by: bkeep
7 Replies

6. Shell Programming and Scripting

Review Check list for Unix Shell Script

Hi, I need Unix Shell Script Review Check list in the format of word or excel. Can any one provide the review checklist for unix shell script. Pls. (1 Reply)
Discussion started by: praka
1 Replies

7. Shell Programming and Scripting

Please, review script.

Hi guys, I 've been brewing this shellscript, but I can't test it until next tuesday. In the meantime I am too curious wether it will work or not, so I'd like to hear your comments. Background: I want to watch the user quota for mailboxes in various email-domains on a IMAP-server. I have... (1 Reply)
Discussion started by: algernonz
1 Replies

8. Shell Programming and Scripting

Review the Shell Script

Hi, I want to copy all the log file except current date log from one server to another server. Log File will be like this LOGNIG_08_11_2008*.log For this cd /test/log date -d '1 day ago' "+%d_%m_%Y" -->This command gives previous day scp LOGSNIG_date -d '1 day ago' "+%d_%m_%Y"... (2 Replies)
Discussion started by: srinivasvandana
2 Replies
Login or Register to Ask a Question