Skip to contentSkip to conversation

How to Audit ssh Commands --> wget, scp

DISCUSSION varun gulati 3 participants 6 messages May 9, 2016 – May 10, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1090410784.877995.1462810399474.JavaMail.yahoo.ref@mail.yahoo.com

#1 lore raw

Hi Team,
We have requirement where we have to monitor and log any read operations performed on a file.
e.g. /a/b/c/xyz.log
This file is usually copied and downloaded by many users using various operations, like, wget, ssh, jsp Download link provided. These commands are fired from different hosts.
With the auditd we want to create a rule which auditctl can leverage to log the User ID that is reading (and copying) it from a different host may be. I have gone through many of the rules but didn't find anything fruitful as such (which logs wget, scp commands from remote hosts). May be I am missing on something. Since it is a very crucial requirement, appreciate your guidance and directions with this. Let me know in case you require any further information from my end. Many thanks in advance.

Thanks and Regards,Varun Gulati

#2 lore raw
Quoted 3 lines · varun gulati

Hi Team,
We have requirement where we have to monitor and log any read operations performed on a file. e.g. /a/b/c/xyz.log

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

Quoted 5 lines

This file is usually copied and downloaded by many users using various operations, like, wget, ssh, jsp Download link provided. These commands are fired from different hosts. With the auditd we want to create a rule which auditctl can leverage to log the User ID that is reading (and copying) it from a different host may be.

You will get the local auid/uid that the kernel sees when the request triggers the rule. There is nothing more that can be done from the audit system.

-Steve

Quoted 9 lines

I have gone through many of the rules but didn't find anything fruitful as such (which logs wget, scp commands from remote hosts). May be I am missing on something. Since it is a very crucial requirement, appreciate your guidance and directions with this. Let me know in case you require any further information from my end. Many thanks in advance.

Thanks and Regards,Varun Gulati

#3 lore raw

Hi Steve,
Thanks for your suggestions. We incorporated the below rule for auditctl which you suggested, but unfortunately it didn't helped. We are able to log the wget from the same server but unfortunately it is still not logging from a different host:
-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access
This is how the file looks like:
-w /a/b/c/xyz.log -p rwxa -k Audit
-w /usr/bin/wget -p rwxa -k Audit
-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access
But nothing is logging the Audit when wget is called from any other host. Can you please assist on this further.
Thanks and Regards,Varun Gulati

On Tuesday, 10 May 2016 1:32 AM, Steve Grubb <[email protected]> wrote:

Quoted 3 lines · varun gulati

Hi Team,
We have requirement where we have to monitor and log any read operations performed on a file. e.g. /a/b/c/xyz.log

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

Quoted 5 lines

This file is usually copied and downloaded by many users using various operations, like, wget, ssh, jsp Download link provided. These commands are fired from different hosts. With the auditd we want to create a rule which auditctl can leverage to log the User ID that is reading (and copying) it from a different host may be.

You will get the local auid/uid that the kernel sees when the request triggers the rule. There is nothing more that can be done from the audit system.

-Steve

Quoted 9 lines

I have gone through many of the rules but didn't find anything fruitful as such (which logs wget, scp commands from remote hosts). May be I am missing on something. Since it is a very crucial requirement, appreciate your guidance and directions with this. Let me know in case you require any further information from my end. Many thanks in advance.

Thanks and Regards,Varun Gulati

#4 lore raw
Quoted 26 lines · varun gulati

Hi Steve,

Thanks for your suggestions. We incorporated the below rule for auditctl which you suggested, but unfortunately it didn't helped. We are able to log the wget from the same server but unfortunately it is still not logging from a different host:

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

This is how the file looks like:

(quoted diff) +0 -3
-w /a/b/c/xyz.log -p rwxa -k Audit
 
 
-w /usr/bin/wget -p rwxa -k Audit
 
 
-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access
Quoted 2 lines

But nothing is logging the Audit when wget is called from any other host. Can you please assist on this further.

If you are using a web service (httpd, etc) to service your files, then make it authenticated and have it log.

Quoted 64 lines

Thanks and Regards,
Varun Gulati

On Tuesday, 10 May 2016 1:32 AM, Steve Grubb <[email protected]> wrote:

Quoted 2 lines · varun gulati

Hi Team,
We have requirement where we have to monitor and log any read

operations

Quoted 1 line

performed on a file. e.g. /a/b/c/xyz.log

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

Quoted 1 line

This file is usually copied and downloaded by many users using

various

Quoted 1 line

operations, like, wget, ssh, jsp Download link provided. These

commands are

Quoted 1 line

fired from different hosts. With the auditd we want to create a rule

which

Quoted 1 line

auditctl can leverage to log the User ID that is reading (and

copying) it

Quoted 1 line

from a different host may be.

You will get the local auid/uid that the kernel sees when the request triggers
the rule. There is nothing more that can be done from the audit system.

-Steve

Quoted 1 line

I have gone through many of the rules but didn't find anything

fruitful as

Quoted 1 line

such (which logs wget, scp commands from remote hosts). May be I am

missing

Quoted 1 line

on something. Since it is a very crucial requirement, appreciate

your

Quoted 1 line

guidance and directions with this. Let me know in case you require

any

Quoted 5 lines

further information from my end. Many thanks in advance.

Thanks and Regards,Varun Gulati

--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit

#5 lore raw

 Hi Team,
