|
Default Use of Privileged Ports Changed
Default Use of Privileged Ports Changed
Noel recently changed (putback in snv_22) the Solaris NFS client's default behavior for port selection. Previously, the client would default to using privileged ports via the variables 'clnt_cots_do_bindresvport' for TCP and 'clnt_clts_do_bindresvport' for UDP.
Why did we set the default set for privileged ports in the first place way back when? It served its purpose in the older days of insecure NFS, where servers would automatically deny client requests using a non-reserved port. Now with RPCSEC_GSS, we can move forward.
Another piece to this puzzle, is nfs_portmon. It has this comment in the code:
/*
* If nfs_portmon is set, then clients are required to use privileged
* ports (ports < IPPORT_RESERVED) in order to get NFS services.
*
* N.B.: this attempt to carry forward the already ill-conceived notion
* of privileged ports for TCP/UDP is really quite ineffectual. Not only
* is it transport-dependent, it's laughably easy to spoof. If you're
* really interested in security, you must start with secure RPC instead.
*/
static int nfs_portmon = 0;
And can be found in nfsd(1M). Turning it on forces the server to only accept privileged ports. Since i dislike nfs_portmon so much, i'm leaving it up to the reader to figure out how to turn it on.
So Noel's fix is to have the client (by default) try using a non-privileged port, and if that fails with AUTH_TOOWEAK due to someone (unfortunately) having nfs_portmon turned, then it will retry the request using a privileged port (assuming the client has some available).
Technorati Tag: OpenSolaris
Technorati Tag: Solaris
Technorati Tag: nfs
(2005-11-14 17:02:50.0/2005-08-15 15:51:52.0)
Permalink
Trackback: http://blogs.sun.com/erickustarz/en_US/entry/default_use_of_reserved_ports
|
Can you explain why this is a good thing?
Or, more accurately, what is wrong with the current system that makes this change worthwhile?
While I agree that simply using privileged ports isn't the answer to securiy, it doesn't actually harm security, may help in some cases, and is an eminently sensible default.
I would argue against this change, as it:
Certainly on all my systems, nfs_portmon is enabled - and has been since as long as it's been possible to do so. In fact, what I've never understood is why having nfs_portmon turned off is still the default.
Posted by Peter Tribble on August 16, 2005 at 02:24 AM PDT #
Posted by anon on August 16, 2005 at 02:56 PM PDT #
Ah controversy!
So the motivation for the change (i believe this answers both comments) is that we've run into situations where vague "NFS problems" were happening simply due to no more privileged ports being available. Having the client not try to use privileged ports by default fixes that. Having the client use precious kernel resources unnecessarily seems odd.
Now for admins who know what they are doing, simply enabling 'nfs_portmon' is one way of enforcing the privileged ports... a better way is real security via RPCSEC_GSS.
I believe that is the real answer here: the various NFS implementations in existence (solaris, linux, AIX, netapp, etc) are strong now and that mandating real security should be the norm.
As for perf hit, it won't matter as once the connection is established, we continue to the the privileged or non-privileged port (whatever the server mandates) - and the connection will live as long as there's active traffic.
And the only code change was flipping a 1 to 0 :)
Posted by eric kustarz on August 16, 2005 at 04:49 PM PDT #
Posted by <the occasional blog> on August 21, 2005 at 09:17 AM PDT #
Posted by MissMichelle on October 03, 2005 at 04:07 PM PDT #
Posted by eric kustarz on October 03, 2005 at 04:27 PM PDT #