12.07.2015 Views

download

download

download

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13In case you want to add a service to inetd that is not listed in the defaultconfiguration file, you can take any of the lines as a sample and modify it to suit yourown daemon.The first parameter in each line (in this case, ftp) is the service name. The servicename is then looked up from the /etc/services file, to find out the actual portnumber that should be listened to. In this example, the second parameter, stream,specifies the socket type. A socket type can be one of stream, dgram, raw, rdm, orseqpacket. A typical service running on TCP uses stream, while UDP socket typeis dgram. The third parameter in this example is protocol tcp. For UDP services, thisparameter should be changed to udp.It is advisable to use tcp4, udp4, tcp6 ,udp6, tcp46, or udp46 insteadof tcp or udp, to specify whether a service should work on IPv4 or IPv6(or both) protocol stacks.The fourth parameter in each line (in this example, nowait) specifies whether inetdshould wait for the server to exit before listening for new requests. Generally,services running on TCP protocol should use nowait and UDP should use thewait option.As TCP is a connection-oriented protocol, inetd accepts the new connection requestand passes the connection to the daemon. Once a new connection request is received,inetd launches a new instance of the daemon, and passes the connection tothe daemon.Unlike TCP, the UDP is connection-less and therefore the wait option is used.The fifth parameter on the line (root in this example) is actually the user whomdaemon will launch, with its privilege. You may have noticed that almost all sampleservices in the inetd.conf file will run with root privilege, which is not a goodpractice in the production environment.It is proposed that each daemon to run with a specific user havinglimited privilege (for example, only have permission on required filesand directories), so that in case of any security breach, the scope of thedamage will be limited to that specific service and related filesand directories.Finally the last parameter on the configuration line is the full path to the daemonprogram including the command line parameters (if applicable).[ 205 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!