Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Big cache

by cavac (Parson)
on Aug 02, 2022 at 12:47 UTC ( [id://11145894]=note: print w/replies, xml ) Need Help??


in reply to Re: Big cache (my top ten software development practices)
in thread Big cache

Use least privilege; only run with superuser privilege when you need to.

Yes, and also take it with a grain of salt if your OS vendor/distributor/kernel author/Linus Torvalds says that you need to be superuser to do a certain thing.

For example, by default you need to be root to listen to network ports below 1024, meaning that nearly ALL default network programs on your server need to at least have elevated privileges while starting up (or need some sort of port forwarding stuff thats inflexible, awkward and easy to get wrong). This is especially annoying and potentially dangerous when you are actively developing software (like a webserver or a nameserver).

I usually run my system with net.ipv4.ip_unprivileged_port_start=0. This way no more root required to run your DIY webserver or nameserver (or to debug them in the IDE).

PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP

Replies are listed 'Best First'.
Re^3: Big cache
by afoken (Chancellor) on Aug 02, 2022 at 14:50 UTC
    For example, by default you need to be root to listen to network ports below 1024, meaning that nearly ALL default network programs on your server need to at least have elevated privileges while starting up (or need some sort of port forwarding stuff thats inflexible, awkward and easy to get wrong).

    See below the line.

    This is especially annoying and potentially dangerous when you are actively developing software (like a webserver or a nameserver).

    Right.

    I usually run my system with net.ipv4.ip_unprivileged_port_start=0. This way no more root required to run your DIY webserver or nameserver (or to debug them in the IDE).

    And so, even the least privileged user can run DNS, Mail, Web, FTP, whatever servers. That's not secure.


    Savely starting an unprivileged TCP server on a privileged port (i.e. port < 1024) that entirely runs without root privileges is a solved problem. You need a tiny privileged program that opens the socket, then drops privileges, and finally exec()s the real server that inherits the opened socked filehandle to listen on that handle.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-18 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found