From 8e1a2d4e05277827d68c843ad073489a22425636 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Tue, 12 Nov 2019 07:41:08 +0100 Subject: mkosi.exstra seems like a better solution than mkosi.skeleton --- .../etc/apache2/mods-available/mpm_prefork.conf | 16 +++++ mkosi.extra/etc/apache2/ports.conf | 4 ++ .../etc/apache2/sites-available/davical.conf | 70 ++++++++++++++++++++++ mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades | 9 +++ .../etc/apt/apt.conf.d/50unattended-upgrades | 34 +++++++++++ mkosi.postinst | 4 -- mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades | 9 --- .../etc/apt/apt.conf.d/50unattended-upgrades | 34 ----------- mkosi.skeleton/root/apache2.davical.conf | 70 ---------------------- mkosi.skeleton/root/apache2.mpm_prefork.conf | 16 ----- mkosi.skeleton/root/apache2.ports.conf | 4 -- 11 files changed, 133 insertions(+), 137 deletions(-) create mode 100644 mkosi.extra/etc/apache2/mods-available/mpm_prefork.conf create mode 100644 mkosi.extra/etc/apache2/ports.conf create mode 100644 mkosi.extra/etc/apache2/sites-available/davical.conf create mode 100644 mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades create mode 100644 mkosi.extra/etc/apt/apt.conf.d/50unattended-upgrades delete mode 100644 mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades delete mode 100644 mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades delete mode 100644 mkosi.skeleton/root/apache2.davical.conf delete mode 100644 mkosi.skeleton/root/apache2.mpm_prefork.conf delete mode 100644 mkosi.skeleton/root/apache2.ports.conf diff --git a/mkosi.extra/etc/apache2/mods-available/mpm_prefork.conf b/mkosi.extra/etc/apache2/mods-available/mpm_prefork.conf new file mode 100644 index 0000000..73ceafc --- /dev/null +++ b/mkosi.extra/etc/apache2/mods-available/mpm_prefork.conf @@ -0,0 +1,16 @@ +# prefork MPM +# StartServers: number of server processes to start +# MinSpareServers: minimum number of server processes which are kept spare +# MaxSpareServers: maximum number of server processes which are kept spare +# MaxRequestWorkers: maximum number of server processes allowed to start +# MaxConnectionsPerChild: maximum number of requests a server process serves + + + StartServers 1 + MinSpareServers 1 + MaxSpareServers 10 + MaxRequestWorkers 75 + MaxConnectionsPerChild 0 + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/mkosi.extra/etc/apache2/ports.conf b/mkosi.extra/etc/apache2/ports.conf new file mode 100644 index 0000000..1ec7806 --- /dev/null +++ b/mkosi.extra/etc/apache2/ports.conf @@ -0,0 +1,4 @@ +Listen 127.0.0.1:8301 +Listen [::1]:8301 + +# vim: syntax=apache ts=4 sw=4 sr noet diff --git a/mkosi.extra/etc/apache2/sites-available/davical.conf b/mkosi.extra/etc/apache2/sites-available/davical.conf new file mode 100644 index 0000000..c7f4b62 --- /dev/null +++ b/mkosi.extra/etc/apache2/sites-available/davical.conf @@ -0,0 +1,70 @@ + + + ServerName #APACHE_SERVER_NAME + UseCanonicalName on + + DocumentRoot /usr/share/davical/htdocs + DirectoryIndex index.php index.html + + # To cirkumvent phps $_SERVER['HTTPS']-check + SetEnv HTTPS "on" + + AcceptPathInfo On + + # For some weird reason, apache2 doesn't set this automatically + SetEnv AUTH_TYPE Basic + + # Trust the remote user forwarded by nginx + SetEnvIf X-Forwarded-User (.*) REMOTE_USER=$1 + + + DirectoryIndex index.php + AllowOverride None + # for Apache from 2.4 use + Require all granted + # for Apache before 2.4 use + #Order allow,deny + #Allow from all + + # These are usually not necessary (set correctly by default) + #AcceptPathInfo On + #php_value include_path /usr/share/php/awl/inc + #php_value magic_quotes_gpc 0 + #php_value register_globals 0 + #php_value error_reporting "E_ALL & ~E_NOTICE" + #php_value default_charset "utf-8" + + # Some people want this. YMMV. + #php_admin_value open_basedir /usr/share/awl/inc/:/usr/share/davical/:/etc/davical/ + + + + RewriteEngine On + + # PT is important if you are using an alias, it implies L + # Redirect /.well-known URLs + RewriteRule ^/\.well-known/(.*)$ /caldav.php/.well-known/$1 [NC,PT] + # Optionally: redirect /principals/users/ as well + RewriteRule ^/principals/users/(.*)$ /caldav.php/$1 [NC,PT] + RewriteRule ^/principals/resources/(.*)$ /caldav.php/$1 [NC,PT] + RewriteRule ^/calendars/__uids__/(.*)$ /caldav.php/$1 [NC,PT] + RewriteRule ^/addressbooks/__uids__/(.*)$ /caldav.php/$1 [NC,PT] + + # Optionally: Put DAViCal in the root + # NOTE: this will break other applications that rely on mod_rewrite! + # + # Not if it's the root URL. You might want to comment this out if you + # want to use an explicit /index.php for getting to the admin pages. + #RewriteCond %{REQUEST_URI} !^/$ + #RewriteCond %{REQUEST_URI} !^/davical/$ + # + # Not if it explicitly specifies a .php program, html page, stylesheet or image + #RewriteCond %{REQUEST_URI} !\.(php|html|css|js|png|gif|jpg|ico) + # + # Everything else gets rewritten to /caldav.php/... + #RewriteRule ^(.*)$ /davical/caldav.php$1 [NC,L] + + + + + diff --git a/mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades b/mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades new file mode 100644 index 0000000..4c725ab --- /dev/null +++ b/mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades @@ -0,0 +1,9 @@ +APT::Periodic::Unattended-Upgrade "1"; + +APT::Periodic::Update-Package-Lists "1"; + + +APT::Periodic::AutocleanInterval "7"; + + + diff --git a/mkosi.extra/etc/apt/apt.conf.d/50unattended-upgrades b/mkosi.extra/etc/apt/apt.conf.d/50unattended-upgrades new file mode 100644 index 0000000..768347b --- /dev/null +++ b/mkosi.extra/etc/apt/apt.conf.d/50unattended-upgrades @@ -0,0 +1,34 @@ +// Unattended-Upgrade::Origins-Pattern controls which packages are +// upgraded. +Unattended-Upgrade::Origins-Pattern { + "origin=Ubuntu,archive=${distro_codename}-security"; + "o=Ubuntu,a=${distro_codename}"; + "o=Ubuntu,a=${distro_codename}-updates"; + "o=Ubuntu,a=${distro_codename}-proposed-updates"; + "o=Ubuntu,n=${distro_codename}-backports"; + }; + +// List of packages to not update (regexp are supported) +Unattended-Upgrade::Package-Blacklist { +}; + + +// Split the upgrade into the smallest possible chunks so that +// they can be interrupted with SIGUSR1. This makes the upgrade +// a bit slower but it has the benefit that shutdown while a upgrade +// is running is possible (with a small delay) +Unattended-Upgrade::MinimalSteps "true"; + + +// Do automatic removal of new unused dependencies after the upgrade +// (equivalent to apt-get autoremove) +Unattended-Upgrade::Remove-Unused-Dependencies "true"; + + +// Do upgrade application even if it requires restart after upgrade +// I.e. "XB-Upgrade-Requires: app-restart" is set in the debian/control file +Unattended-Upgrade::IgnoreAppsRequireRestart "true"; + +// Automatically run "dpkg --force-confold --configure -a". +Unattended-Upgrade::AutoFixInterruptedDpkg "true"; + diff --git a/mkosi.postinst b/mkosi.postinst index f58ef41..ba3c4c2 100755 --- a/mkosi.postinst +++ b/mkosi.postinst @@ -26,10 +26,6 @@ locale-gen #unxz davical.tar.xz #tar xf davical.tar -mv /root/apache2.ports.conf /etc/apache2/ports.conf -mv /root/apache2.davical.conf /etc/apache2/sites-available/davical.conf -mv /root/apache2.mpm_prefork.conf /etc/apache2/mods-available/mpm_prefork.conf - a2dissite 000-default.conf a2enmod rewrite a2ensite davical.conf diff --git a/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades b/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades deleted file mode 100644 index 4c725ab..0000000 --- a/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades +++ /dev/null @@ -1,9 +0,0 @@ -APT::Periodic::Unattended-Upgrade "1"; - -APT::Periodic::Update-Package-Lists "1"; - - -APT::Periodic::AutocleanInterval "7"; - - - diff --git a/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades b/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades deleted file mode 100644 index 768347b..0000000 --- a/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades +++ /dev/null @@ -1,34 +0,0 @@ -// Unattended-Upgrade::Origins-Pattern controls which packages are -// upgraded. -Unattended-Upgrade::Origins-Pattern { - "origin=Ubuntu,archive=${distro_codename}-security"; - "o=Ubuntu,a=${distro_codename}"; - "o=Ubuntu,a=${distro_codename}-updates"; - "o=Ubuntu,a=${distro_codename}-proposed-updates"; - "o=Ubuntu,n=${distro_codename}-backports"; - }; - -// List of packages to not update (regexp are supported) -Unattended-Upgrade::Package-Blacklist { -}; - - -// Split the upgrade into the smallest possible chunks so that -// they can be interrupted with SIGUSR1. This makes the upgrade -// a bit slower but it has the benefit that shutdown while a upgrade -// is running is possible (with a small delay) -Unattended-Upgrade::MinimalSteps "true"; - - -// Do automatic removal of new unused dependencies after the upgrade -// (equivalent to apt-get autoremove) -Unattended-Upgrade::Remove-Unused-Dependencies "true"; - - -// Do upgrade application even if it requires restart after upgrade -// I.e. "XB-Upgrade-Requires: app-restart" is set in the debian/control file -Unattended-Upgrade::IgnoreAppsRequireRestart "true"; - -// Automatically run "dpkg --force-confold --configure -a". -Unattended-Upgrade::AutoFixInterruptedDpkg "true"; - diff --git a/mkosi.skeleton/root/apache2.davical.conf b/mkosi.skeleton/root/apache2.davical.conf deleted file mode 100644 index c7f4b62..0000000 --- a/mkosi.skeleton/root/apache2.davical.conf +++ /dev/null @@ -1,70 +0,0 @@ - - - ServerName #APACHE_SERVER_NAME - UseCanonicalName on - - DocumentRoot /usr/share/davical/htdocs - DirectoryIndex index.php index.html - - # To cirkumvent phps $_SERVER['HTTPS']-check - SetEnv HTTPS "on" - - AcceptPathInfo On - - # For some weird reason, apache2 doesn't set this automatically - SetEnv AUTH_TYPE Basic - - # Trust the remote user forwarded by nginx - SetEnvIf X-Forwarded-User (.*) REMOTE_USER=$1 - - - DirectoryIndex index.php - AllowOverride None - # for Apache from 2.4 use - Require all granted - # for Apache before 2.4 use - #Order allow,deny - #Allow from all - - # These are usually not necessary (set correctly by default) - #AcceptPathInfo On - #php_value include_path /usr/share/php/awl/inc - #php_value magic_quotes_gpc 0 - #php_value register_globals 0 - #php_value error_reporting "E_ALL & ~E_NOTICE" - #php_value default_charset "utf-8" - - # Some people want this. YMMV. - #php_admin_value open_basedir /usr/share/awl/inc/:/usr/share/davical/:/etc/davical/ - - - - RewriteEngine On - - # PT is important if you are using an alias, it implies L - # Redirect /.well-known URLs - RewriteRule ^/\.well-known/(.*)$ /caldav.php/.well-known/$1 [NC,PT] - # Optionally: redirect /principals/users/ as well - RewriteRule ^/principals/users/(.*)$ /caldav.php/$1 [NC,PT] - RewriteRule ^/principals/resources/(.*)$ /caldav.php/$1 [NC,PT] - RewriteRule ^/calendars/__uids__/(.*)$ /caldav.php/$1 [NC,PT] - RewriteRule ^/addressbooks/__uids__/(.*)$ /caldav.php/$1 [NC,PT] - - # Optionally: Put DAViCal in the root - # NOTE: this will break other applications that rely on mod_rewrite! - # - # Not if it's the root URL. You might want to comment this out if you - # want to use an explicit /index.php for getting to the admin pages. - #RewriteCond %{REQUEST_URI} !^/$ - #RewriteCond %{REQUEST_URI} !^/davical/$ - # - # Not if it explicitly specifies a .php program, html page, stylesheet or image - #RewriteCond %{REQUEST_URI} !\.(php|html|css|js|png|gif|jpg|ico) - # - # Everything else gets rewritten to /caldav.php/... - #RewriteRule ^(.*)$ /davical/caldav.php$1 [NC,L] - - - - - diff --git a/mkosi.skeleton/root/apache2.mpm_prefork.conf b/mkosi.skeleton/root/apache2.mpm_prefork.conf deleted file mode 100644 index 73ceafc..0000000 --- a/mkosi.skeleton/root/apache2.mpm_prefork.conf +++ /dev/null @@ -1,16 +0,0 @@ -# prefork MPM -# StartServers: number of server processes to start -# MinSpareServers: minimum number of server processes which are kept spare -# MaxSpareServers: maximum number of server processes which are kept spare -# MaxRequestWorkers: maximum number of server processes allowed to start -# MaxConnectionsPerChild: maximum number of requests a server process serves - - - StartServers 1 - MinSpareServers 1 - MaxSpareServers 10 - MaxRequestWorkers 75 - MaxConnectionsPerChild 0 - - -# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/mkosi.skeleton/root/apache2.ports.conf b/mkosi.skeleton/root/apache2.ports.conf deleted file mode 100644 index 1ec7806..0000000 --- a/mkosi.skeleton/root/apache2.ports.conf +++ /dev/null @@ -1,4 +0,0 @@ -Listen 127.0.0.1:8301 -Listen [::1]:8301 - -# vim: syntax=apache ts=4 sw=4 sr noet -- cgit v1.2.3