Web application package guidelines

From ArchWiki
Revision as of 07:31, 21 April 2019 by Lahwaacz.bot (talk | contribs) (simplification and beautification of wikilinks (interactive))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The file system layout is insufficient for more than one instance of a webapp. (Discuss in Talk:Web application package guidelines#)
Package creation guidelines

32-bitCLRCrossEclipseElectronFree PascalGNOMEGoHaskellJavaKDEKernelLispMinGWNode.jsNonfreeOCamlPerlPHPPythonRRubyRustVCSWebWine

This page describes how to package web applications.

Separate user

For security reasons, every web application should be run as a separate (unprivileged) user (i.e. $pkgname).

Note: Traditionally, many web applications were run as the http user/group, which can be considered unsafe, as in such a scenario applications can read each other's files.

Refer to the systemd-sysusers(8), sysusers.d(5), systemd-tmpfiles(8) and tmpfiles.d(5) man pages for details on how to create users and deal with ownership of files and folders for that user in a package.

Directory structure

The layout follows the FHS.

  • /usr/share/webapps/$pkgname: The application's data directory holds the files of the web application. Files are owned by root and are therefore readonly to the application user and group $pkgname.
  • /etc/webapps/$pkgname: The configuration directory of the application holds configuration files for the application (symlinked to the data directory). Files located here have to go to the backup array and are owned by the user and group $pkgname.
Warning: Files potentially containing authentication information must be protected (i.e. not readable by any other user or group on the system, except root and $pkgname)!
  • /run/$pkgname: The runtime directory of the application (owned by the user and group $pkgname). It can be used for sockets (e.g. in setups facilitating socket activation).
Note: According to the package guidelines on directories, /run must not be contained in a package. Use tmpfiles to add the directory with matching permissions.
  • /var/cache/$pkgname: The cache directory of the application (owned by the user and group $pkgname). It (or subfolders in it) is symlinked to the data directory for applications requiring writable cache directories.
  • /var/lib/$pkgname: The persistent storage of the application (owned by the user and group $pkgname). It (or subfolders in it) is symlinked to the data directory for applications requiring persistent storage directories.