Thanks for the response. We are not using web services to provide/serve this file. Its simply kept at a particular folder which people download using wget. Here is the wget command users are using to download the file from the different hosts:
wget --no-cache http://servername/app/name/dist/xyz.zip
Still no logging is happening :(Need your expert help with this.

Thanks and Regards,Varun Gulati

On Tuesday, 10 May 2016 6:26 PM, Burn Alting <[email protected]> wrote:

Quoted 26 lines · varun gulati

Hi Steve,

Thanks for your suggestions. We incorporated the below rule for auditctl which you suggested, but unfortunately it didn't helped. We are able to log the wget from the same server but unfortunately it is still not logging from a different host:

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

This is how the file looks like:

(quoted diff) +0 -3
-w /a/b/c/xyz.log -p rwxa -k Audit
 
 
-w /usr/bin/wget -p rwxa -k Audit
 
 
-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access
Quoted 2 lines

But nothing is logging the Audit when wget is called from any other host. Can you please assist on this further.

If you are using a web service (httpd, etc) to service your files, then make it authenticated and have it log.

Quoted 64 lines

Thanks and Regards,
Varun Gulati

On Tuesday, 10 May 2016 1:32 AM, Steve Grubb <[email protected]> wrote:

Quoted 2 lines · varun gulati

Hi Team,
We have requirement where we have to monitor and log any read

operations

Quoted 1 line

performed on a file. e.g. /a/b/c/xyz.log

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

Quoted 1 line

This file is usually copied and downloaded by many users using

various

Quoted 1 line

operations, like, wget, ssh, jsp Download link provided. These

commands are

Quoted 1 line

fired from different hosts. With the auditd we want to create a rule

which

Quoted 1 line

auditctl can leverage to log the User ID that is reading (and

copying) it

Quoted 1 line

from a different host may be.

You will get the local auid/uid that the kernel sees when the request triggers
the rule. There is nothing more that can be done from the audit system.

-Steve

Quoted 1 line

I have gone through many of the rules but didn't find anything

fruitful as

Quoted 1 line

such (which logs wget, scp commands from remote hosts). May be I am

missing

Quoted 1 line

on something. Since it is a very crucial requirement, appreciate

your

Quoted 1 line

guidance and directions with this. Let me know in case you require

any

Quoted 5 lines

further information from my end. Many thanks in advance.

Thanks and Regards,Varun Gulati

--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit

#6 lore raw
Quoted 2 lines · varun gulati

Thanks for the response. We are not using web services to provide/serve this file.

You have to be. :-) If someone on another system uses wget to access a file on the system you care about, something is serving the file on port 80. Maybe you need to do a netstat -tanp to see what is serving the file.

Quoted 11 lines

Its simply kept at a particular folder which people download using wget. Here is the wget command users are using to download the file from the different hosts: wget --no-cache
http://servername/app/name/dist/xyz.zip
Still no logging is happening :(Need your expert help with this.

Quoted 5 lines

Thanks for your suggestions. We incorporated the below rule for auditctl which you suggested, but unfortunately it didn't helped. We are able to log the wget from the same server but unfortunately it is still not logging from a different host:

Quoted 5 lines
Quoted 5 lines

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

This is how the file looks like:

-w /a/b/c/xyz.log -p rwxa -k Audit

This should get you all access of that file if you are on a distribution that enables the audit system unless you are on a special file system like NFS which is not supported by the audit system.

Quoted 1 line
Quoted 1 line

-w /usr/bin/wget -p rwxa -k Audit

This will show execution of wget on the server, not the client.

Quoted 1 line
Quoted 1 line

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

This is roughly the same as the first above just expressed in the longer form.

Quoted 5 lines
Quoted 2 lines

But nothing is logging the Audit when wget is called from any other host. Can you please assist on this further.

If you are using a web service (httpd, etc) to service your files, then make it authenticated and have it log.

I agree on this point. Auditd will tell you that the web server accessed the file but not who is getting it. Only the web server can know that.

-Steve

Quoted 64 lines
Quoted 64 lines

On Tuesday, 10 May 2016 1:32 AM, Steve Grubb <[email protected]> wrote:

Quoted 2 lines · varun gulati

Hi Team,
We have requirement where we have to monitor and log any read

operations

Quoted 1 line

performed on a file. e.g. /a/b/c/xyz.log

-a always,exit -F path=/a/b/c/xyz.log -F perm=r -F key=log-access

Quoted 1 line

This file is usually copied and downloaded by many users using

various

Quoted 1 line

operations, like, wget, ssh, jsp Download link provided. These

commands are

Quoted 1 line

fired from different hosts. With the auditd we want to create a rule

which

Quoted 1 line

auditctl can leverage to log the User ID that is reading (and

copying) it

Quoted 1 line

from a different host may be.

You will get the local auid/uid that the kernel sees when the request triggers
the rule. There is nothing more that can be done from the audit system.

-Steve

Quoted 1 line

I have gone through many of the rules but didn't find anything

fruitful as

Quoted 1 line

such (which logs wget, scp commands from remote hosts). May be I am

missing

Quoted 1 line

on something. Since it is a very crucial requirement, appreciate

your

Quoted 1 line

guidance and directions with this. Let me know in case you require

any

Quoted 5 lines

further information from my end. Many thanks in advance.

Thanks and Regards,Varun Gulati

--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit