Packages: run non-privileged processes under "unit" user.
This commit is contained in:
@@ -157,6 +157,8 @@ CONFIGURE_ARGS=\
|
|||||||
--pid=/var/run/unit.pid \
|
--pid=/var/run/unit.pid \
|
||||||
--log=/var/log/unit.log \
|
--log=/var/log/unit.log \
|
||||||
--tmp=/var/tmp \
|
--tmp=/var/tmp \
|
||||||
|
--user=unit \
|
||||||
|
--group=unit \
|
||||||
--tests \
|
--tests \
|
||||||
--openssl
|
--openssl
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_go": {
|
"example_go": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"user": "nobody",
|
|
||||||
"executable": "/tmp/go-app"
|
"executable": "/tmp/go-app"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_perl": {
|
"example_perl": {
|
||||||
"type": "perl",
|
"type": "perl",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 1,
|
"processes": 1,
|
||||||
"working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
|
"working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
|
||||||
"script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
|
"script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_php": {
|
"example_php": {
|
||||||
"type": "php",
|
"type": "php",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"root": "/usr/share/doc/unit-php/examples/phpinfo-app",
|
"root": "/usr/share/doc/unit-php/examples/phpinfo-app",
|
||||||
"index": "index.php"
|
"index": "index.php"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python/examples/python-app",
|
"path": "/usr/share/doc/unit-python/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 2.7",
|
"type": "python 2.7",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python2.7/examples/python-app",
|
"path": "/usr/share/doc/unit-python2.7/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.4",
|
"type": "python 3.4",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python3.4/examples/python-app",
|
"path": "/usr/share/doc/unit-python3.4/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.5",
|
"type": "python 3.5",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python3.5/examples/python-app",
|
"path": "/usr/share/doc/unit-python3.5/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.6",
|
"type": "python 3.6",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python3.6/examples/python-app",
|
"path": "/usr/share/doc/unit-python3.6/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.7",
|
"type": "python 3.7",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python3.7/examples/python-app",
|
"path": "/usr/share/doc/unit-python3.7/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.8",
|
"type": "python 3.8",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python3.8/examples/python-app",
|
"path": "/usr/share/doc/unit-python3.8/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_ruby": {
|
"example_ruby": {
|
||||||
"type": "ruby",
|
"type": "ruby",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"script": "/usr/share/doc/unit-ruby/examples/ruby-app.ru"
|
"script": "/usr/share/doc/unit-ruby/examples/ruby-app.ru"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_php": {
|
"example_php": {
|
||||||
"type": "php",
|
"type": "php",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"root": "/usr/share/doc/unit/examples/php-app",
|
"root": "/usr/share/doc/unit/examples/php-app",
|
||||||
"index": "index.php"
|
"index": "index.php"
|
||||||
@@ -10,7 +9,6 @@
|
|||||||
|
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit/examples/python-app",
|
"path": "/usr/share/doc/unit/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
@@ -18,13 +16,11 @@
|
|||||||
|
|
||||||
"example_go": {
|
"example_go": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"user": "nobody",
|
|
||||||
"executable": "/tmp/go-app"
|
"executable": "/tmp/go-app"
|
||||||
},
|
},
|
||||||
|
|
||||||
"example_perl": {
|
"example_perl": {
|
||||||
"type": "perl",
|
"type": "perl",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 1,
|
"processes": 1,
|
||||||
"working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
|
"working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
|
||||||
"script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
|
"script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
|
||||||
|
|||||||
@@ -6,6 +6,40 @@ if [ "$1" != "configure" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
if dpkg --compare-versions "${2%%-*}" le "1.21.0"; then
|
||||||
|
cat <<BANNER
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
WARNING:
|
||||||
|
|
||||||
|
Since version 1.22.0, Unit's non-privileged processes run as unit:unit by
|
||||||
|
default. Review your system permissions and Unit configuration so apps and
|
||||||
|
routes that relied on these processes running as nobody:nogroup stay working.
|
||||||
|
|
||||||
|
More info: https://unit.nginx.org/installation/#official-packages
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
BANNER
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! getent group unit >/dev/null; then
|
||||||
|
addgroup --system unit >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! getent passwd unit >/dev/null; then
|
||||||
|
adduser \
|
||||||
|
--system \
|
||||||
|
--disabled-login \
|
||||||
|
--ingroup unit \
|
||||||
|
--no-create-home \
|
||||||
|
--home /nonexistent \
|
||||||
|
--gecos "unit user" \
|
||||||
|
--shell /bin/false \
|
||||||
|
unit >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
#DEBHELPER#
|
#DEBHELPER#
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ Online documentation is available at https://unit.nginx.org/
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
BANNER
|
BANNER
|
||||||
;;
|
;;
|
||||||
|
|
||||||
upgrade)
|
upgrade)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ CONFIGURE_ARGS=\
|
|||||||
--pid=/var/run/unit/unit.pid \
|
--pid=/var/run/unit/unit.pid \
|
||||||
--log=/var/log/unit/unit.log \
|
--log=/var/log/unit/unit.log \
|
||||||
--tmp=/var/tmp \
|
--tmp=/var/tmp \
|
||||||
|
--user=unit \
|
||||||
|
--group=unit \
|
||||||
--tests \
|
--tests \
|
||||||
--openssl
|
--openssl
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_go": {
|
"example_go": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"user": "nobody",
|
|
||||||
"executable": "/tmp/go-app"
|
"executable": "/tmp/go-app"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_perl": {
|
"example_perl": {
|
||||||
"type": "perl",
|
"type": "perl",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 1,
|
"processes": 1,
|
||||||
"working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
|
"working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
|
||||||
"script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
|
"script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_php": {
|
"example_php": {
|
||||||
"type": "php",
|
"type": "php",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"root": "/usr/share/doc/unit-php/examples/phpinfo-app",
|
"root": "/usr/share/doc/unit-php/examples/phpinfo-app",
|
||||||
"index": "index.php"
|
"index": "index.php"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python/examples/python-app",
|
"path": "/usr/share/doc/unit-python/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 2.7",
|
"type": "python 2.7",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python27/examples/python-app",
|
"path": "/usr/share/doc/unit-python27/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.4",
|
"type": "python 3.4",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python34/examples/python-app",
|
"path": "/usr/share/doc/unit-python34/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.5",
|
"type": "python 3.5",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python35/examples/python-app",
|
"path": "/usr/share/doc/unit-python35/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.6",
|
"type": "python 3.6",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python36/examples/python-app",
|
"path": "/usr/share/doc/unit-python36/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.7",
|
"type": "python 3.7",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python37/examples/python-app",
|
"path": "/usr/share/doc/unit-python37/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python 3.8",
|
"type": "python 3.8",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python38/examples/python-app",
|
"path": "/usr/share/doc/unit-python38/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_ruby": {
|
"example_ruby": {
|
||||||
"type": "ruby",
|
"type": "ruby",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"script": "/usr/share/doc/unit-ruby/examples/ruby-app.ru"
|
"script": "/usr/share/doc/unit-ruby/examples/ruby-app.ru"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"example_php": {
|
"example_php": {
|
||||||
"type": "php",
|
"type": "php",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"root": "/usr/share/doc/unit-php/examples/phpinfo-app",
|
"root": "/usr/share/doc/unit-php/examples/phpinfo-app",
|
||||||
"index": "index.php"
|
"index": "index.php"
|
||||||
@@ -10,7 +9,6 @@
|
|||||||
|
|
||||||
"example_python": {
|
"example_python": {
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 2,
|
"processes": 2,
|
||||||
"path": "/usr/share/doc/unit-python/examples/python-app",
|
"path": "/usr/share/doc/unit-python/examples/python-app",
|
||||||
"module": "wsgi"
|
"module": "wsgi"
|
||||||
@@ -18,13 +16,11 @@
|
|||||||
|
|
||||||
"example_go": {
|
"example_go": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"user": "nobody",
|
|
||||||
"executable": "/tmp/go-app"
|
"executable": "/tmp/go-app"
|
||||||
},
|
},
|
||||||
|
|
||||||
"example_perl": {
|
"example_perl": {
|
||||||
"type": "perl",
|
"type": "perl",
|
||||||
"user": "nobody",
|
|
||||||
"processes": 1,
|
"processes": 1,
|
||||||
"working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
|
"working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
|
||||||
"script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
|
"script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ cat /dev/null > debugsourcefiles.list
|
|||||||
|
|
||||||
%post
|
%post
|
||||||
if [ $1 -eq 1 ]; then
|
if [ $1 -eq 1 ]; then
|
||||||
|
getent group unit >/dev/null || groupadd -r unit
|
||||||
|
getent passwd unit >/dev/null || \
|
||||||
|
useradd -r -g unit -s /sbin/nologin \
|
||||||
|
-d /nonexistent -c "unit user" unit
|
||||||
/usr/bin/systemctl preset unit.service >/dev/null 2>&1 ||:
|
/usr/bin/systemctl preset unit.service >/dev/null 2>&1 ||:
|
||||||
cat <<BANNER
|
cat <<BANNER
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
@@ -172,6 +176,21 @@ if [ $1 -ge 1 ]; then
|
|||||||
/usr/bin/systemctl try-restart unit.service >/dev/null 2>&1 ||:
|
/usr/bin/systemctl try-restart unit.service >/dev/null 2>&1 ||:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
%triggerpostun -- unit < 1.22.0
|
||||||
|
cat <<BANNER
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
WARNING:
|
||||||
|
|
||||||
|
Since version 1.22.0, Unit's non-privileged processes run as unit:unit by
|
||||||
|
default. Review your system permissions and Unit configuration so apps and
|
||||||
|
routes that relied on these processes running as nobody:nogroup stay working.
|
||||||
|
|
||||||
|
More info: https://unit.nginx.org/installation/#official-packages
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
BANNER
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%attr(0755,root,root) %{_sbindir}/unitd
|
%attr(0755,root,root) %{_sbindir}/unitd
|
||||||
|
|||||||
Reference in New Issue
Block a user