From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 27B0E8ACD2; Fri, 21 Oct 2022 15:03:05 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 07E1522455; Fri, 21 Oct 2022 15:03:04 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS; Fri, 21 Oct 2022 15:02:58 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9149C44B1C; Fri, 21 Oct 2022 15:02:57 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com Date: Fri, 21 Oct 2022 15:02:46 +0200 Message-Id: <20221021130252.176316-4-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221021130252.176316-1-f.ebner@proxmox.com> References: <20221021130252.176316-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_SHORT 0.001 Use of a URL Shortener for very short URL SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, architecture.mk, gnu.org, pkg-info.mk] Subject: [pve-devel] [PATCH proxmox-mail-forward 2/3] add Debian packaging X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2022 13:03:05 -0000 It is a setuid binary owned by root, since the initial step of reading the configuration files on both PVE and PBS requires higher privileges which can't be mapped easily otherwise. Used parts of the packaging in proxmox-backup as a basis. Signed-off-by: Fiona Ebner --- .gitignore | 5 +++ Makefile | 73 ++++++++++++++++++++++++++++++++++++++++ debian/changelog | 5 +++ debian/compat | 1 + debian/control | 30 +++++++++++++++++ debian/copyright | 16 +++++++++ debian/lintian-overrides | 2 ++ debian/rules | 18 ++++++++++ 8 files changed, 150 insertions(+) create mode 100644 Makefile create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/lintian-overrides create mode 100755 debian/rules diff --git a/.gitignore b/.gitignore index 1e7caa9..3bee320 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ Cargo.lock target/ +proxmox-mail-forward-*/ +*proxmox-mail-forward*.buildinfo +*proxmox-mail-forward*.tar.?z +*proxmox-mail-forward*.changes +*proxmox-mail-forward*.deb diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..89e7843 --- /dev/null +++ b/Makefile @@ -0,0 +1,73 @@ +include /usr/share/dpkg/pkg-info.mk +include /usr/share/dpkg/architecture.mk + +PACKAGE=proxmox-mail-forward +BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM) +BUILDDIR_TMP ?= $(BUILDDIR).tmp + +ifeq ($(BUILD_MODE), release) +CARGO_BUILD_ARGS += --release +COMPILEDIR := target/release +else +COMPILEDIR := target/debug +endif + +CARGO ?= cargo + +DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_BUILD_ARCH).deb +DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_BUILD_ARCH).deb +DSC=rust-$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc + +DEBS=$(DEB) $(DBG_DEB) + +.PHONY: build +build: + @echo "Setting Cargo.toml version to: $(DEB_VERSION_UPSTREAM)" + sed -i -e 's/^version =.*$$/version = "$(DEB_VERSION_UPSTREAM)"/' Cargo.toml + rm -rf $(BUILDDIR) $(BUILDDIR_TMP); mkdir $(BUILDDIR_TMP) + cp -a debian \ + Cargo.toml src \ + Makefile \ + $(BUILDDIR_TMP) + rm -f $(BUILDDIR_TMP)/Cargo.lock + find $(BUILDDIR_TMP)/debian -name "*.hint" -delete + mv $(BUILDDIR_TMP) $(BUILDDIR) + +.PHONY: deb +$(DEBS): deb +deb: build + cd $(BUILDDIR); dpkg-buildpackage -b -us -uc --no-pre-clean + lintian $(DEBS) + +.PHONY: dsc +dsc: $(DSC) +$(DSC): build + cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d -nc + lintian $(DSC) + +.PHONY: dinstall +dinstall: $(DEBS) + dpkg -i $(DEBS) + +.PHONY: cargo-build +cargo-build: + $(CARGO) build $(CARGO_BUILD_ARGS) \ + --package proxmox-mail-forward \ + --bin proxmox-mail-forward + +install: cargo-build + install -dm755 $(DESTDIR)/usr/bin + install -m4755 -o root -g root $(COMPILEDIR)/proxmox-mail-forward $(DESTDIR)/usr/bin/proxmox-mail-forward + +.PHONY: upload +upload: $(DEBS) + tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com -- upload --product "pve,pbs" --dist bullseye --arch $(DEB_BUILD_ARCH) + +.PHONY: distclean +distclean: clean + +.PHONY: clean +clean: + cargo clean + rm -rf *.deb *.buildinfo *.changes *.dsc rust-$(PACKAGE)_*.tar.?z $(BUILDDIR) $(BUILDDIR_TMP) + find . -name '*~' -exec rm {} ';' diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..cb9cc94 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +rust-proxmox-mail-forward (0.1.0-1) stable; urgency=medium + + * Initial release. + + -- Proxmox Support Team Thu, 20 Oct 2022 11:28:37 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +12 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..72e00ff --- /dev/null +++ b/debian/control @@ -0,0 +1,30 @@ +Source: rust-proxmox-mail-forward +Section: rust +Priority: optional +Build-Depends: debhelper (>= 12), + cargo:native, + rustc:native, + libstd-rust-dev, + librust-anyhow-1+default-dev, + librust-log-0.4+default-dev (>= 0.4.17-~~), + librust-nix-0.24+default-dev, + librust-proxmox-schema-1+default-dev (>= 1.3.4-~~), + librust-proxmox-section-config-1+default-dev, + librust-proxmox-sys-0.4+default-dev, + librust-serde-1+default-dev, + librust-serde-1+derive-dev, + librust-syslog-4+default-dev +Maintainer: Proxmox Support Team +Standards-Version: 4.5.1 +Vcs-Git: git://git.proxmox.com/git/proxmox-mail-forward.git +Vcs-Browser: https://git.proxmox.com/?p=proxmox-mail-forward.git +Homepage: https://www.proxmox.com +Rules-Requires-Root: binary-targets + +Package: proxmox-mail-forward +Architecture: any +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Description: Proxmox mail forward helper + This package contains the Proxmox mail forward helper. It forwards mails to the + address(es) of the root@pam user in Proxmox Backup Server and Proxmox VE. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..d2d30fc --- /dev/null +++ b/debian/copyright @@ -0,0 +1,16 @@ +Copyright (C) 2022 Proxmox Server Solutions GmbH + +This software is written by Proxmox Server Solutions GmbH + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . diff --git a/debian/lintian-overrides b/debian/lintian-overrides new file mode 100644 index 0000000..bdd0599 --- /dev/null +++ b/debian/lintian-overrides @@ -0,0 +1,2 @@ +proxmox-mail-forward: no-manual-page usr/bin/proxmox-mail-forward +proxmox-mail-forward: setuid-binary usr/bin/proxmox-mail-forward 4755 root/root diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..0e5f66c --- /dev/null +++ b/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +DH_VERBOSE = 1 + +export BUILD_MODE=release + +CARGO=/usr/share/cargo/bin/cargo + +export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS +export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE +export CARGO_HOME = $(CURDIR)/debian/cargo_home + +%: + dh $@ + +override_dh_fixperms: + dh_fixperms --exclude proxmox-mail-forward -- 2.30.2