Operating System - HP-UX
1833527 Members
3277 Online
110061 Solutions
New Discussion

Any way to secure the socket FD

 
Sumanth N
Occasional Advisor

Any way to secure the socket FD

Hello,
I have a Listening socket on port 2345. Is there any way that to set permissions to Socket FD so that only root process can read/write through it.

or any other ways to secure the FD?
Thanks,
Sumanth
2 REPLIES 2
Kiran Kumar M
Advisor

Re: Any way to secure the socket FD

I don't think this is possible. It may be be possible if you are using local sockets where you can create physical socket descriptors.
rick jones
Honored Contributor

Re: Any way to secure the socket FD

Are you trying to limit access to the _port number_ to just root, or to the actual file descriptor that is the socket in the context of a particular process?

IIRC, no other process (at least no other process not forked from this one) can access that particular FD.

As for the _port number_ well, above 1024 those are first-come, first served. Now, if you are the first, and do not happen to set SO_REUSEADDR or SO_REUSEPORT then no other application will be able to bind() to that port number. Particularly if your application happens to have called bind() with that port number and the various IP addresses on the system. (Not just INADDR_ANY)
there is no rest for the wicked yet the virtuous have no pillows