LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-16-2018, 01:57 PM   #1
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
Monitoring SSHFS connections


How does one monitor SSHFS connections?

I hope I am overlooking something obvious. I am not looking for information about malicious hacking. Just normal monitoring.

When connecting directly through SSH, the shell history reveals the user's commands. Not so with SSHFS. Files can be changed through SSHFS and the shell history is never touched.

The /var/log/secure (audit.log) shows who connected but not any activity.

Thanks.
 
Old 12-16-2018, 02:04 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Since sshfs provides a local mount of a remote file system, wouldn't any activity be reflected in the local history/logs?
I woudn't expect the remote system to know anything about activity, although of course a change (add/remove/edit) of a file on the local system would be visible (but not logged) on the remote system.
 
Old 12-16-2018, 03:36 PM   #3
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Original Poster
Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
Quote:
wouldn't any activity be reflected in the local history/logs
Possibly, but access to that history or logs is unlikely if personal systems are used for the access. That in itself is a different security topic for another day.

At the moment, looks like I might have to learn about the built-in kernel auditing.

Last edited by upnort; 12-16-2018 at 03:40 PM.
 
Old 12-16-2018, 03:48 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by upnort View Post

When connecting directly through SSH, the shell history reveals the user's commands. Not so with SSHFS. Files can be changed through SSHFS and the shell history is never touched.
Let me point out that the user has full control of the Bash history and can switch it off. Or use a shell that doesn’t have a history mechanism.

I think you want an intrusion detection system. Alternatively, you could audit exec and open system calls.
 
Old 12-16-2018, 03:55 PM   #5
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Original Poster
Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
Quote:
Let me point out that the user has full control of the Bash history and can switch it off. Or use a shell that doesn’t have a history mechanism.
Yes, I know. Thankfully that is not an issue though.

Quote:
I think you want an intrusion detection system.
Possibly, but probably not. I already know who is logged in, when, and from what IP address. I just can't tell what was changed when SSHFS is used rather than direct SSH login. And yes, sometimes "who" logged in through SSHFS is me.

Quote:
Alternatively, you could audit exec and open system calls.
Yes, I mentioned that in my previous post.

Last edited by upnort; 12-16-2018 at 03:57 PM.
 
Old 12-16-2018, 05:36 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,751

Rep: Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929
sshfs is the fuse file system for sftp which is a subsystem of ssh. You need to enable sftp log level in your server's sshd_config file. I believe the logs will be in the system log file which depends on the distribution.

Assuming your not using a chroot user try this:

Subsystem sftp /usr/libexec/openssh/sftp-server -l VERBOSE

I don't know if anything is logged on the client.

Last edited by michaelk; 12-16-2018 at 05:55 PM.
 
1 members found this post helpful.
Old 12-17-2018, 12:45 PM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
check syslog
 
Old 12-18-2018, 01:42 AM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by michaelk View Post
sshfs is the fuse file system for sftp which is a subsystem of ssh. You need to enable sftp log level in your server's sshd_config file. I believe the logs will be in the system log file which depends on the distribution.
this.
also fuse can probably be tweaked somehow to output informational messages.
lastly sshfs has some options of its own too.

another of these questions that wouldn't have been asked if OP had done their research, or at the very least RTFM (read the fruitful manual).
 
Old 12-18-2018, 02:51 AM   #9
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,333
Blog Entries: 3

Rep: Reputation: 3729Reputation: 3729Reputation: 3729Reputation: 3729Reputation: 3729Reputation: 3729Reputation: 3729Reputation: 3729Reputation: 3729Reputation: 3729Reputation: 3729
Quote:
Originally Posted by michaelk View Post
Assuming your not using a chroot user try this:

Subsystem sftp /usr/libexec/openssh/sftp-server -l VERBOSE
If you do a lot of logging, you can make a separate log file by giving the SFTP activity a different log facility, e.g. LOCAL2, instead of the default of AUTH.

Code:
Subsystem   sftp    /usr/libexec/openssh/sftp-server -f LOCAL4 -l VERBOSE
Then adjust your log server and log rotation to deal with the SFTP logs separately.
 
1 members found this post helpful.
Old 01-22-2019, 01:16 PM   #10
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Original Poster
Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
Funny how priority lists get changed. I finally was able to get back to this task.

Thanks much for the friendly nudging about SSHFS being a FUSE subsystem and being related to SFTP. For the moment I am using INFO logging details on a test system. I decided to dump the output to the SSH authentication log. Working fine, although I had to tweak rsyslog.conf. Oddly, authpriv.* was defined but not auth.*, which I added.

In summary,

* Edit /etc/ssh/sshd_config:

Code:
Subsystem	sftp	/usr/libexec/openssh/sftp-server -l info -f auth
* Edit /etc/rsyslog.conf:

Code:
authpriv.*                                    /var/log/secure
auth.*                                        /var/log/secure
I'll tag this topic as solved.

Quote:
another of these questions that wouldn't have been asked if OP had done their research, or at the very least RTFM (read the fruitful manual).
Pompous and not constructive. Sometimes people need some friendly nudging.
 
1 members found this post helpful.
  


Reply



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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
squid drops connections to ip addresses, but allows connections to domain names igoryonya Linux - Networking 4 11-07-2014 05:10 PM
squid drops connections to ip addresses, but allows connections to domain names igoryonya Linux - Networking 2 11-06-2014 10:33 PM
Monitoring free memory with enterprise monitoring application Steelb Linux - Enterprise 2 02-13-2008 10:10 AM
Monitoring ssh connections in slackware.. Ryuji Yamazaki Slackware 7 05-15-2006 10:03 AM
2000 MySQL connections, still "too many connections" newlinuxnewbie Linux - General 0 11-07-2005 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration