LinuxQuestions.org
Visit Jeremy's Blog.
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 04-30-2006, 11:08 AM   #1
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
Can I use file attributes with ReiserFS


I have a Debian Sarge system set up and I tried changing a file to make it immutable. It set the flag and lsattr showed that the flag was set. However, I was able to delete the file. I noticed online some articles saying that ReiserFS was not able to use file attributes. However, I find it strange that I was able to set the option and it echoed the result. Shouldn't I have received an error saying this file system doesn't support file attributes or something? Is there a way to get file attributes with ReiserFS?
 
Old 04-30-2006, 06:38 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
ReiserFS isn't your problem. I think you've got the whole permissions concept wrong. Write permission affects whether the contents of the file can be changed, but it doesn't protect the file as a whole. For that, you need to modify the directory permissions. If the user has write permission to the directory, he can create or delete files in it.

It will make more sense if you think of a directory not as a container, but as a file itself, one that contains a list of other files inside it. Only someone who can modify that list can add or remove entries (files) from it.
 
Old 04-30-2006, 10:54 PM   #3
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

Unless I'm mistaken the immutable tag overrides folder options on the file. I've used it in the past and I'm almost positive it works this way. In fact I have a copy of Hardening Linux in front of me and here's there test instructions:

# touch log
# chattr +a log
# lsattr
# -----a------- ./log

This obviously is a file having the append-only option applied. If it didn't work, by itself, it would serve no purpose. Unfortunately, I don't have a box with a ext3 filesystem so I can't test my theory right now.
 
Old 05-01-2006, 06:39 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Ok, maybe I misunderstood, sorry. Is this one of the advanced permission tags that most people don't use or something? Perhaps ReiserFS doesn't support those. I'm no expert on Linux security.

(I've got to start paying more attention to which forum the 0-Reply threads are in before I reply. )
 
Old 05-01-2006, 07:05 AM   #5
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

Yeah, they are. I just reinstalled my Debian system (using an ext3 filesystem this time) and now they work.

For a hardened system they're great. They can make it impossible for people to modify or delete log files, however they can still be appended to. You can use them on files you want to make sure can never change. There's quite a few switches. The thing about them is, even though files become immutable by even root, all you have to do is shut off the flag and you can then delete them. However, you can download the lcap utility which lets you change some kernel options so that you can disable certain flags. Even though you can no longer set a flag, any flags already set are honored. Once the lcap shuts off a flag it cannot be turned on or used again until you reboot the system. What you can do though is create a script which sets it to automatically disable the flags on every boot so you can then have files that can never be deleted or modified. I set it to auto start on all runlevels with networking enabled. This way you have a back door into your system if you need it. BSD uses a similar method called secure levels. I'd recommend setting it on log files. You can use the append flag and the files can be added to but never modified or deleted. If an attacker gets into your system they can't remove their tracks which might scare them off before they do any damage. To make sure an attacker can't disable the script and reboot the system you can even use the switch on the script before you turn it off. This also gives you the comfort of knowing certain files haven't been comprimised and can't. If used well it's a good security tool.

Last edited by HGeneAnthony; 05-01-2006 at 07:11 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
FAT file attributes lillig Linux - General 5 03-28-2013 11:42 AM
Changing File Attributes terdbird Slackware 6 04-23-2005 03:39 AM
uploaded file on vsftpd has wrong file attributes rune.kg Linux - Newbie 2 03-06-2004 09:23 AM
file attributes binky22 Linux - Newbie 2 09-26-2003 04:17 PM
Changing file attributes from C sourceman Linux - General 3 04-23-2002 07:37 PM

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

All times are GMT -5. The time now is 05:57 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