Sending a heartbeat from an sg-1100 to an external file server
-
Hi,
I'm working on an odd project where I am hoping to have an sg-1100 upload a heartbeat of sorts to an external server. In the past I have done this with bash, but I know bash is disfavored on FreeBSD. I have also done it on Windows with a simple batch script and WinSCP. But I don't know how best to do it here.
Be forewarned: the remote server is pretty dumb. I currently have (contain your revulsion) bash running periodic checks for heartbeat files. Those files are uploaded via SFTP or SCP to the server periodically by the various devices it "monitors", each containing just an ID and a date/time stamp. As long as the time stamp is recent, the bash script just terminates (if not, it alarms). This check is then run periodically via cron. So in keeping with this janky system, I think I want a simple way to upload a file from this firewall, to that server. Note: I do NOT want to open ports on this box for monitoring, nor do I want to use syslog...I want low-risk, internally initiated traffic, leaving through this unit's WAN port. Inbound pings are also not an option.
I know I can schedule the job to run via cron on this pfSense/FreeBSD box, but I don't know what mechanism to use to get it done in the first place. Can I use some equivalent of the internal bash script I use elsewhere, without destroying the box's security?
Any suggestions? Also, I'm afraid to ask, but any criticisms also?
P.S. I hope posting this question in "general" is okay...I didn't see a good category for it.
-
If it's just SCP a file with basic content you can probably do that using a one line command in cron directly.
But if not you can just call a shell script to do it. pfSense doesn't use bash by default it uses tcsh or you can also use sh. You might need to modify your bash script to run but it's probably not that hard.
Or you can just install bash.Steve
-
@stephenw10 said in Sending a heartbeat from an sg-1100 to an external file server:
If it's just SCP a file with basic content you can probably do that using a one line command in cron directly.
I would like to, but I need to delete, create and upload the file, all in one line. That might be beyond my capacity.
But if not you can just call a shell script to do it. pfSense doesn't use bash by default it uses tcsh or you can also use sh. You might need to modify your bash script to run but it's probably not that hard.
I'm working on that, but having issues. I can't seem to get it to execute properly, but the error reporting is rather noticeably absent...and I really don't want to build something extensive just for the purpose. Even exporting the output of an echo doesn't work.
Or you can just install bash.
Steve
Very tempting.
-
Mmm, thinking about this what you really want is to create the file on the remote server yes?
You could probably do that with SSH directly rather that creating it locally and then moving it.