Stone, Timothy wrote:
----------------->>>>
I'm writing down ideas for, and seeking help with, a bash script. This
script will perform at least two SCP connections to Windoze boxes running an
OpenSSH service (www.networksimplicity.com). I have some questions and I'm
also concerned about how this script should run, as root or as someother
user (a user to be created or an exisiting one). I would like some comments
and ideas on my current path as I'm a bash script newbie.
The idea is that I will publish a website to my staging server (running RHL
7.3) from my development box. A cronjob will run at 6AM and 6PM each day
that will SCP the staging docroot to the production boxes.
I may be over thinking the security part since the staging server itself
resides in a relatively secure room (limited physical access). And I'm the
only one on the staging server because my coworkers are all MCSE
Linux-phobes. I run a regular user and sudo everything needing root
permission. However, I don't want the script to freely editable that a crack
could SCP a different "docroot"... oh, the ugliness.
Ideas and questions:
?? 755 permissions... root only read/write/exec, everyone else read/exec
the SCP -oIdentityFile switch to eliminate password in script
?? how to "block" while one SCP process completes before init the next one;
exit code strategy of some sort I think.
?? how to write to an exit code file for reporting; possibly eMail? I'm not
running a SMTP/POP server on the staging box so how is this accomplished? I
need to tell the script about an MTA someplace... possibly my network's
Exchange box.
the cronjob part I got.
----------------->>>>
Permissions you should get then! I got those long before I got cron.
But anyway, you could lock down the script to just the user you want running
it (like 700 or 750).
You could use Key Pair authentication in your ssh calls and eliminate any
passwords in scripts.
I would use perl for your process control and exit code strategy. tcl with
expect would be great for this too. However the basic idea is to try and
catch errors in the calls to scp:
if (scpcall) {print error then exit}
Again perl is great for the smtp stuff. Doesn't really matter what smtp
server it is (as long as you have access and it will relay your messages. I
use Net::SMTP for something like what your describing.
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@;redhat.com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list