Bind to a port and drop privileges.
- Running as root is unsafe.
- Ports below 1024 require root privileges.
- Drop privileges fast by binding to a port early.
npm install port-drop --save
Get it into your program.
const portDrop = ;
Allocate file descriptors for some ports you intend to use and immediately drop privileges.
const fd = portDrop;
fd object has the same properties as the input object, but with the values being file descriptors. You can then pass these to Node's Server#listen() method, for example.
See our contributing guidelines for more details.
- Fork it.
- Make a feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request.
Go make something, dang it.