Skip to content

Commit b717091

Browse files
committed
Try to set the SElinux context
1 parent d7b8a2e commit b717091

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ inplace-postinstall-permissions:
278278
setfacl -R -m u:$(DOMJUDGE_USER):rwx $(CURDIR)/webapp/var
279279
setfacl -R -m d:m::rwx $(CURDIR)/webapp/var
280280
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_log_t $(CURDIR)/webapp/var/log; \
284+
chcon -R -t httpd_sys_rw_content_t $(CURDIR)/webapp/var/cache; \
285+
fi
281286

282287
inplace-postinstall-apache: inplace-postinstall-permissions
283288
@if [ ! -d "/etc/apache2/conf-enabled" ]; then echo "Couldn't find directory /etc/apache2/conf-enabled. Is apache installed?"; false; fi
@@ -287,14 +292,15 @@ inplace-postinstall-apache: inplace-postinstall-permissions
287292
systemctl restart apache2
288293

289294
inplace-postinstall-nginx: inplace-postinstall-permissions
290-
@if command -v sestatus >/dev/null 2>&1; then \
291-
chcon -R -t httpd_config_t $(CURDIR); \
292-
fi
293295
@if [ ! -d "/etc/nginx/" ]; then echo "Couldn't find directory /etc/nginx/. Is nginx installed?"; false; fi
294296
@if [ -d "/etc/nginx/sites-enabled/" ]; then \
295297
ln -sf $(CURDIR)/etc/nginx-conf /etc/nginx/sites-enabled/domjudge.conf; \
296298
else \
297299
ln -sf $(CURDIR)/etc/nginx-conf /etc/nginx/conf.d/domjudge.conf; \
300+
if command -v sestatus >/dev/null 2>&1; then \
301+
chcon -t httpd_config_t $(CURDIR)/etc/nginx-conf ; \
302+
chcon -t httpd_config_t $(CURDIR)/etc/nginx-conf-inner ; \
303+
fi; \
298304
fi
299305
systemctl restart nginx
300306
@if [ ! -d "$(debpool)" ] && [ ! -d "$(fedpool)" ]; then \
@@ -306,8 +312,14 @@ inplace-postinstall-nginx: inplace-postinstall-permissions
306312
fi
307313
@if [ -d "$(fedpool)" ]; then \
308314
ln -sf $(CURDIR)/etc/domjudge-fpm.conf $(fedpool)/domjudge-fpm.conf; \
315+
if command -v sestatus >/dev/null 2>&1; then \
316+
chcon -R -t httpd_config_t $(CURDIR)/etc/domjudge-fpm.conf; \
317+
fi; \
309318
systemctl restart php-fpm; \
310319
fi
320+
#@if command -v sestatus >/dev/null 2>&1; then \
321+
# chcon -R -t httpd_config_t $(CURDIR); \
322+
#fi
311323

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

0 commit comments

Comments
 (0)