Need Help with a Shell Script for a Job

Hi Guys,

I need your help with setting up a shell script for the following job. Please help.

  1. Encrypted file received at the SFTP server (.55 network - DMZ) from ABC company
  2. Encrypted file is passed into the internal network (.52 or .53) in one of the system and comes to Folder 'A'
  3. A script runs to decrypt the file in folder 'A' and then immediately scans the file with McAfee Antivirus.
  4. If the file is infected with virus / malware, the decrypted file is deleted and an email is triggered to the Application team. No further processing happens.
  5. If the file is not infected and passes the virus scan, the file gets further encrypted through 7 ZIP and gets copied to Folder 'B' on the same server.
  6. Mule gets configured to copy encrypted file only from Folder 'B' and decrypts it.

On what OS?

what have you done so far?

1 Like

this will be for windows.

---------- Post updated at 05:33 AM ---------- Previous update was at 05:32 AM ----------

Sorry Linux

---------- Post updated at 05:51 AM ---------- Previous update was at 05:33 AM ----------

I am not that good at this and thus seek help of experts like you. Please help, I need this for Linux OS

Welcome sam0912,

I have a few to questions pose in response first:-

  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using? Linux has many suppliers. is this Red Hat, Debian, Mint, Centos, ..... ?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)

Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.

We're all here to learn and getting the relevant information will help us all. We're not a code writing service, but will help you learn how to support your own work, as you know your needs far better than we can.

Kind regards,
Robin

1 Like

Often, requests written like this (and without any related attempts) are students seeking help with a homework/classwork assignment.
Please explain the reason for this request. We do not assist with homework, unless it is posted in the homework queue, and with required information.

2 Likes

If this is really Linux, and you treat the file like text and not an executable, and if this is not homework, you should not need to scan the file with any antivirus software, since none of the ASCII in the inbound files should get executed.

If you are doing this for a class, and if you are doing this on Windows and if you professor requires you to scan the file with antivirus, then you should definitely use Powershell. You can use winzip, or some other compression tool for your encryption. but Powershell is likely to be the easiest tool to interact with McAfee Antivirus.

And follow the homework rules!!!!

:wink:

1 Like

No, this is not a homework :). I need this as a POC for a project in my company. I do know a bit a poweshell but not much in shell scripting. This is needed for an incoming encrypted file (including executables). We want this on Red Hat Linux in shell scripting.

Request you experts to please help with atleast the basic steps for this flow.

With instructions this big and vague, it's hard to give better answers than "step 1: have an sftp server". Really, all I have are questions.

1a) Do you have any control over what is sending the files? If at all possible, you should have the sender move the file to a different folder once it's finished sending, to signal that the file is complete. Trying to tell if an upload is complete or not without the client's assistance is really hard and error-prone.

1b) Does anyone but this process need to access those files? Ideally it could have its own account, locked to sftponly.

2a) "Passed onto the internal network" - what does that mean?
2b) 'comes to folder a' - on the same machine or a different one?
2c) Transferred how?

3a) How was it encrypted? 7zip, same as later?

4a) Do you have mail configured on your linux system?

5a) Copied or moved?
5b) Are you keeping the originals? Why or why not?

1 Like

In addition to what Corona already said/asked:

Really? What should that be good for? I can understand to compress data for transportation purposes to save bandwidth, but if you move around a file inside your own network this is simply not worth the effort.

Note that Lempel-Ziv is a compression algorithm, not an encryption. Everybody with a working copy of the unzip utility (if i remember correctly there are few of these out there) can decode it. It you need encryption go for something the modern OpenSSL library offers. You will need to create and distribute keys for this to work, then.

I hope this helps.

bakunin

1 Like