From 983c7d0bdeda6bd84003e3577aa6886e8fc517b5 Mon Sep 17 00:00:00 2001 From: Nash Kaminski Date: Fri, 23 Aug 2024 15:38:20 -0500 Subject: [PATCH] Refactor of packaging files + migrate from sysvinit to systemd service management * Relocate all packaging files under linux/ * Use new specfile derived from the Fedora EPEL upstream * Build with debugging symbols at all times, such that we can strip them into the associated devel/debuginfo package during packaging. * Updates to README as needed * Use native systemd units for service management This commit implements both a user scoped systemd unit in order to support use cases where each user maintains one's own configuration file, running cNTLM as one's own user, as well as the traditional system scoped unit that is prevalent in most distribution packages. This is more compatible (as it does not require user scoped systemd instances) however less flexible. Additionally, the behavior of both systemd units is designed to pass parameters specified in the OPTARGS parameter in /etc/sysconfig/cntlmd to both user as well as system instances of cntlm, for purposes of centralized management of configuration parameters, such as the proxy hostnames or PAC file, while still allowing users to maintain their credentials in a configuration file private to their homedir. --- .gitignore | 7 +- Makefile | 71 +++-- README | 20 +- README.md | 23 +- VERSION | 2 +- debian | 1 + debian/cntlm.init | 87 ------ debian/prerm | 15 - linux/cntlm-user.in | 13 + debian/changelog => linux/debian/changelog.in | 2 +- {debian => linux/debian}/cntlm.default | 3 +- linux/debian/cntlm.service | 13 + linux/debian/cntlm.user.service | 12 + {debian => linux/debian}/compat | 0 {debian => linux/debian}/control | 4 +- {debian => linux/debian}/copyright | 0 {debian => linux/debian}/dirs | 0 {debian => linux/debian}/docs | 0 {debian => linux/debian}/lintian-override | 0 {debian => linux/debian}/postinst | 11 - {debian => linux/debian}/postrm | 6 - {debian => linux/debian}/rules | 3 +- {debian => linux/debian}/watch | 0 linux/rpm/SOURCES/cntlm-user.service | 12 + linux/rpm/SOURCES/cntlm.service | 13 + linux/rpm/SOURCES/cntlm.sysconfig | 14 + linux/rpm/SOURCES/cntlm.tmpfiles | 1 + linux/rpm/SPECS/cntlm.spec.in | 181 ++++++++++++ rpm/cntlm.init | 272 ------------------ rpm/cntlm.spec | 161 ----------- rpm/cntlm.sysconfig | 36 --- rpm/rules | 38 --- 32 files changed, 337 insertions(+), 684 deletions(-) create mode 120000 debian delete mode 100644 debian/cntlm.init delete mode 100644 debian/prerm create mode 100644 linux/cntlm-user.in rename debian/changelog => linux/debian/changelog.in (75%) rename {debian => linux/debian}/cntlm.default (70%) create mode 100644 linux/debian/cntlm.service create mode 100644 linux/debian/cntlm.user.service rename {debian => linux/debian}/compat (100%) rename {debian => linux/debian}/control (86%) rename {debian => linux/debian}/copyright (100%) rename {debian => linux/debian}/dirs (100%) rename {debian => linux/debian}/docs (100%) rename {debian => linux/debian}/lintian-override (100%) rename {debian => linux/debian}/postinst (53%) rename {debian => linux/debian}/postrm (74%) rename {debian => linux/debian}/rules (96%) rename {debian => linux/debian}/watch (100%) create mode 100644 linux/rpm/SOURCES/cntlm-user.service create mode 100644 linux/rpm/SOURCES/cntlm.service create mode 100644 linux/rpm/SOURCES/cntlm.sysconfig create mode 100644 linux/rpm/SOURCES/cntlm.tmpfiles create mode 100644 linux/rpm/SPECS/cntlm.spec.in delete mode 100644 rpm/cntlm.init delete mode 100644 rpm/cntlm.spec delete mode 100644 rpm/cntlm.sysconfig delete mode 100755 rpm/rules diff --git a/.gitignore b/.gitignore index cbbca61..01cc796 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ cntlm*.zip cntlm*.rpm cntlm*.deb cntlm*.tar.gz +cntlm*.tar.bz2 /configure-stamp /config/config.h /config/endian @@ -17,6 +18,9 @@ cntlm*.tar.gz /config/memset_s /config/gss /config/*.exe +/linux/debian/changelog +/linux/rpm/BUILD* +/linux/rpm/SPECS/cntlm.spec /win/*.exe /win/*.dll /win/setup.iss @@ -26,4 +30,5 @@ cntlm*.tar.gz .vscode .cproject .project -.settings/ \ No newline at end of file +.settings/ +rpm/BUILD* diff --git a/Makefile b/Makefile index 4f78909..c656218 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ DESTDIR := PREFIX := /usr/local SYSCONFDIR := $(DESTDIR)/etc BINDIR := $(DESTDIR)$(PREFIX)/sbin +INST_BINDIR := $(PREFIX)/sbin +LIBEXECDIR := $(DESTDIR)$(PREFIX)/libexec MANDIR := $(DESTDIR)$(PREFIX)/share/man STAMP := configure-stamp @@ -27,7 +29,7 @@ LDFLAGS := -lpthread -lm $(OSLDFLAGS) CYGWIN_REQS := cygwin1.dll cygrunsrv.exe ifeq ($(CC),gcc) -GCC_VER := $(shell ${CC} -dumpfullversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/') +GCC_VER := $(shell ${CC} -dumpfullversion -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/') GCC_GTEQ_430 := $(shell expr ${GCC_VER} \>= 40300) GCC_GTEQ_450 := $(shell expr ${GCC_VER} \>= 40500) GCC_GTEQ_600 := $(shell expr ${GCC_VER} \>= 60000) @@ -69,6 +71,10 @@ ifeq ($(COVERAGE),1) else ifeq ($(DEBUG),1) # DEBUG CFLAGS += -g -O0 +else ifeq ($(NOSTRIP),1) + # Packaging, therefore optimization enabled but build with debug symbols + # as RPM will strip these out into a -debuginfo package that can be optionally installed + CFLAGS += -g -O3 else # RELEASE CFLAGS += -O3 @@ -126,22 +132,31 @@ win/resources.o: win/resources.rc @echo Win64: adding ICON resource @windres $^ -o $@ +ifneq ($(NOSTRIP),1) + STRIP="-s" + STRIPAIX="-S" +else + STRIP="" + STRIPAIX="-S" +endif install: $(NAME) # Special handling for install(1) if [ "`uname -s`" = "AIX" ]; then \ - install -M 755 -S -f $(BINDIR) $(NAME); \ + install -M 755 $(STRIPAIX) -f $(BINDIR) $(NAME); \ install -M 644 -f $(MANDIR)/man1 doc/$(NAME).1; \ install -M 600 -c $(SYSCONFDIR) doc/$(NAME).conf; \ elif [ "`uname -s`" = "Darwin" ]; then \ install -d $(BINDIR)/; \ - install -m 755 -s $(NAME) $(BINDIR)/$(NAME); \ + install -m 755 $(STRIP) $(NAME) $(BINDIR)/$(NAME); \ install -d $(MANDIR)/man1/; \ install -m 644 doc/$(NAME).1 $(MANDIR)/man1/$(NAME).1; \ [ -f $(SYSCONFDIR)/$(NAME).conf -o -z "$(SYSCONFDIR)" ] \ || install -d $(SYSCONFDIR)/; \ install -m 600 doc/$(NAME).conf $(SYSCONFDIR)/$(NAME).conf; \ else \ - install -D -m 755 -s $(NAME) $(BINDIR)/$(NAME); \ + install -D -m 755 $(STRIP) $(NAME) $(BINDIR)/$(NAME); \ + sed "s#%BINDIR%#$(INST_BINDIR)#g" linux/cntlm-user.in > linux/cntlm-user; \ + install -D -m 755 linux/$(NAME)-user $(LIBEXECDIR)/$(NAME)-user; \ install -D -m 644 doc/$(NAME).1 $(MANDIR)/man1/$(NAME).1; \ [ -f $(SYSCONFDIR)/$(NAME).conf -o -z "$(SYSCONFDIR)" ] \ || install -D -m 600 doc/$(NAME).conf $(SYSCONFDIR)/$(NAME).conf; \ @@ -165,25 +180,22 @@ tbz2: rmdir tmp 2>/dev/null || true deb: - sed -i "s/^\(cntlm *\)([^)]*)/\1($(VER))/g" debian/changelog - if [ `id -u` = 0 ]; then \ - debian/rules binary; \ - debian/rules clean; \ - else \ - fakeroot debian/rules binary; \ - fakeroot debian/rules clean; \ + ln -sf linux/debian + sed "s/^\(cntlm *\)([^)]*)/\1($(VER))/g" linux/debian/changelog.in > linux/debian/changelog + if [ `id -u` = 0 ] && [ -L debian ]; then \ + linux/debian/rules binary; \ + linux/debian/rules clean; \ + elif [ -L debian ]; then \ + fakeroot linux/debian/rules binary; \ + fakeroot linux/debian/rules clean; \ fi mv ../cntlm_$(VER)*.deb . -rpm: - sed -i "s/^\(Version:[\t ]*\)\(.*\)/\1$(VER)/g" rpm/cntlm.spec - if [ `id -u` = 0 ]; then \ - rpm/rules binary; \ - rpm/rules clean; \ - else \ - fakeroot rpm/rules binary; \ - fakeroot rpm/rules clean; \ - fi +rpm: tbz2 + sed "s/^\(Version:[\t ]*\)\(.*\)/\1$(VER)/g" linux/rpm/SPECS/cntlm.spec.in > linux/rpm/SPECS/cntlm.spec + @cp $(NAME)-$(VER).tar.bz2 linux/rpm/SOURCES/ + rpmbuild --define '_topdir $(CURDIR)/linux/rpm' -ba linux/rpm/SPECS/cntlm.spec + mv linux/rpm/RPMS/**/*.rpm . win: win/setup.iss $(NAME) win/cntlm_manual.pdf win/cntlm.ini win/LICENSE.txt $(NAME)-$(VER)-win64.exe $(NAME)-$(VER)-win64.zip @@ -231,19 +243,22 @@ uninstall: clean: @rm -f config/endian config/gethostname config/socklen_t config/strdup config/arc4random_buf config/strlcat config/strlcpy config/memset_s config/gss config/*.exe - @rm -f *.o cntlm cntlm.exe configure-stamp build-stamp config/config.h + @rm -f *.o cntlm cntlm.exe configure-stamp build-stamp config/config.h cntlm-user @rm -f $(patsubst %, win/%, $(CYGWIN_REQS) cntlm.exe cntlm.ini LICENSE.txt resources.o setup.iss cntlm_manual.pdf) distclean: clean ifeq ($(findstring CYGWIN,$(OS)),) - if [ `id -u` = 0 ]; then \ - debian/rules clean; \ - rpm/rules clean; \ - else \ - fakeroot debian/rules clean; \ - fakeroot rpm/rules clean; \ + if [ -L debian ]; then \ + if command -v dh_testdir && [ `id -u` = 0 ]; then \ + debian/rules clean; \ + elif command -v dh_testdir; then \ + fakeroot debian/rules clean; \ + fi \ fi endif - @rm -f *.exe *.deb *.rpm *.tgz *.tar.gz *.tar.bz2 *.zip *.exe tags ctags pid 2>/dev/null + @rm -f *.exe *.deb *.rpm *.tgz *.tar.gz *.tar.bz2 *.zip *.exe \ + linux/rpm/specs/cntlm.spec linux/cntlm-user linux/debian/changelog tags ctags pid 2>/dev/null + @rm -rf linux/rpm/BUILD linux/rpm/BUILDROOT 2>/dev/null + .PHONY: all install tgz tbz2 deb rpm win uninstall clean distclean diff --git a/README b/README index ea93aca..43ac59e 100644 --- a/README +++ b/README @@ -115,11 +115,12 @@ $ ./configure $ make $ make install -Cntlm does not require any dynamic libraries and there are no dependencies you -have to satisfy before compilation, except for libpthreads. This library is -required for all threaded applications and is very likely to be part of your -system already, because it comes with libc. Next, install cntlm onto your -system like so: +Cntlm does not require any dynamic libraries unless kerberos support is enabled, +and there are no dependencies you have to satisfy before compilation, +except for libpthreads. This library is required for all threaded applications +and is very likely to be part of your system already, because it comes with libc. + +Next, install cntlm onto your system like so: Default installation directories are /usr/local/sbin, /usr/local/share/man and /etc. Should you want to install cntlm into a different location, change the DESTDIR @@ -132,7 +133,7 @@ $ make install SYSCONFDIR=/etc BINDIR=/usr/bin MANDIR=/usr/share/man Cntlm is compiled with system-wide configuration file by default. That means whenever you run cntlm, it looks into a hardcoded path (SYSCONFDIR) and tries -to load cntml.conf. You cannot make it not to do so, unless you use -c with an +to load cntlm.conf. You cannot make it not to do so, unless you use -c with an alternative file or /dev/null. This is standard behaviour and probably what you want. On the other hand, some of you might not want to use cntlm as a daemon started by init scripts and you would prefer setting up everything on the @@ -149,17 +150,14 @@ among other things a file called "cntlmd". It can be used as an init.d script. Architectures ~~~~~~~~~~~~~ The build system now has an autodetection of the build arch endianness. Every -common CPU and OS out there is supported, including Windows, MacOS X, Linux, +common CPU and OS out there is supported, including Windows, MacOS, Linux, *BSD, AIX. Compilers ~~~~~~~~~ -Cntlm is tested against GCC and IBM XL C/C++, other C compilers will work +Cntlm is tested against GCC, Clang and IBM XL C/C++, other C compilers will work for you too. There are no compiler specific directives and options AFAIK. -compilers might work for you (then again, they might not). Specific -Makefiles for different compilers are supported by the ./configure script -(e.g. Makefile.xlc) Contact diff --git a/README.md b/README.md index bb2387b..0aee46d 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Compile: dpkg-buildpackage -b -rfakeroot Upon installation, the package takes care of creating a dedicated user for -cntlm, init script integration, manages eventual configuration file updates +cntlm, systemd unit integration, manages eventual configuration file updates with new upstream versions, things like restart of the daemon after future updates, etc. You can later revert all these changes with one command, should you decide to remove cntlm from your system. @@ -62,12 +62,14 @@ you decide to remove cntlm from your system. ### 1) Quick way to create RPM - make rpm # you'll need root privs. or fakeroot utility + make rpm ### 2) Detailed howto (or if make rpm doesn't work for you) -To build an RPM package from scratch, as root change to -/usr/src/[redhat|rpm|whatever]/SOURCES +To build an RPM package from scratch: +* Ensure that the rpmdevtools package is present +* Execute `rpmdev-setuptree` +* Change to `~/rpmbuild/SOURCES` Copy there all files from cntlm's rpm/ directory plus appropriate version of the source tar.bz2 (see Creating a SOURCE TARBALL section above) and type: @@ -162,29 +164,28 @@ whenever you run cntlm, it looks into a hardcoded path (SYSCONFDIR) and tries to load cntml.conf. You cannot make it not to do so, unless you use -c with an alternative file or /dev/null. This is standard behavior and probably what you want. On the other hand, some of you might not want to use cntlm as a daemon -started by init scripts and you would prefer setting up everything on the +started by systemd units and you would prefer setting up everything on the command line. This is possible, just comment out SYSCONFDIR variable definition in the Makefile before you compile cntlm and it will remove this feature. Installation includes the main binary, the man page (see "man cntlm") and if the default config feature was not removed, it also installs a configuration template. Please note that unlike bin and man targets, existing configuration -is never overwritten during installation. In the doc/ directory you can find -among other things a file called "cntlmd". It can be used as an init.d script. +is never overwritten during installation. In the linux/ directory you can find +among other things a files with a suffix of ".service" which implement systemd +unit files that can be used to manage cntlm, as either a system scoped or user +scoped service. ## Architectures The build system now has an autodetection of the build arch endianness. Every -common CPU and OS out there is supported, including Windows, MacOS X, Linux, +common CPU and OS out there is supported, including Windows, MacOS, Linux, *BSD, AIX. ## Compilers Cntlm is tested against GCC, Clang and IBM XL C/C++, other C compilers will work for you too. There are no compiler specific directives and options AFAIK. -compilers might work for you (then again, they might not). Specific -Makefiles for different compilers are supported by the ./configure script -(e.g. Makefile.xlc) ## Contact diff --git a/VERSION b/VERSION index 9ba411f..32b1b40 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.94beta1 +0.95.0beta1 diff --git a/debian b/debian new file mode 120000 index 0000000..d1fe627 --- /dev/null +++ b/debian @@ -0,0 +1 @@ +linux/debian \ No newline at end of file diff --git a/debian/cntlm.init b/debian/cntlm.init deleted file mode 100644 index 04871a8..0000000 --- a/debian/cntlm.init +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: cntlm -# Required-Start: $syslog $time -# Required-Stop: $syslog $time -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Authenticating HTTP accelerator for NTLM secured proxies -# Description: Cntlm is meant to be given your proxy address and becomming -# the primary proxy then, listening on a selected local port. -# You point all your proxy-aware programs to it and don't ever -# have to deal with proxy authentication again. -### END INIT INFO -# -# DAEMON Location of the binary -# PIDFILE Make sure that you or, if used, -U uid can create/write it -# TIMEOUT How long to wait for active connections to finish before -# forcing cntlm to stop with a second signal -# RUNAS Name or number of the non-privileged account to run as -# - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/sbin/cntlm -NAME=cntlm -DESC="CNTLM Authentication Proxy" - -# Set default values -PIDFILE=/var/run/cntlm/cntlm.pid -TIMEOUT=1 -RUNAS=cntlm - -test -x $DAEMON || exit 0 - -# Include custom values if available -if [ -f /etc/default/cntlm ] ; then - . /etc/default/cntlm -fi - -DAEMON_OPTS="$DAEMON_OPTS -U $RUNAS -P $PIDFILE" -PIDDIR=`dirname $PIDFILE 2>/dev/null` - -start() { - echo -n "Starting $DESC: " - - if [ -n "$PIDDIR" -a ! -d "$PIDDIR" ]; then - mkdir -p "$PIDDIR" 2>/dev/null - chown "$RUNAS" "$PIDDIR" 2>/dev/null - chmod 755 "$PIDDIR" 2>/dev/null - fi - - start-stop-daemon --oknodo --quiet --start --pidfile $PIDFILE --name $NAME --startas $DAEMON -- $DAEMON_OPTS 2>/dev/null - if [ $? -eq 0 ]; then - echo "$NAME." - else - echo "failed!" - fi -} - -stop() { - echo -n "Stopping $DESC: " - start-stop-daemon --oknodo --quiet --stop --retry -HUP/$TIMEOUT/-KILL/2 --pidfile $PIDFILE --name $NAME 2>/dev/null - if [ $? -eq 0 ]; then - echo "$NAME." - else - echo "failed!" - fi -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload|force-reload) - stop - start - ;; - *) - echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 - exit 2 - ;; -esac - -exit 0 diff --git a/debian/prerm b/debian/prerm deleted file mode 100644 index 80e9110..0000000 --- a/debian/prerm +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -#DEBHELPER# - -# Automatically added by dh_installinit -if [ -x "/etc/init.d/cntlm" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cntlm stop || exit $? - else - /etc/init.d/cntlm stop || exit $? - fi -fi -# End automatically added section diff --git a/linux/cntlm-user.in b/linux/cntlm-user.in new file mode 100644 index 0000000..433ab20 --- /dev/null +++ b/linux/cntlm-user.in @@ -0,0 +1,13 @@ +#!/bin/bash +# cNTLM per user launcher script +USER_CONFIG_DIR="${XDG_CONFIG_HOME:-${HOME}/.config}" +CNTLM_CONFIG_LOC="${USER_CONFIG_DIR}/cntlm/cntlm.conf" + +if [ ! -e "${CNTLM_CONFIG_LOC}" ] ; then + echo "${CNTLM_CONFIG_LOC} does not exist! Unable to run cNTLM for user ${USER}." + # Prevent systemd from restarting + # we are never going to succeed until the user adds a config + exit 0 +fi + +exec %BINDIR%/cntlm -f -c "${CNTLM_CONFIG_LOC}" "$@" \ No newline at end of file diff --git a/debian/changelog b/linux/debian/changelog.in similarity index 75% rename from debian/changelog rename to linux/debian/changelog.in index 775078a..8a840de 100644 --- a/debian/changelog +++ b/linux/debian/changelog.in @@ -1,4 +1,4 @@ -cntlm (0.94beta1) unstable; urgency=low +cntlm (0.95.0beta1) unstable; urgency=low * Ad-hoc source build, not a Debian maintained package! diff --git a/debian/cntlm.default b/linux/debian/cntlm.default similarity index 70% rename from debian/cntlm.default rename to linux/debian/cntlm.default index 6f94a49..523fe03 100644 --- a/debian/cntlm.default +++ b/linux/debian/cntlm.default @@ -1,3 +1,2 @@ # Additional options that are passed to the Daemon. -TIMEOUT=1 -RUNAS=cntlm +OPTARGS="" diff --git a/linux/debian/cntlm.service b/linux/debian/cntlm.service new file mode 100644 index 0000000..5567a00 --- /dev/null +++ b/linux/debian/cntlm.service @@ -0,0 +1,13 @@ +[Unit] +Description=cNTLM authentication proxy +After=network.target + +[Service] +Type=simple +Environment="RUNAS=cntlm" +EnvironmentFile=-/etc/default/cntlm +ExecStart=/usr/sbin/cntlm -f -U $RUNAS -c /etc/cntlm.conf $OPTARGS +Restart=on-failure + +[Install] +WantedBy=default.target diff --git a/linux/debian/cntlm.user.service b/linux/debian/cntlm.user.service new file mode 100644 index 0000000..27c49d1 --- /dev/null +++ b/linux/debian/cntlm.user.service @@ -0,0 +1,12 @@ +[Unit] +Description=cNTLM authentication proxy - per user instance +After=network.target + +[Service] +Type=simple +EnvironmentFile=-/etc/default/cntlm +ExecStart=/usr/libexec/cntlm-user $OPTARGS +Restart=on-failure + +[Install] +WantedBy=default.target diff --git a/debian/compat b/linux/debian/compat similarity index 100% rename from debian/compat rename to linux/debian/compat diff --git a/debian/control b/linux/debian/control similarity index 86% rename from debian/control rename to linux/debian/control index 440b78f..84faaf7 100644 --- a/debian/control +++ b/linux/debian/control @@ -4,8 +4,8 @@ Priority: optional Maintainer: David Watson Build-Depends: debhelper (>= 5), krb5-multidev Standards-Version: 3.8.0 -Vcs-Git: git://planetwatson.co.uk/cntlm -Vcs-Browser: http://projects.planetwatson.co.uk/repositories/show/cntlm +Vcs-Git: git+https://github.com/versat/cntlm.git +Vcs-Browser: https://github.com/versat/cntlm Homepage: http://cntlm.sourceforge.net/ Package: cntlm diff --git a/debian/copyright b/linux/debian/copyright similarity index 100% rename from debian/copyright rename to linux/debian/copyright diff --git a/debian/dirs b/linux/debian/dirs similarity index 100% rename from debian/dirs rename to linux/debian/dirs diff --git a/debian/docs b/linux/debian/docs similarity index 100% rename from debian/docs rename to linux/debian/docs diff --git a/debian/lintian-override b/linux/debian/lintian-override similarity index 100% rename from debian/lintian-override rename to linux/debian/lintian-override diff --git a/debian/postinst b/linux/debian/postinst similarity index 53% rename from debian/postinst rename to linux/debian/postinst index d1c780d..23729bf 100644 --- a/debian/postinst +++ b/linux/debian/postinst @@ -20,14 +20,3 @@ if ! [ -d $HOME ]; then fi #DEBHELPER# - -# Automatically added by dh_installinit -if [ -x "/etc/init.d/cntlm" ]; then - update-rc.d cntlm defaults >/dev/null - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d cntlm start || exit $? - else - /etc/init.d/cntlm start || exit $? - fi -fi -# End automatically added section diff --git a/debian/postrm b/linux/debian/postrm similarity index 74% rename from debian/postrm rename to linux/debian/postrm index 3ec0f03..703191c 100644 --- a/debian/postrm +++ b/linux/debian/postrm @@ -24,9 +24,3 @@ if [ "$1" = "purge" ]; then fi #DEBHELPER# - -# Automatically added by dh_installinit -if [ "$1" = "purge" ] ; then - update-rc.d cntlm remove >/dev/null || exit $? -fi -# End automatically added section diff --git a/debian/rules b/linux/debian/rules similarity index 96% rename from debian/rules rename to linux/debian/rules index 93acd93..b2ad63d 100755 --- a/debian/rules +++ b/linux/debian/rules @@ -64,7 +64,8 @@ binary-arch: build install dh_install cp debian/lintian-override debian/cntlm/usr/share/lintian/overrides/cntlm dh_installdebconf - dh_installinit -n + dh_installsystemd --no-enable + dh_installsystemduser --no-enable dh_installman doc/cntlm.1 dh_link dh_strip diff --git a/debian/watch b/linux/debian/watch similarity index 100% rename from debian/watch rename to linux/debian/watch diff --git a/linux/rpm/SOURCES/cntlm-user.service b/linux/rpm/SOURCES/cntlm-user.service new file mode 100644 index 0000000..f09288d --- /dev/null +++ b/linux/rpm/SOURCES/cntlm-user.service @@ -0,0 +1,12 @@ +[Unit] +Description=cNTLM authentication proxy - per user instance +After=network.target + +[Service] +Type=simple +EnvironmentFile=-/etc/sysconfig/cntlmd +ExecStart=/usr/libexec/cntlm-user $OPTARGS +Restart=on-failure + +[Install] +WantedBy=default.target diff --git a/linux/rpm/SOURCES/cntlm.service b/linux/rpm/SOURCES/cntlm.service new file mode 100644 index 0000000..ec89a0a --- /dev/null +++ b/linux/rpm/SOURCES/cntlm.service @@ -0,0 +1,13 @@ +[Unit] +Description=cNTLM authentication proxy +After=network.target + +[Service] +Type=simple +Environment="RUNAS=cntlm" +EnvironmentFile=-/etc/sysconfig/cntlmd +ExecStart=/usr/sbin/cntlm -f -U $RUNAS -c /etc/cntlm.conf $OPTARGS +Restart=on-failure + +[Install] +WantedBy=default.target diff --git a/linux/rpm/SOURCES/cntlm.sysconfig b/linux/rpm/SOURCES/cntlm.sysconfig new file mode 100644 index 0000000..535123a --- /dev/null +++ b/linux/rpm/SOURCES/cntlm.sysconfig @@ -0,0 +1,14 @@ +## Path: Network/Proxy/Cntlm +## Configuration for the system-wide instance of cNTLM + +## Type: string +## Default: cntlm +# Name or number of the non-privileged account to run as +RUNAS=cntlm + +## Type: string +## Default: "" +# List o optional arguments one would specify on the command line. +# See the cntlm man page for list of available arguments +# with their description. +OPTARGS="" diff --git a/linux/rpm/SOURCES/cntlm.tmpfiles b/linux/rpm/SOURCES/cntlm.tmpfiles new file mode 100644 index 0000000..03162e7 --- /dev/null +++ b/linux/rpm/SOURCES/cntlm.tmpfiles @@ -0,0 +1 @@ +d /run/cntlm 0755 cntlm cntlm \ No newline at end of file diff --git a/linux/rpm/SPECS/cntlm.spec.in b/linux/rpm/SPECS/cntlm.spec.in new file mode 100644 index 0000000..9de46e6 --- /dev/null +++ b/linux/rpm/SPECS/cntlm.spec.in @@ -0,0 +1,181 @@ +%global _hardened_build 1 + +# Do not override CFLAGS, LDFLAGS, and the like with the distribution defaults +# see https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/buildflags.md#using-rpm-build-flags +%undefine _auto_set_build_flags + +Summary: Fast NTLM authentication proxy with tunneling +Name: cntlm +Version: snapshot +Release: 1%{?dist} +License: GPLv2+ + +URL: https://github.com/versat/cntlm +Source0: %{name}-%{version}.tar.bz2 +Source1: cntlm.tmpfiles +Source2: cntlm.sysconfig +Source3: cntlm.service +Source4: cntlm-user.service + +Requires: systemd +BuildRequires: systemd +%if 0%{?suse_version} +Requires(pre): shadow +%else +Requires(pre): shadow-utils +%endif +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + + +%description +Cntlm is a fast and efficient NTLM proxy, with support for TCP/IP tunneling, +authenticated connection caching, ACLs, proper daemon logging and behavior +and much more. It has up to ten times faster responses than similar NTLM +proxies, while using by orders or magnitude less RAM and CPU. Manual page +contains detailed information. + +# SuSE requires explicit inclusion of this macro to build a -debuginfo + -debugsource RPM +%if 0%{?suse_version} +%debug_package +%endif + +%prep +%setup + +%build +CC=gcc ./configure +make NOSTRIP=1 %{?_smp_mflags} SYSCONFDIR=%{_sysconfdir} + +%install +make BINDIR=%{buildroot}%{_sbindir} INST_BINDIR=%{_sbindir} MANDIR=%{buildroot}%{_mandir} SYSCONFDIR=%{buildroot}%{_sysconfdir} LIBEXECDIR=%{buildroot}%{_libexecdir} NOSTRIP=1 install + +install -D -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/cntlmd +install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service +install -D -m 0644 %{SOURCE4} %{buildroot}%{_userunitdir}/%{name}.service + +install -D -d -m 0755 %{buildroot}/run/%{name}/ + + +%pre +getent group %{name} > /dev/null || groupadd -r %{name} +getent passwd %{name} > /dev/null || \ + useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \ + -c "%{name} daemon" %{name} +exit 0 + + +%post +%systemd_post %{name}.service + + +%preun +%systemd_preun %{name}.service + + +%postun +%systemd_postun_with_restart %{name}.service + + +%files +%doc README COPYRIGHT +%license LICENSE +%{_sbindir}/%{name} +%{_libexecdir}/%{name}-user +%{_mandir}/man1/%{name}.1* +%config(noreplace) %{_sysconfdir}/%{name}.conf +%config(noreplace) %{_sysconfdir}/sysconfig/cntlmd +%{_tmpfilesdir}/%{name}.conf +%{_unitdir}/%{name}.service +%{_userunitdir}/%{name}.service +%attr(755, %{name}, %{name}) %dir /run/%{name}/ + + +%changelog +* Wed Jan 31 2024 Nash Kaminski - 0.95.0-1 +- New specfile based on the Fedora EPEL7 specfile with backported compatibility with OpenSuSE +- systemd service management + +* Fri Feb 10 2017 Fedora Release Engineering - 0.92.3-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Feb 03 2016 Fedora Release Engineering - 0.92.3-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 0.92.3-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Aug 16 2014 Fedora Release Engineering - 0.92.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 0.92.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri Dec 13 2013 Sandro Mani - 0.92.3-5 +- Set correct permissions on /run/cntlm/ + +* Thu Dec 12 2013 Sandro Mani - 0.92.3-4 +- Really create /run/cntlm/ on install + +* Wed Oct 23 2013 Sandro Mani - 0.92.3-3 +- Install /run/cntlm, change /var/run -> /run + +* Mon Aug 26 2013 Sandro Mani - 0.92.3-2 +- Fix debuginfo package empty (rhbz#1001302) + +* Thu Aug 22 2013 Sandro Mani - 0.92.3-1 +- Update to 0.92.3 + +* Sat Aug 03 2013 Fedora Release Engineering - 0.92-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Wed Feb 13 2013 Fedora Release Engineering - 0.92-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Jul 18 2012 Fedora Release Engineering - 0.92-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Jan 4 2012 Matt Domsch - 0.92-2 +- convert to systemd (BZ771504), with unit file by J├│hann B. Gu├░mundsson + +* Mon Dec 5 2011 Matt Domsch - 0.92-1 +- update to new bugfix release (BZ760164) + +* Tue Feb 08 2011 Fedora Release Engineering - 0.35.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Nov 24 2010 Matt Domsch - 0.35.1-8 +- add /etc/tmpfiles.d/cntlm.conf to create /var/run/cntlm/ (BZ656561) + +* Mon Nov 8 2010 Matt Domsch - 0.35.1-7 +- install NetworkManager dispatcher script, fixes BZ650079 + +* Mon Sep 27 2010 Matt Domsch - 0.35.1-6 +- set SYSCONFDIR during build. Fixes BZ637767 + +* Wed Sep 1 2010 Matt Domsch - 0.35.1-5 +- add define for _initddir, needed on el5 + +* Thu Aug 26 2010 Matt Domsch - 0.35.1-4 +- initscript: use pidfile to killproc + +* Wed Aug 25 2010 Matt Domsch - 0.35.1-3 +- additional fixes per package review + +* Tue Aug 24 2010 Matt Domsch - 0.35.1-2 +- updated spec to match Fedora packaging guidelines + +* Fri Jul 27 2007 Radislav Vrnata +- added support for SuSE Linux + +* Fri Jul 27 2007 Radislav Vrnata +- fixed pre, post, preun, postun macros bugs affecting upgrade process + +* Wed May 30 2007 Since 0.28 maintained by + + +* Mon May 28 2007 Radislav Vrnata +- Version 0.27 +- First release \ No newline at end of file diff --git a/rpm/cntlm.init b/rpm/cntlm.init deleted file mode 100644 index 746c4b2..0000000 --- a/rpm/cntlm.init +++ /dev/null @@ -1,272 +0,0 @@ -#!/bin/sh -# -# cntlmd: Start/stop the cntlm proxy. -# -# chkconfig: 2345 26 89 -# Description: Cntlm is meant to be given your proxy address and becomming -# the primary proxy then, listening on a selected local port. -# You point all your proxy-aware programs to it and don't ever -# have to deal with proxy authentication again. -# -# Authors: Radislav Vrnata -# Michal Strnad -# Christian Wittmer -# -### BEGIN INIT INFO -# Provides: cntlm -# Required-Start: $syslog $network $time -# Should-Start: $remote_fs -# Required-Stop: $syslog $network $time -# Should-Stop: $remote_fs -# Default-Start: 2 3 5 -# Default-Stop: 0 1 6 -# Short-Description: start/stop the cntlm proxy -# Description: ntlm is meant to be given your proxy address and becomming -# the primary proxy then, listening on a selected local port. -# You point all your proxy-aware programs to it and don't ever -# have to deal with proxy authentication again. -### END INIT INFO -# -# Note on runlevels: -# 0 - halt/poweroff 6 - reboot -# 1 - single user -# 2 - multiuser without network exported -# 3 - multiuser with network (text mode) -# 4 - Not used/User-definable -# 5 - multiuser with network and X11 (xdm) -# 6 - reboot -# - -# Determining Linux RedHat/SuSE -# -# /etc/redhat-release -# /etc/SuSE-release - -SuSE=false -RedHat=false - -if [ -f /etc/SuSE-release ]; then - SuSE=true -elif [ -f /etc/redhat-release ]; then - RedHat=true -else - echo "Error: your platform is not supported by $0" > /dev/stderr - exit 1 -fi - - -# Source function library SuSE/RedHat. -if $SuSE; then - # Source LSB init functions - # providing start_daemon, killproc, pidofproc, - # log_success_msg, log_failure_msg and log_warning_msg. - # This is currently not used by UnitedLinux based distributions and - # not needed for init scripts for UnitedLinux only. If it is used, - # the functions from rc.status should not be sourced or used. - #. /lib/lsb/init-functions - - # Shell functions sourced from /etc/rc.status: - # rc_check check and set local and overall rc status - # rc_status check and set local and overall rc status - # rc_status -v be verbose in local rc status and clear it afterwards - # rc_status -v -r ditto and clear both the local and overall rc status - # rc_status -s display "skipped" and exit with status 3 - # rc_status -u display "unused" and exit with status 3 - # rc_failed set local and overall rc status to failed - # rc_failed set local and overall rc status to - # rc_reset clear both the local and overall rc status - # rc_exit exit appropriate to overall rc status - # rc_active checks whether a service is activated by symlinks - - # Return values acc. to LSB for all commands but status: - # 0 - success - # 1 - generic or unspecified error - # 2 - invalid or excess argument(s) - # 3 - unimplemented feature (e.g. "reload") - # 4 - user had insufficient privileges - # 5 - program is not installed - # 6 - program is not configured - # 7 - program is not running - # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) - # - # Note that starting an already running service, stopping - # or restarting a not-running service as well as the restart - # with force-reload (in case signaling is not supported) are - # considered a success. - test -f /etc/rc.status && . /etc/rc.status || { - echo "Error: your platform is not supported by $0" > /dev/stderr; - exit 1 - } - rc_reset -else - test -f /etc/init.d/functions && . /etc/init.d/functions || { - echo "Error: your platform is not supported by $0" > /dev/stderr; - exit 1 - } - RETVAL=0 -fi - -# Check for existence of needed config file and read it -CNTLM_CONFIG="/etc/cntlm.conf" -test -r $CNTLM_CONFIG || { echo "$CNTLM_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# Check for existence of needed sysconfig file and read it -if $SuSE ; then - CNTLM_SYSCONFIG="/etc/sysconfig/cntlm" -else - CNTLM_SYSCONFIG="/etc/sysconfig/cntlmd" -fi -test -r $CNTLM_SYSCONFIG && . $CNTLM_SYSCONFIG || { - echo "$CNTLM_SYSCONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# some defaults -[ -z "${DAEMON}" ] && DAEMON=/usr/sbin/cntlm -[ -z "${DESC}" ] && DESC="CNTLM Authentication Proxy" -[ -z "${PIDFILE}" ] && PIDFILE="/var/run/cntlm/cntlmd.pid" -if $SuSE ; then - [ -z "${LOCKFILE}" ] && LOCKFILE="/var/lock/subsys/cntlm" -else - [ -z "${LOCKFILE}" ] && LOCKFILE="/var/lock/subsys/cntlmd" -fi -[ -z "${RUNAS}" ] && RUNAS="cntlm" - -# if no "Proxy" is set in cntlm.conf try '127.0.0.1:3128' as a default -if [ `/bin/cat $CNTLM_CONFIG | grep -e "^Listen" >/dev/null; echo $?` -eq 0 ]; then - CNTLM_LISTEN= -else - CNTLM_LISTEN="-l 127.0.0.1:3128" -fi - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -test -x $DAEMON || { echo "$DAEMON not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -case "$1" in - start) - echo -n "Starting ${DESC}: " - if $SuSE; then - ## Start daemon with startproc(8). If this fails - ## the return value is set appropriately by startproc. - /sbin/startproc -p $PIDFILE $DAEMON -P $PIDFILE $CNTLM_LISTEN -U $RUNAS $OPTARGS &>/dev/null - - # Remember status and be verbose - rc_status -v - else - daemon cntlm -P $PIDFILE $CNTLM_LISTEN -U $RUNAS $OPTARGS 2>/dev/null - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch $LOCKFILE - exit $RETVAL - fi - ;; - stop) - echo -n "Shutting down ${DESC}: " - if $SuSE; then - ## Stop daemon with killproc(8) and if this fails - ## killproc sets the return value according to LSB. - /sbin/killproc -p $PIDFILE -TERM $DAEMON &>/dev/null - - # Remember status and be verbose - rc_status -v - else - killproc cntlm - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f $LOCKFILE - exit $RETVAL - fi - ;; - try-restart|condrestart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - if $SuSE; then - rc_reset # Not running is not a failure. - # Remember status and be quiet - rc_status - else - exit 0 - fi - fi - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - if $SuSE; then - # Remember status and be quiet - rc_status - fi - ;; - force-reload|reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart the service if it - ## is running. - - # cntlm does not support SIGHUP, so restart - echo -n "Reload ${DESC}: " - ## if it supports it: - #/sbin/killproc -p $PIDFILE -HUP $DAEMON - - # Remember status and be verbose - #rc_status -v - - ## Otherwise: - $0 try-restart - - if $SuSE; then - # Remember status and be quiet - rc_status - fi - ;; - status) - echo -n "Checking for ${DESC}: " - if $SuSE; then - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Return value is slightly different for the status command: - # 0 - service up and running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running (unused) - # 4 - service status unknown :-( - # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) - - # NOTE: checkproc returns LSB compliant status values. - /sbin/checkproc -p $PIDFILE $DAEMON - # NOTE: rc_status knows that we called this init script with - # "status" option and adapts its messages accordingly. - - # Remember status and be verbose - rc_status -v - else - status cntlm - fi - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -if $SuSE; then - rc_exit -else - exit $RETVAL -fi diff --git a/rpm/cntlm.spec b/rpm/cntlm.spec deleted file mode 100644 index 2d02692..0000000 --- a/rpm/cntlm.spec +++ /dev/null @@ -1,161 +0,0 @@ -Summary: Fast NTLM authentication proxy with tunneling -Name: cntlm -Version: 0.93beta5 -Release: 1%{?dist} -License: GNU GPL V2 -%if 0%{?suse_version} -Group: Productivity/Networking/Web/Proxy -%else -Group: System/Daemons -%endif -URL: http://cntlm.sourceforge.net/ -Source0: %{name}-%{version}.tar.bz2 -Source1: %{name}.init -Source2: %{name}.sysconfig - - -%if 0%{?suse_version} -Prereq: util-linux %{?insserv_prereq} %{?fillup_prereq} -%else -Prereq: which /sbin/chkconfig -%endif -Prereq: /usr/sbin/useradd /usr/bin/getent - -Provides: cntlm = %{version} - -BuildRoot: %{_tmppath}/%{name}-%{version}-root - -%description -Cntlm is a fast and efficient NTLM proxy, with support for TCP/IP tunneling, -authenticated connection caching, ACLs, proper daemon logging and behaviour -and much more. It has up to ten times faster responses than similar NTLM -proxies, while using by orders or magnitude less RAM and CPU. Manual page -contains detailed information. - -%prep -%setup -q -n %{name}-%{version} - -%build -./configure -make SYSCONFDIR=%{_sysconfdir} \ - BINDIR=%{_sbindir} \ - MANDIR=%{_mandir} - -%install -# Clean up in case there is trash left from a previous build -rm -rf $RPM_BUILD_ROOT -mkdir $RPM_BUILD_ROOT - -# Create the target build directory hierarchy -%if 0%{?suse_version} - mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates -%else - mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig -%endif - -mkdir -p $RPM_BUILD_ROOT/sbin - -%makeinstall SYSCONFDIR=$RPM_BUILD_ROOT/%{_sysconfdir} \ - BINDIR=$RPM_BUILD_ROOT/%{_sbindir} \ - MANDIR=$RPM_BUILD_ROOT/%{_mandir} -%if 0%{?suse_version} - install -D -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/cntlm - install -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.cntlm - ln -sf %{_initrddir}/cntlm $RPM_BUILD_ROOT/sbin/rccntlm -%else - install -D -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/cntlmd - install -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/cntlmd - ln -sf %{_initrddir}/cntlmd $RPM_BUILD_ROOT/sbin/rccntlmd -%endif - -%clean -rm -rf $RPM_BUILD_ROOT - -%pre -if [ "$1" -eq 1 ]; then - [ -z "`%{_bindir}/getent passwd "cntlm"`" ] && { - useradd -s /sbin/nologin -m -r -d /var/run/cntlm cntlm 2>/dev/null - } -fi -: - -%post -%if 0%{?suse_version} -%{fillup_and_insserv cntlm} -%else - if [ "$1" -eq 1 ]; then - if [ -x /usr/lib/lsb/install_initd ]; then - /usr/lib/lsb/install_initd /etc/init.d/cntlmd - elif [ -x /sbin/chkconfig ]; then - /sbin/chkconfig --add cntlmd - else - for i in 2 3 4 5; do - ln -sf /etc/init.d/cntlmd /etc/rc.d/rc${i}.d/S26cntlmd - done - for i in 1 6; do - ln -sf /etc/init.d/cntlmd /etc/rc.d/rc${i}.d/K89cntlmd - done - fi - fi - : -%endif - -%preun -%if 0%{?suse_version} -%{stop_on_removal cntlm} -%else - if [ "$1" -eq 0 ]; then - /etc/init.d/cntlmd stop > /dev/null 2>&1 - if [ -x /usr/lib/lsb/remove_initd ]; then - /usr/lib/lsb/install_initd /etc/init.d/cntlmd - elif [ -x /sbin/chkconfig ]; then - /sbin/chkconfig --del cntlmd - else - rm -f /etc/rc.d/rc?.d/???cntlmd - fi - fi - : -%endif - -%postun -if [ "$1" -eq 0 ]; then - /usr/sbin/userdel -r cntlm 2>/dev/null -fi -: -%if 0%{?suse_version} -%{insserv_cleanup} -%else - if [ -x /usr/lib/lsb/remove_initd ]; then - /usr/lib/lsb/install_initd /etc/init.d/cntlmd - elif [ -x /sbin/chkconfig ]; then - /sbin/chkconfig --del cntlmd - else - rm -f /etc/rc.d/rc?.d/???cntlmd - fi - : -%endif - -%files -%defattr(-,root,root,-) -%doc LICENSE README COPYRIGHT -%{_sbindir}/cntlm -%{_mandir}/man1/cntlm.1* -%config(noreplace) %{_sysconfdir}/cntlm.conf -%if 0%{?suse_version} - %config(noreplace) /var/adm/fillup-templates/sysconfig.cntlm - %{_initrddir}/cntlm - /sbin/rccntlm -%else - %config(noreplace) %{_sysconfdir}/sysconfig/cntlmd - %{_initrddir}/cntlmd - /sbin/rccntlmd -%endif - -%changelog -* Thu Mar 18 2010 : Version 0.90 -- Major rewrite of proxy code -- NoProxy option added to bypass proxy for certain addresses -- Ability to work as a standalone proxy added -- few changes in spec file to package successfully for SuSE - and RedHat distros using openSuSE BuildService by - Michal Strnad diff --git a/rpm/cntlm.sysconfig b/rpm/cntlm.sysconfig deleted file mode 100644 index 11dcc51..0000000 --- a/rpm/cntlm.sysconfig +++ /dev/null @@ -1,36 +0,0 @@ -## Path: Network/Proxy/Cntlm - -## Type: string -## Default: /usr/sbin/cntlm -# CNTLM binary location -DAEMON="/usr/sbin/cntlm" - -## Type: string -## Default: /usr/sbin/cntlm -# Location of CNTLM's PID file. -# Make sure that you or, if used, -U uid can create/write it -PIDFILE="/var/run/cntlm/cntlmd.pid" - -## Description: Timeout before forced shutdown -## Type: integer -## Default: 1 -# How long to wait before forcing cntlm to stop with a second -# signal when active connections are still not finished -TIMEOUT=1 - -## Type: string -## Default: cntlm -# Name or number of the non-privileged account to run as -RUNAS=cntlm - -## Type: string -## Default: "CNTLM Authentication Proxy" -# CNTLM custom service description -DESC="CNTLM Authentication Proxy" - -## Type: string -## Default: "" -# List o optional arguments one would specify on the command line. -# See the cntlm man page for list of available arguments -# with their description. -OPTARGS="-U $RUNAS -P $PIDFILE" diff --git a/rpm/rules b/rpm/rules deleted file mode 100755 index d60953a..0000000 --- a/rpm/rules +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# Usage: rules [binary|clean] -# - -if [ ! -f VERSION -o ! -f Makefile ]; then - echo "This command must be run from the main source directory!" >&2 - exit 1 -fi - -RPMS="BUILD RPMS SOURCES SPECS SRPMS tmp" -DIR=`pwd`/tmp -NAME=cntlm-`cat VERSION` - -if [ "$1" = "binary" ]; then - rm -f cntlm*.rpm 2>/dev/null - for i in $RPMS; do mkdir -p $DIR/$i; done # Create new rpm build structure - - make tbz2 - mv $NAME.tar.bz2 $DIR/SOURCES - cp rpm/cntlm.* $DIR/SOURCES # Prepare build environment - - rpmbuild \ - --define "_topdir $DIR" \ - --define "_sourcedir %_topdir/SOURCES" \ - --define "_builddir %_topdir/BUILD" \ - --define "_buildrootdir %_topdir/BUILD" \ - --define "_rpmdir %_topdir/RPMS" \ - --define "_specdir %_topdir/SPECS" \ - --define "_srcrpmdir %_topdir/SRPMS" \ - -ba $DIR/SOURCES/cntlm.spec - - cp $DIR/SRPMS/*rpm . 2>/dev/null - cp $DIR/RPMS/*/cntlm*rpm . 2>/dev/null -elif [ "$1" = "clean" ]; then - for i in $RPMS; do rm -rf $DIR/$i; done # Clean the whole mess, keep packages - rmdir $DIR 2>/dev/null || true -fi