Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linux script help!!!!

Status
Not open for further replies.

Wahero

Technical User
Oct 5, 2001
6
0
0
MO
Can anyone help me in following problem :

I am using openssl to generate req and sign the cert.

./CA -newreq
./CA -sign
in above script I must enter many input parameters , like PEM,CN,State,city,and Common name...

The problem was that I must generate many req and sign the certs .
I want to write a batch script to do the job more qucikly.
The input parameter I will store it in a file , just like:

IP:192.33.88.1 CN:item1
IP:192.33.88.2 CN:item2
IP:192.33.88.3 CN:item3

then read them in the script , and process the req generate and sign action.

May anyone give me some sample . Thanks a lot.
 
Presuming your input file contains something like this:

[tt]one:two:three with spaces
four:five with spaces:six[/tt]

You could use something salong the lines of:

[tt]#!/bin/bash

IFS=:
cat inputfile | (
while read ONE TWO THREE
do
(
echo "$ONE"
echo "$TWO"
echo "$THREE"
) | CA -sign
done
)[/tt]

This presumes that CA accepts these prompts from standard input. I use an inter-field separator (IFS) of ":" so that any fields with spaces in them are treated as one field. Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top