CPUG

The Check Point User Group

A Resource For The Check Point Community.  Fast.  Useful.  Independent.

1. CCSA/CCSE One-Week Dual-Certification Training Course with CPUG in San Francisco!
    Courses Starting (2009) 1/19, 2/9, 3/9, 4/6, 5/4, 6/8, 7/6, 8/3.
2. Join Us On LinkedIn - We now have a CPUG group.


Go Back   CPUG: The Check Point User Group > Check Point Firewall-1/VPN-1 Platforms > Check Point SecurePlatform (SPLAT)
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2007-12-19
Junior Member
 
Join Date: 2007-08-16
Location: Texas
Posts: 8
Rep Power: 0
Tomahawk77 has an average reputation (10+)
Default Crontab, Scripts and Publickeys

I have a problem that I've been trying to figure out for a while now. I'm hoping someone starter than I can help me out.

Situation:
I have my Enforcement Points (EPs) automatically creating a backup file each night. I've wrote a script that is on my Management Server. It performs a SCP command that goes to the EPs and pulls the file to the Management Server. I've created the whole publickey thing so that the script doesn't have to have passwords in the script.

My Problem:
When I setup my Crontab to run the script, it doesn't use the publickey.

My Puzzlement:
When I manually run my script, it works like a charm.

The Logs:
Log file off of Management Server (Failure): Cronjob
[LOG_INFO] sshd-x[4931]: Failed password for admin from 192.168.191.66 port 33652 ssh2
Log file off of Management Server (Success): Manual
[LOG_INFO] sshd-x[5499]: Accepted publickey for admin from 192.168.191.66 port 33900 ssh2

On Management Server:
crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.14824 installed on Fri Aug 17 13:40:50 2007)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
0 22 * * 5 backup_util sched
30 3 * * * /home/tomahawk77/config_backup.sh

The Script:
Line in Script (on Management Server)
/usr/bin/scp -i $HOME/.ssh/id_dsa admin@192.168.191.94:/var/backup/sched/FW.tgz /var/Net_Eng/scripts/Firewall/.

Any suggestions?

A couple things to note…
  • The script is located in the user’s “tomahawk77” home directory.
  • I have three EPs…the problem happens on all three EPs. Central point of failure = Management Server.
  • Crontab does run the script. It performs everything else in my script flawlessly. (This is the only line that fails to work properly.

Thanks,
Tomahawk77
Reply With Quote
  #2 (permalink)  
Old 2007-12-19
Senior Member
 
Join Date: 2006-04-30
Location: Europe, Germany
Posts: 159
Rep Power: 3
dsb.nepo has an average reputation (10+)
Default Re: Crontab, Scripts and Publickeys

try the solution in this thread, and throw away your scp script.
Backup to SCP server


one thing to clarify.
the username is admin but the ID is '0' so the keys have to store in the /root/.ssh directory.
=> $HOME points to /root

for other scripts include the /etc/bashrc file to setup the environ
Reply With Quote
  #3 (permalink)  
Old 2007-12-20
Senior Member
 
Join Date: 2006-09-26
Posts: 855
Rep Power: 3
cciesec2006 has an average reputation (10+)
Default Re: Crontab, Scripts and Publickeys

put this line into your script and it will work:

sh /opt/CPshrd-R55/tmp/.CPprofile.sh

or

csh sh /opt/CPshrd-R55/tmp/.CPprofile.csh

The reason it fails in cron is because it does not have checkpoint
environment variable.
Reply With Quote
  #4 (permalink)  
Old 2008-01-03
Junior Member
 
Join Date: 2007-08-16
Location: Texas
Posts: 8
Rep Power: 0
Tomahawk77 has an average reputation (10+)
Default Re: Crontab, Scripts and Publickeys

Thanks dsb.nepo
When I use the .ssh key information from the root directory, it works. That problem has plagued me from months.

Tomahawk77

Quote:
Originally Posted by dsb.nepo View Post
try the solution in this thread, and throw away your scp script.
Backup to SCP server


one thing to clarify.
the username is admin but the ID is '0' so the keys have to store in the /root/.ssh directory.
=> $HOME points to /root

for other scripts include the /etc/bashrc file to setup the environ
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -7. The time now is 06:26.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0