Skip to content

Commit 540a41e

Browse files
committed
Set maintainer-install configuration & permissions for fedora installations
This is only for the domserver installation. The full configuration for the judgedaemon is left for the future. It would need: - Installation of the needed files (sudoers for example) - Setting up a SELinux domain; - the judgedaemon interacts with proc which is normally blocked, - the judgedaemon creates and reads and chowns some files after judgement.
1 parent 746c9d0 commit 540a41e

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

Makefile

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ REC_TARGETS=build domserver install-domserver judgehost install-judgehost \
1111
# Global Makefile definitions
1212
include $(TOPDIR)/Makefile.global
1313

14+
debpool := /etc/php/$(PHPVERSION)/fpm/pool.d
15+
fedpool := /etc/php-fpm.d
16+
1417
default:
1518
@echo "No default target"
1619
@echo
@@ -275,6 +278,14 @@ inplace-postinstall-permissions:
275278
setfacl -R -m u:$(DOMJUDGE_USER):rwx $(CURDIR)/webapp/var
276279
setfacl -R -m d:m::rwx $(CURDIR)/webapp/var
277280
setfacl -R -m m::rwx $(CURDIR)/webapp/var
281+
if command -v sestatus >/dev/null 2>&1; then \
282+
chcon -R -t httpd_sys_content_t $(CURDIR)/webapp; \
283+
chcon -R -t httpd_config_t $(CURDIR)/etc; \
284+
chcon -R -t httpd_log_t $(CURDIR)/webapp/var/log; \
285+
chcon -R -t httpd_sys_rw_content_t $(CURDIR)/webapp/var/cache; \
286+
chcon -R -t httpd_sys_rw_content_t $(CURDIR)/webapp/public/images; \
287+
chcon -t httpd_exec_t $(CURDIR)/lib/alert; \
288+
fi
278289

279290
inplace-postinstall-apache: inplace-postinstall-permissions
280291
@if [ ! -d "/etc/apache2/conf-enabled" ]; then echo "Couldn't find directory /etc/apache2/conf-enabled. Is apache installed?"; false; fi
@@ -284,12 +295,23 @@ inplace-postinstall-apache: inplace-postinstall-permissions
284295
systemctl restart apache2
285296

286297
inplace-postinstall-nginx: inplace-postinstall-permissions
287-
@if [ ! -d "/etc/nginx/sites-enabled/" ]; then echo "Couldn't find directory /etc/nginx/sites-enabled/. Is nginx installed?"; false; fi
288-
@if [ ! -d "/etc/php/$(PHPVERSION)/fpm/pool.d/" ]; then echo "Couldn't find directory /etc/php/$(PHPVERSION)/fpm/pool.d/. Is php-fpm installed?"; false; fi
289-
ln -sf $(CURDIR)/etc/nginx-conf /etc/nginx/sites-enabled/domjudge.conf
290-
ln -sf $(CURDIR)/etc/domjudge-fpm.conf /etc/php/$(PHPVERSION)/fpm/pool.d/domjudge-fpm.conf
298+
@if [ ! -d "/etc/nginx/" ]; then echo "Couldn't find directory /etc/nginx/. Is nginx installed?"; false; fi
299+
@cmd="ln -sf $(CURDIR)/etc/nginx-conf /etc/nginx/conf.d/domjudge.conf"; \
300+
if [ -d "/etc/nginx/sites-enabled/" ]; then \
301+
cmd="ln -sf $(CURDIR)/etc/nginx-conf /etc/nginx/sites-enabled/domjudge.conf"; \
302+
fi; echo $$cmd; $$cmd
291303
systemctl restart nginx
292-
systemctl restart php$(PHPVERSION)-fpm
304+
@if [ ! -d "$(debpool)" ] && [ ! -d "$(fedpool)" ]; then \
305+
echo "Couldn't find directory $(debpool) or $(fedpool). Is php-fpm installed?"; false; \
306+
fi
307+
@service="php-fpm"; phppool="$(fedpool)"; \
308+
if [ -d "$(debpool)" ]; then \
309+
phppool="ln -sf $(CURDIR)/etc/domjudge-fpm.conf $(debpool)/domjudge-fpm.conf"; \
310+
service="php$(PHPVERSION)-fpm"; \
311+
fi; \
312+
service="systemctl restart $$service"; \
313+
ln="ln -sf $(CURDIR)/etc/domjudge-fpm.conf $$phppool/domjudge-fpm.conf"; \
314+
echo $$ln; echo $$service; $$ln; $$service
293315

294316
# Removes created symlinks; generated logs, submissions, etc. remain in output subdir.
295317
inplace-uninstall-l:

0 commit comments

Comments
 (0)