lighttpd: Adding /var/log/lighttpd folder with the owner www-data The lighttpd need to write in his root log folder
PATCH 1/1 lighttpd: Adding /var/log/lighttpd folder with the owner www-data The lighttpd need to write in his root log folder
From: Laurent Hartanerot <[email protected]>
Lighttpd don't start with the default buildroot configuration
/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
2018-06-22 11:21:34: (server.c.733) opening errorlog '/var/log/lighttpd-error.log' failed: Permission denied 2018-06-22 11:21:34: (server.c.1420) Opening errorlog failed. Going down.
--- package/lighttpd/0001-Fix-default-config-file.patch | 6 ++---- package/lighttpd/lighttpd.mk | 5 +++++ 2 files changed, 7 insertions(+), 4 deletions(-)
package/lighttpd/0001-Fix-default-config-file.patch +2 -4
@@ -1,6 +1,5 @@ Modify the default lighttpd configuration file to have one a starting conf - * Changed the log path to /var/log and logs filenames * Disable IPv6 * Do not setuid to a user that doesn't exist on the system * Disable pdf ranges fix for Adobe Reader since it uses regex and we
@@ -27,13 +26,12 @@ diff -Nura lighttpd-1.4.37.orig/doc/config/conf.d/access_log.conf lighttpd-1.4.3 diff -Nura lighttpd-1.4.37.orig/doc/config/lighttpd.conf lighttpd-1.4.37/doc/config/lighttpd.conf --- lighttpd-1.4.37.orig/doc/config/lighttpd.conf 2015-09-01 14:38:48.684673663 -0300 +++ lighttpd-1.4.37/doc/config/lighttpd.conf 2015-09-01 14:39:40.256442492 -0300 -@@ -13,8 +13,8 @@ +@@ -14,8 +14,8 @@ ## if you add a variable here. Add the corresponding variable in the ## chroot example aswell. ## --var.log_root = "/var/log/lighttpd" + var.log_root = "/var/log/lighttpd" -var.server_root = "/srv/www" -+var.log_root = "/var/log" +var.server_root = "/var/www" var.state_dir = "/var/run" var.home_dir = "/var/lib/lighttpd"
package/lighttpd/lighttpd.mk +5 -0
@@ -67,6 +67,7 @@ endif define LIGHTTPD_INSTALL_CONFIG $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/lighttpd/conf.d $(INSTALL) -d -m 0755 $(TARGET_DIR)/var/www + $(INSTALL) -d -m 0755 $(TARGET_DIR)/var/log/lighttpd $(INSTALL) -D -m 0644 $(@D)/doc/config/lighttpd.conf \ $(TARGET_DIR)/etc/lighttpd/lighttpd.conf $(INSTALL) -D -m 0644 $(@D)/doc/config/modules.conf \
@@ -98,4 +99,8 @@ define LIGHTTPD_INSTALL_INIT_SYSTEMD $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/lighttpd.service endef +define LIGHTTPD_PERMISSIONS + /var/log/lighttpd d 755 33 33 - - - - - +endef + $(eval $(autotools-package))
--
2.11.0
PATCH 1/1 lighttpd: Adding /var/log/lighttpd folder with the owner www-data The lighttpd need to write in his root log folder
Quoted 7 lines · Laurent Hartanerot
From: Laurent Hartanerot <[email protected]>
Lighttpd don't start with the default buildroot configuration
/usr/sbin/lighttpd-D -f/etc/lighttpd/lighttpd.conf2018-06-22 11:21:34: (server.c.733) opening errorlog '/var/log/lighttpd-error.log' failed: Permission denied 2018-06-22 11:21:34: (server.c.1420) Opening errorlog failed. Going down.
This doesn't sound right. In the default skeleton, /var/log is a symlink to
/tmp and /tmp is world-writable. If you use a custom skeleton, it's your responsibility to make sure that it contains everything you need.
Quoted 40 lines
Signed-off-by Laurent Hartanerot <[email protected]>--- package/lighttpd/0001-Fix-default-config-file.patch | 6 ++---- package/lighttpd/lighttpd.mk | 5 +++++ 2 files changed, 7 insertions(+), 4 deletions(-)package/lighttpd/0001-Fix-default-config-file.patch +2
-4@@ -1,6 +1,5 @@ Modify the default lighttpd configuration file to have one a starting conf - * Changed the log path to /var/log and logs filenames * Disable IPv6 * Do not setuid to a user that doesn't exist on the system * Disable pdf ranges fix for Adobe Reader since it uses regex and we@@ -27,13 +26,12 @@ diff -Nura lighttpd-1.4.37.orig/doc/config/conf.d/access_log.conf lighttpd-1.4.3 diff -Nura lighttpd-1.4.37.orig/doc/config/lighttpd.conf lighttpd-1.4.37/doc/config/lighttpd.conf --- lighttpd-1.4.37.orig/doc/config/lighttpd.conf 2015-09-01 14:38:48.684673663 -0300 +++ lighttpd-1.4.37/doc/config/lighttpd.conf 2015-09-01 14:39:40.256442492 -0300 -@@ -13,8 +13,8 @@ +@@ -14,8 +14,8 @@ ## if you add a variable here. Add the corresponding variable in the ## chroot example aswell. ## --var.log_root = "/var/log/lighttpd" + var.log_root = "/var/log/lighttpd" -var.server_root = "/srv/www" -+var.log_root = "/var/log" +var.server_root = "/var/www" var.state_dir = "/var/run" var.home_dir = "/var/lib/lighttpd"package/lighttpd/lighttpd.mk +0
-0
package/lighttpd/lighttpd.mk endif · line 70
Quoted 4 lines
package/lighttpd/lighttpd.mk +1
-0@@ -67,6 +67,7 @@ endif define LIGHTTPD_INSTALL_CONFIG $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/lighttpd/conf.d $(INSTALL) -d -m 0755 $(TARGET_DIR)/var/www + $(INSTALL) -d -m 0755 $(TARGET_DIR)/var/log/lighttpd
This doesn't work with the default skeleton, because it will create the
directory but at runtime it will be overridden by a tmpfs.
Hm, I realize now that I don't really know what happens in the systemd case. It
might be necessary to add a /etc/tmpfiles.d config for systemd. But that should then be part of the LIGHTTPD_INSTALL_INIT_SYSTEMD commands.
Regards,
Arnout
Quoted 19 lines
package/lighttpd/lighttpd.mk +4
-1$(INSTALL) -D -m 0644 $(@D)/doc/config/lighttpd.conf \ $(TARGET_DIR)/etc/lighttpd/lighttpd.conf $(INSTALL) -D -m 0644 $(@D)/doc/config/modules.conf \@@ -98,4 +99,8 @@ define LIGHTTPD_INSTALL_INIT_SYSTEMD $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/lighttpd.service endef +define LIGHTTPD_PERMISSIONS + /var/log/lighttpd d 755 33 33 - - - - - +endef + $(eval $(autotools-package)) --2.11.0
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 lighttpd: Add systemd tmpfile to fix lighttpd systemd boot
In reply to Laurent HartanerotFrom: Laurent Hartanerot <[email protected]>
Problem starting lighttpd application with systemd.
/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
2018-06-22 11:21:34: (server.c.733) opening errorlog '/var/log/lighttpd-error.log' failed: Permission denied 2018-06-22 11:21:34: (server.c.1420) Opening errorlog failed. Going down.
Lighttpd can not write the 'lighttpd-access.log' and 'lighttpd-error.log' files to the directory '/var/log/'.
When using systemd the directory '/var/log' does not allow the user www-data to write.
To correct the problem, we add /usr/lib/tmpfiles.d/lighttpd.conf. This file create the 'lighttpd-access.log' and 'lighttpd-error.log' files with the permission
--- package/lighttpd/lighttpd.mk | 3 +++ package/lighttpd/lighttpd_tmpfiles.conf | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 package/lighttpd/lighttpd_tmpfiles.conf
package/lighttpd/lighttpd.mk +3 -0
@@ -96,6 +96,9 @@ define LIGHTTPD_INSTALL_INIT_SYSTEMD ln -fs ../../../../usr/lib/systemd/system/lighttpd.service \ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/lighttpd.service + + $(INSTALL) -D -m 644 package/lighttpd/lighttpd_tmpfiles.conf \ + $(TARGET_DIR)/usr/lib/tmpfiles.d/lighttpd.conf endef $(eval $(autotools-package))
package/lighttpd/lighttpd_tmpfiles.conf new file +2 -0
@@ -0,0 +1,2 @@ +f /var/log/lighttpd-access.log 0640 www-data www-data - +f /var/log/lighttpd-error.log 0640 www-data www-data -
--
2.11.0
Thomas Petazzoni
AppliedPATCH v2 1/1 lighttpd: Add systemd tmpfile to fix lighttpd systemd boot
Hello,
Quoted 19 lines · Laurent Hartanerot
From: Laurent Hartanerot <[email protected]>
Problem starting lighttpd application with systemd.
/usr/sbin/lighttpd-D -f/etc/lighttpd/lighttpd.conf2018-06-22 11:21:34: (server.c.733) opening errorlog '/var/log/lighttpd-error.log' failed: Permission denied 2018-06-22 11:21:34: (server.c.1420) Opening errorlog failed. Going down.Lighttpd can not write the 'lighttpd-access.log' and 'lighttpd-error.log' files to the directory '
/var/log/'.When using systemd the directory '
/var/log' does not allow the user www-data to write.To correct the problem, we add
/usr/lib/tmpfiles.d/lighttpd.conf. This file create the 'lighttpd-access.log' and 'lighttpd-error.log' files with the permission
Quoted 6 lines
Signed-off-by Laurent Hartanerot <[email protected]>--- package/lighttpd/lighttpd.mk | 3 +++ package/lighttpd/lighttpd_tmpfiles.conf | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 package/lighttpd/lighttpd_tmpfiles.conf
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/1 lighttpd: Add systemd tmpfile to fix lighttpd systemd boot
In reply to Laurent HartanerotQuoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Laurent" == Laurent Hartanerot <[email protected]> writes:
From: Laurent Hartanerot <[email protected]> Problem starting lighttpd application with systemd.
/usr/sbin/lighttpd-D -f/etc/lighttpd/lighttpd.conf2018-06-22 11:21:34: (server.c.733) opening errorlog '/var/log/lighttpd-error.log' failed: Permission denied 2018-06-22 11:21:34: (server.c.1420) Opening errorlog failed. Going down.Lighttpd can not write the 'lighttpd-access.log' and 'lighttpd-error.log' files to the directory '
/var/log/'.When using systemd the directory '
/var/log' does not allow the user www-data to write.
Quoted 6 lines
To correct the problem, we add
/usr/lib/tmpfiles.d/lighttpd.conf. This file create the 'lighttpd-access.log' and 'lighttpd-error.log' files with the permissionSigned-off-by Laurent Hartanerot <[email protected]>
Committed to 2018.02.x and 2018.05.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard