From 4bce87d862dead34db5f66dd75fc09998448231e Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 6 Aug 2024 16:39:27 +0200 Subject: [PATCH] RHEL-25502 set common server settings by /etc/lprint.conf Resolves: RHEL-25502 --- ...print.c-Enable-TLS-support-in-Web-UI.patch | 43 +++++++++++++++++++ lprint.conf | 11 +++++ lprint.spec | 21 ++++++++- 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 0001-lprint.c-Enable-TLS-support-in-Web-UI.patch create mode 100644 lprint.conf diff --git a/0001-lprint.c-Enable-TLS-support-in-Web-UI.patch b/0001-lprint.c-Enable-TLS-support-in-Web-UI.patch new file mode 100644 index 0000000..709bcc7 --- /dev/null +++ b/0001-lprint.c-Enable-TLS-support-in-Web-UI.patch @@ -0,0 +1,43 @@ +From 641efd2de2c57d06389b869943aaf7517d52645c Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Tue, 6 Aug 2024 15:16:27 +0200 +Subject: [PATCH] lprint.c: Enable TLS support in Web UI + +Currently (1.3.1) there is no way how to turn TLS web UI pages, because +system callback does not set WEB_TLS option by default, and checks only +for `no-tls` when processing server options. + +This can be fixed by two way, depending on which default settings we +prefer. The PR enables TLS pages by default, leaving to user whether he +wants them to be disabled. + +Do let me know if you would prefer the other way around. +--- + lprint.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lprint.c b/lprint.c +index 435e9aa..8990379 100644 +--- a/lprint.c ++++ b/lprint.c +@@ -468,7 +468,7 @@ system_cb( + char oldfile[1024]; // Old configuration filename + pappl_loglevel_t loglevel; // Log level + int port = 0; // Port number, if any +- pappl_soptions_t soptions = PAPPL_SOPTIONS_MULTI_QUEUE | PAPPL_SOPTIONS_WEB_INTERFACE | PAPPL_SOPTIONS_WEB_LOG | PAPPL_SOPTIONS_WEB_SECURITY; ++ pappl_soptions_t soptions = PAPPL_SOPTIONS_MULTI_QUEUE | PAPPL_SOPTIONS_WEB_INTERFACE | PAPPL_SOPTIONS_WEB_LOG | PAPPL_SOPTIONS_WEB_SECURITY | PAPPL_SOPTIONS_WEB_TLS; + // System options + static pappl_version_t versions[1] = // Software versions + { +@@ -527,7 +527,7 @@ system_cb( + else if (!strcmp(valptr, "web-security") || !strncmp(valptr, "web-security,", 13)) + soptions |= PAPPL_SOPTIONS_WEB_SECURITY; + else if (!strcmp(valptr, "no-tls") || !strncmp(valptr, "no-tls,", 7)) +- soptions |= PAPPL_SOPTIONS_NO_TLS; ++ soptions &= (pappl_soptions_t)~PAPPL_SOPTIONS_WEB_TLS; + + if ((valptr = strchr(valptr, ',')) != NULL) + valptr ++; +-- +2.45.2 + diff --git a/lprint.conf b/lprint.conf new file mode 100644 index 0000000..4a3d235 --- /dev/null +++ b/lprint.conf @@ -0,0 +1,11 @@ +# multi-queue - Support multiple print queues. +# web-interface - Web UI. +# raw-socket - Provide a raw ("JetDirect") socket for each printer on port 91xx. +# web-network - Enables the network settings web page. +# web-remote - Enables remote queue management. +# web-security - Enables the user/password settings web page. +# web-tls - Enables the TLS settings web page. +server-options=multi-queue,web-interface,raw-socket,web-network,web-security,web-tls + +# server-port - Listens for IPP connections on the specified port. +server-port=8000 diff --git a/lprint.spec b/lprint.spec index cbc67bb..f7f8f4b 100644 --- a/lprint.spec +++ b/lprint.spec @@ -3,18 +3,21 @@ Name: lprint Version: 1.3.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A Label Printer Application License: Apache-2.0 URL: https://www.msweet.org/lprint Source0: https://github.com/michaelrsweet/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz +Source1: lprint.conf # UPSTREAM PATCHES # fix putting state file into correct place # https://github.com/michaelrsweet/lprint/commit/648bc20171 Patch001: 0001-Update-state-filename-to-current-PAPPL-standard-rena.patch +# https://github.com/michaelrsweet/lprint/pull/151 +Patch002: 0001-lprint.c-Enable-TLS-support-in-Web-UI.patch # dns-sd support for register/sharing devices @@ -65,6 +68,18 @@ export CC=%{__cc} %install %make_install DESTDIR='' +install -p -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/lprint.conf + +%pre +if [ $1 -gt 1 ] +then + if test ! -f /var/lib/lprint.state -a -f /etc/lprint.conf + then + # if the lprint.conf is the default one from RPM, do not move + grep -q "^# Fedora default configuration" lprint.conf || mv -f /etc/lprint.conf /var/lib/lprint.state + fi +fi + %post %systemd_post lprint.service @@ -77,6 +92,7 @@ export CC=%{__cc} %files %doc README.md DOCUMENTATION.md CONTRIBUTING.md CHANGES.md %license LICENSE NOTICE +%config(noreplace) %{_sysconfdir}/lprint.conf %{_bindir}/lprint %{_mandir}/man1/lprint-add.1* %{_mandir}/man1/lprint-cancel.1* @@ -98,6 +114,9 @@ export CC=%{__cc} %changelog +* Tue Aug 06 2024 Zdenek Dohnal - 1.3.1-2 +- RHEL-25502 set common server settings by /etc/lprint.conf + * Wed Jul 17 2024 Zdenek Dohnal - 1.3.1-1 - RHEL-25806 [lprint] rebase lprint to 1.3.1 or newer upstream version