[Quoting lots for Garrett to see]
>I vaguely remember that some of these flags were not supposed to
>come into effect until the system went into multi-user mode..
>Bruce Evans <email@example.com> writes:
>No, see the init man page.
Actually, the security handling does change for multi-user mode if
kern.securelevel is 0, but the default is kern.securelevel = -1.
>Unfortunate. I think we should propose changing maintenance mode to
>run at level -1 (or make level 0 not enforce immutable), so that system
>recoveries can be performed. If your system is screwed-up and you are
This was done 18 months ago:
RCS file: /a/ncvs/src/sys/kern/kern_sysctl.c,v
Working file: /sys/kern/kern_sysctl.c
date: 1994/08/10 02:41:09; author: wollman; state: Exp; lines: +2 -2
Change default security level to -1, so that users don't get bitten by
upcoming makefile change.
>trying to restore it, nobody is going to be able to build a special
>run-maint-mode-at-level -1 kernel just for that occasion.
>Maintenance mode should be just that: all knobs exposed.
Securelevel -1 isn't such a mode.
>The immututable flags are always honoured. In secure mode, you can't
>turn then off. In highly secure mode, you can write to the disk
>directly to turn them off.
>Ok, then why as I stated in the very first posting was "Clearing /tmp"
>able to get rid of directories with files that were immutable that
>I had shifted into /tmp, but when I tried to do it myself in maintenance
>mode, I could not? If immutable is honored all the time, "Clearing /tmp"
>would also fail to get rid of these files, yes? Supposedly rc runs
>at level 0 or even level 1. /etc/rc shows nothing more powerful than a
>rm -rf command. How was it done? This is easily demonstratable.
"Clearing /tmp" should fail if there are system-immutable files in /tmp.
It fails here.
>This thread started when I was simply trying to find out why maintenance
>mode or "FSCK CAN'T FIX IT, *YOU* FIX IT" mode from fsck (both 0 level
>in init-ese) can't be allowed to clean up botched files without having to
>have /usr mountable (that's where we hide chflags this week), and why
>standard recovery tools like restore, tar and cpio aren't able to report
>that their restores aren't actually restoring the files you expect them
They don't report restoral because they fail with an "Operation not
permitted" error. They should report this (tar does). They fail
because the schg bit is set. The schg bit is set because someone
considered it important for them to fail. I probably overemphasizied
the security aspects in my previous mail. The point of schg'ing
/usr/lib/libc.so.* is mainly to protect it from overwrites.
>I don't think these flags should be noticed till root decides to go
>I disagree. The problem is that the immutable flags are set by default
>on systems that will never run in secure mode. This provides some
>protection against root doing stupid things, but very little security.
>Then why on Earth do we set them on the standard system? Why not
>have a "paranoid-permissions" file that you apply if you want your system
>to be unmaintainable, ie, more secure.
For most cases it's because 4.4lite sets them and no one has cared enough
to make them easy to manage or actually work. For libc.so.* and ld.so,
they are set to prevent overwrites.
>The immutable flags aren't much use for protecting binaries and
>libraries anyway. Root can bypass them by moving the directory out of
>the way. Only their contents is protected. Protecting contents is
>useful for log files, but log files aren't immutable or append-only by
>As I said in the original post, if it wasn't for being able to use "mv"
>in that fashion, I would have had to nuke the entire system to recover
>when the shared libraries got corrupted, and restore would not replace
>the immutable-but-corrupted copies, and wouldn't say that it wasn't doing
>this. Took quite a while to figure out that it was lying to me.
So the most serious bug is that `restore' doesn't report errors?
>If seems there is agreement after all:
>o The applications should either list the files that can't be restored
> or extracted, or SHOULD BE ABLE TO extract/restore over
> an immutable file in maintenance mode (Level 0) or some other set
> of criteria WITHOUT having to build a level -1 kernel first,
I think that the extract/restore/copy programs should continue to know
nothing about the file flags (except perhaps to generate better error
messages) and that chflags(8) should be put in /sbin and on the standard
>o These and other files shouldn't be immutable in the first place
> on the bulk of the systems out there. Partly because it makes
> sysadmin more difficult, and partly because it provides false
>I'll fix restore to nuke & replace immutable files automatically *if*
>someone would guarantee that some approved version of the changes would
>be allowed into the release tree. (No point if there is some religious
>reason for not doing this.)
>I would prefer that the definition of maintenance mode be changed to not
>enforce immutable BY DEFAULT. If someone wants a more paranoid system,
>then that someone should be required to recompile and bump the maintenance
>mode security level up to 0, not the other way around.
No. If you don't want any immutable files, then don't set any immutable
flags. Perhaps this should be the default even for security-related files.