359 reputation
18
bio website nicholaswilson.me.uk
location Cambridge, United Kingdom
age
visits member for 2 years, 1 month
seen Apr 8 at 13:49

A recent maths Part III (masters) graduate, with interest in functional languages. Unix enthusiast. Has day job writing enterprisey C++ app.


Jan
22
comment Why is UID information not in /proc/X/stat?
@AndrewB For the record, ps looks it up in /proc/<pid>/status! It uses both the stat and status files, because neither contains all the bits of information it needs (uids are only in status, controlling terminal is only in stat... it's a mess).
Dec
19
answered Which systems do not honor socket read/write permissions?
Dec
11
accepted Will there ever be a Solaris 12?
Dec
5
asked Will there ever be a Solaris 12?
Nov
7
accepted Linux nuisance: /dev/stdin doesn't work with sockets
Nov
6
comment Linux nuisance: /dev/stdin doesn't work with sockets
@Gilles Possibly - do you have an example of where it would be a problem? Solaris and others get away quite happily with open() working for sockets, so it can't be a big security issue. It would probably only affect poorly-written applications that make dodgy assumptions. We fstat fds passed in to see what type they are.
Nov
6
comment Linux nuisance: /dev/stdin doesn't work with sockets
@Stephane A commercial unix application here that runs on Solaris/AIX and is launched with a load of inherited fds (Solaris bidi pipes, sockets), and what it does with each is given in some /dev/fd/ arguments. It's looking like the linux version isn't going to be able to have the same scheme of arguments.
Nov
5
comment Linux nuisance: /dev/stdin doesn't work with sockets
Yes - see the example in Linux's proc(5). Overloading "-" is a bit nasty, and not every application does it. It's a complete pain that you can't open() /dev/stdin on linux when it's a socket, unlike every other system. I'll may have to hack in the "-" kludge to the application if there isn't a better way to do it.
Nov
5
revised Linux nuisance: /dev/stdin doesn't work with sockets
clarify
Nov
5
comment Linux nuisance: /dev/stdin doesn't work with sockets
I'm using cat as a general example of any tool that opens a filename, as a way for you to specify a specific fd to use. So it's not more useful than normal cat - but for lots of tools, passing a filename on the commandline is the only way to get them to use stdin. The error printed is "No such device or address", from open(2) returning ENXIO.
Nov
5
asked Linux nuisance: /dev/stdin doesn't work with sockets
May
17
comment What are the dangers of setting a high limit to max File Descriptors per process?
Just to note, there can be a security impact too. Many servers are vulnerable to ACE if given more than FD_SETSIZE descriptors (usually 1024). A small sample of affected applications: securityfocus.com/archive/1/388201/30/0 So, only raise the soft limit higher than 1024 for specific applications you really trust, not system-wide.
Feb
27
awarded  Yearling
Feb
22
comment Drop Process Privileges
Correct. initgroups, setgid, setuid (last!) is precisely the right paradigm on unix, and should always be followed. In addition, a responsible "droproot" function checks that its uid and gid really have been set, even if all three primary functions returned success.
Feb
22
comment Drop Process Privileges
@David Actually, setuid() does set real and saved userids; you may be thinking of seteuid(). Not all systems have setreuid(), so it can't be used quite everywhere. The exact semantics of setuid() are compliced, but if you have euid 0, you will be able to drop all traditional user-id privileges with setuid(). The biggest omission in this answer is that initgroups or setgroups must be called as well as setgid and setuid, and that more thorough assertions should be done at the end.
Feb
22
comment Drop Process Privileges
No, please don't run things using a shell simply to drop privileges. That leaves far too much in the control of an attacker, reading in various config files you don't want to be touching.
Feb
22
comment Drop Process Privileges
No. This is not good advice: calling setuid() alone is absolutely not enough.
Feb
12
accepted How do I write a login daemon?
Feb
12
comment Is Red Hat Linux licensed
You want CentOS, a beer-free build of the RedHat source. Only the source is open, not the installable builds.
Jan
28
comment What are the dangers of setting a high limit to max File Descriptors per process?
That sounds reasonable. We've run into this before on Solaris too; 256 is just too small as a default for modern systems. A non-forking server can easily peak at two hundred concurrent clients if the connections are being held open but idle for any length of time.