Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Read-only /
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Eidi
Tux's lil' helper
Tux's lil' helper


Joined: 02 Sep 2004
Posts: 82
Location: Arizona

PostPosted: Tue Feb 21, 2006 8:56 pm    Post subject: Read-only / Reply with quote

I've been wanting to build a dedicated server box for a while, but I've been thinking about how to secure it. I've read parts of the SELinux handbook, but I don't remember them touching on having a readonly / in the /etc/fstab sections.

On a webserver, all that would need to be written to is various log files and /var for hosting an Email server and WordPress. Possibly config files in /etc too. At least, that's how I understand it. I could put those parts on seperate partitions and have everything else read only. The security benefits are obvious, but am I overlooking something? Am I totally misunderstanding what needs to be written to? Would other things need to be written to besides what I mentioned above?

I'd also like to someday do this with my router box, only log files would be written to as far as I can tell.

I'm sorry if this is a stupid question and has been asked many times before, but it doesn't seem to be too common an idea except for LiveCDs from searching. If I have this totally wrong, please correct me.

Thanks!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54539
Location: 56N 3W

PostPosted: Tue Feb 21, 2006 9:01 pm    Post subject: Reply with quote

Eidi,

/etc must be on the root partition or /etc/fstab cannot be read. The only file in /etc/ that needs to be written is mtab.
Do what embedded systems do, for read only roots. make /etc/fstab a symlink to /proc/mounts.

Don't stray too far from the Linux Filesystem Heirarchy - you will get a box that can't boot.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Mankane
n00b
n00b


Joined: 22 Mar 2003
Posts: 27

PostPosted: Thu Feb 23, 2006 3:38 am    Post subject: Reply with quote

Quote:
Do what embedded systems do, for read only roots. make /etc/fstab a symlink to /proc/mounts.


Did you mean make /etc/mtab a symlink to /proc/mounts?

Charlie
Back to top
View user's profile Send private message
Eidi
Tux's lil' helper
Tux's lil' helper


Joined: 02 Sep 2004
Posts: 82
Location: Arizona

PostPosted: Thu Feb 23, 2006 4:23 am    Post subject: Reply with quote

So... Hmm... Well, what if I had a /etc/ on the root partition, but it only contained fstab, and then had another /etc/ that mounted over the top of it later on?

I did something like this with my home partition on my main box, kinda. Doesn't seem to have caused any side effects, except I lose some disk space.

Thanks for the info. I may still try something like this, just for added security, assuming it can even work...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54539
Location: 56N 3W

PostPosted: Thu Feb 23, 2006 5:59 pm    Post subject: Reply with quote

Mankane,

Oops, yes!

You will have to mount root rw to add users, change passwords and so on ...
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Eidi
Tux's lil' helper
Tux's lil' helper


Joined: 02 Sep 2004
Posts: 82
Location: Arizona

PostPosted: Fri Feb 24, 2006 8:42 pm    Post subject: Reply with quote

Ok, I'll set it all up first, and then mount it read only.

Thanks for the info guys.
Back to top
View user's profile Send private message
adsmith
Veteran
Veteran


Joined: 26 Sep 2004
Posts: 1386
Location: NC, USA

PostPosted: Wed Mar 01, 2006 1:49 pm    Post subject: Reply with quote

I'm considering doing something similar, though for different reasons.

Does "ln -sf /proc/mounts /etc/mtab" give problems on mounting, or do gentoo's startup scripts deal nicely with the "-n" option on mount?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54539
Location: 56N 3W

PostPosted: Wed Mar 01, 2006 8:52 pm    Post subject: Reply with quote

adsmith,

You may get errors about not being able to update /etc/mtab but the mount will still work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
wildhorse
Apprentice
Apprentice


Joined: 16 Mar 2006
Posts: 150
Location: Estados Unidos De América

PostPosted: Sat Apr 08, 2006 2:30 am    Post subject: Reply with quote

Maybe it works, maybe not.

FUSE does not mount a fuse-based file system, if euid is equal 0 (root) and /etc/mtab is not writeable. FUSE simply fails. Neither does FUSE know the option -n. In fact it fails if the option -n is present. It is possible to compile fusermount.c with -DIGNORE_MTAB, but that is not a good option either.

The whole concept of /etc/mtab is legacy. :roll:
Back to top
View user's profile Send private message
broken_chaos
Guru
Guru


Joined: 18 Jan 2006
Posts: 370
Location: Ontario, Canada

PostPosted: Sat Apr 08, 2006 5:40 am    Post subject: Reply with quote

To avoid problems like that, you could also just link /etc/mtab to somewhere that is rw, instead of directly to /proc/mounts.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54539
Location: 56N 3W

PostPosted: Sat Apr 08, 2006 9:56 am    Post subject: Reply with quote

wildhorse,

Beware of broken_chaoss' suggestion. The 'somewhere' needs to be mounted before /etc/mtab is written, the startup scripts may not do that. Consider the sequence
mount root
write /etc/mtab to say root is mounted - breaks because mtab is not mounted
mount someplace
wite /etc/mtab to say someplace is mounted - woeks
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
wildhorse
Apprentice
Apprentice


Joined: 16 Mar 2006
Posts: 150
Location: Estados Unidos De América

PostPosted: Sat Apr 08, 2006 6:22 pm    Post subject: Reply with quote

I have looked into /sbin/rc and the rest of the startup procedure. The whole idea of updating /etc/mtab is DOA.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum