Web service is an operation system:
- Access Control
- Manage process
- Database connection
Can web server benefit from OS access control?
What UIDs does the server run under?
Difference between
Effective UID
andReal UID
Normally these are the same, but if a program with a set-uid bit set is run, then while the real UID remains that of the user who ran it, the effective UID is that of the user who owns the file.
must have ROOT access
to connect to those portsHAS TO
be root in order for web server to start running.Shedding priviege
: Apache starts web server as root, then forks and sheds privileges (lower privileges).NOT
owned by www
.Web server is an OS
restart
and retry
is crucial for highly reliable systems.Rollback and recovery
: design for system reliability in the very beginning. E.x. to design a phone network, I must make sure that phone switch
is up running, if one phone cuts out, it eliminates the phone, but phone switch
is up on running.underestimate a programmer's ability to get stuff right.
From Wikipedia:
A .htaccess (hypertext access) file is
a directory-level configuration file
supported by several web servers, that allows for decentralized management of web server configuration. They are placed inside the web tree, and are able to override a subset of the server's global configuration for the directory that they are in, and all sub-directories.[1]The original purpose of .htaccess—reflected in its name—was to allow per-directory access control, by for example requiring a password to access the content. Nowadays however, the .htaccess files can override many other configuration settings including content type and character set, CGI handlers, etc.
All the CGI scripts will run as the same user, so they have potential to conflict with other scripts.
Challenge
: if all scripts run with the same permission, and if local users have read-access to user content, how can a user do safe upload?Store in computer x--,---,--- It's owned by root, and reads in at startup before changing UIDs.
passwords
and client-side certificates
.Passwords
should never be used without encrypting the network connection.Use a password manager such as 1password!
very hard
to secure