Run CGI scripts with the permissions of their owner.
suCGI checks whether a CGI script is owned by a regular user, sets the real
and the effective UID, the real and the effective GID, and the supplementary
groups of the current process to the UID, the GID, and the supplementary
groups of that user, cleans up the environment, and then runs the script.
suCGI should work on any system that is compatible with `4.4BSD`_ and
compliant with `POSIX.1-2008`_, including the X/Open System Interface
extension; any Unix-like system that has been released recently-ish
and that does *not* target embedded systems should do.
**Do NOT use suCGI at this point!**
suCGI is work in progess and has *not* been reviewed, let alone audited.
Download the repository and unpack it.
Please take the time to read and evaluate the source code.
You may need to install:
* A C99 compiler (GCC_ and Clang_ are known to work)
* The header files of your system's standard library
* An assembler and a linker; these are usually packaged as "binary utilities"
(`GNU Binutils`_ and FreeBSD's binary utilities are known to work)
* Make (`GNU Make`_, FreeBSD's Make, and bmake_ are known to work)
* M4 (`GNU M4`_ and FreeBSD's M4 are known to work)
On many systems you can do so by::
``./prepare`` uses the package manager of your operating system, if possible.
Generate the *makefile*, *compat.h*, and *config.h* by::
See `docs/build.rst`_ for details.
suCGI is configured at compile-time. Adapt *config.h* to your needs.
Compile suCGI by::
Install suCGI by::
sudo make install
``sudo make install`` will do nothing if suCGI has already been
installed and the installed binary was created or modified more
recently than the binary that has just been built.
You can uninstall suCGI by ``sudo make uninstall``.
If you are are using Apache_ and want to enable users to run their PHP_
scripts under their own user and group IDs, you can do so by following
Add the following lines to your Apache configuration::
Action application/x-httpd-php /cgi-bin/sucgi
The directory should correspond to *USER_DIR* in *config.h*.
apache2ctl -t && apache2ctl restart
See the source code for more details.
If there's something wrong with suCGI, please
`open an issue `_.
Copyright 2022 and 2023 Odin Kroeger
suCGI is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
suCGI is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with suCGI. If not, see .
.. _4.4BSD: https://docs-legacy.freebsd.org/44doc/
.. _Apache: https://httpd.apache.org/
.. _bmake: https://www.crufty.net/help/sjg/bmake.html
.. _Clang: https://clang.llvm.org/
.. _`docs/build.rst`: docs/build.rst
.. _GCC: https://gcc.gnu.org/
.. _`GNU Binutils`: https://www.gnu.org/software/binutils/
.. _`GNU M4`: https://www.gnu.org/software/m4/
.. _`GNU Make`: https://www.gnu.org/software/make/
.. _mod_action: https://httpd.apache.org/docs/2.4/mod/mod_actions.html
.. _mod_userdir: https://httpd.apache.org/docs/2.4/mod/mod_userdir.html
.. _PHP: https://www.php.net/
.. _`POSIX.1-2008`: https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/
.. |codacy| image:: https://app.codacy.com/project/badge/Grade/cb67a3bad615449589dfb242876600ac
.. |coverage| image:: https://sonarcloud.io/api/project_badges/measure?project=odkr_sucgi&metric=coverage
.. |security| image:: https://sonarcloud.io/api/project_badges/measure?project=odkr_sucgi&metric=security_rating
.. |reliability| image:: https://sonarcloud.io/api/project_badges/measure?project=odkr_sucgi&metric=reliability_rating
.. |maintainability| image:: https://sonarcloud.io/api/project_badges/measure?project=odkr_sucgi&metric=sqale_rating