Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Help with background/root/encrypted scripting

Help with background/root/encrypted scripting
Thread Tools
waffffffle
Mac Elite
Join Date: Sep 2000
Status: Offline
Reply With Quote
Jan 19, 2004, 04:35 AM
 
I have a perl script that I need to run at all times. It periodically collects network data and writes it to stdout, which I redirect to a file. The information that this script writes is highly sensitive and I would like some help in setting it up in a more secure way.

First off, how can I make it run in the background at startup? It needs to run as root. Also, how can I make it so that the script doesnt overwrite the output file everytime that it is launched (in this case it would be upon restart) because just using the command "script > outputfile" will result in the outputfile being overwritten. Is there a way that I can append the data to the end of the file instead?

Also, since this data is highly sensitive, is there a way that I can have the output file encrypted so that i can only be unencrypted with a password? Right now I usually use "tail -f" to read the contents of the file when I need to see the updates happening live. Is there a way to encrypt the file and still allow something similar?

Thanks for the help.
     
Mithras
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Jan 19, 2004, 10:35 AM
 
1. Copy
file:///System/Library/StartupItems/LDAP

into /Library/StartupItems (create if it doesn't exist),
then modify the script named LDAP and the Info.plist to suit your needs.

2. To append, use >> instead of >

3. Not sure.
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jan 19, 2004, 12:38 PM
 
Originally posted by waffffffle:
Also, since this data is highly sensitive, is there a way that I can have the output file encrypted so that i can only be unencrypted with a password? Right now I usually use "tail -f" to read the contents of the file when I need to see the updates happening live. Is there a way to encrypt the file and still allow something similar?
Since your first two questions were answered I will tackle the third. I don't think Perl has any built-in way to encrypt data on the fly like that. You could encrypt the string and then write the encrypted string to a file. However, you would have to write a "reader" tool to decrypt the file when you wanted to read it.

Alternately, you could use Java, which has encrypted file streams (example here).

If you do decide you want to stick with perl, look at the Crypt::* modules at CPAN -- everything you could ever want is there.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
waffffffle  (op)
Mac Elite
Join Date: Sep 2000
Status: Offline
Reply With Quote
Jan 28, 2004, 05:47 PM
 
Originally posted by Mithras:
1. Copy
file:///System/Library/StartupItems/LDAP

into /Library/StartupItems (create if it doesn't exist),
then modify the script named LDAP and the Info.plist to suit your needs.
Thanks for the help but I am not sure about this part. I copied the folder over. I really don't understand shell scripting too well so I'm not sure what I should put in there.
     
   
 
Forum Links
Forum 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 On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:19 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,