From 74b96ce31d671a5ced10f45e0370240b97319807 Mon Sep 17 00:00:00 2001 From: lixin Date: Mon, 18 Mar 2024 11:23:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0spec=E6=96=87=E4=BB=B6,?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E9=97=AD=E6=9C=8D=E5=8A=A1=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-kill-not-kill-INT-when-stop-service.patch | 25 +++++++ ...24-24892.patch => 100-CVE-2024-24892.patch | 0 migration-tools.spec | 69 +++++++++---------- 3 files changed, 58 insertions(+), 36 deletions(-) create mode 100644 0001-use-kill-not-kill-INT-when-stop-service.patch rename 0001-CVE-2024-24892.patch => 100-CVE-2024-24892.patch (100%) diff --git a/0001-use-kill-not-kill-INT-when-stop-service.patch b/0001-use-kill-not-kill-INT-when-stop-service.patch new file mode 100644 index 0000000..d513653 --- /dev/null +++ b/0001-use-kill-not-kill-INT-when-stop-service.patch @@ -0,0 +1,25 @@ +From 192fd69de19a78afe81a5a2c5a8270057f12ee3d Mon Sep 17 00:00:00 2001 +From: lixin +Date: Mon, 18 Mar 2024 10:32:17 +0800 +Subject: [PATCH] use kill instead of kill-INT + +--- + server/migration-tools-server.service | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/server/migration-tools-server.service b/server/migration-tools-server.service +index 8cd53a3..dd16c95 100644 +--- a/server/migration-tools-server.service ++++ b/server/migration-tools-server.service +@@ -5,7 +5,7 @@ After=network-online.target + [Service] + Type=simple + ExecStart=/usr/bin/python3 /usr/lib/migration-tools-server/index.py +-ExecStop=/bin/kill-INT $MAINPID ++ExecStop=/bin/kill -HUP $MAINPID + + [Install] + WantedBy=multi-user.target +-- +2.41.0 + diff --git a/0001-CVE-2024-24892.patch b/100-CVE-2024-24892.patch similarity index 100% rename from 0001-CVE-2024-24892.patch rename to 100-CVE-2024-24892.patch diff --git a/migration-tools.spec b/migration-tools.spec index 9d9dfa4..75dd6a8 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,17 +1,20 @@ -Name: migration-tools -Version: 1.0.1 -Release: 2 -License: MulanPSL-2.0 -Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system - -Source0: migration-tools.tar.gz -Source1: requires.tar.gz -Source2: xlwt-1.3.0-py2.py3-none-any.whl +%define __python /usr/bin/python3 + +Name: migration-tools +Version: 1.0.1 +Release: 3 +License: MulanPSL-2.0 +Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system +Source0: migration-tools.tar.gz +Source1: requires.tar.gz +Source2: xlwt-1.3.0-py2.py3-none-any.whl +# patches +Patch0: 0001-use-kill-not-kill-INT-when-stop-service.patch # CVE patches: >= 100 -Patch100: 0001-CVE-2024-24892.patch +Patch100: 100-CVE-2024-24892.patch -BuildArch: noarch +BuildArch: noarch %description UOS Migration Software @@ -40,6 +43,7 @@ Summary: migration-tools-server License: MulanPSL-2.0 Requires: python3 Requires: python3-pip +Requires: sshpass Requires: python3-paramiko Requires: python3-flask Requires: python3-requests @@ -51,7 +55,7 @@ Migration software server side %prep %setup -c -# cve patches +%patch 0 -p1 %patch 100 -p1 %if 0%{?openEuler} @@ -64,60 +68,53 @@ rm -rf %{buildroot} mkdir -p $RPM_BUILD_ROOT/usr/lib/migration-tools-server mkdir -p $RPM_BUILD_ROOT/var/tmp/uos-migration mkdir -p $RPM_BUILD_ROOT/etc/migration-tools +mkdir -p $RPM_BUILD_ROOT%{_unitdir} cp -r * $RPM_BUILD_ROOT/usr/lib/migration-tools-server/ %if 0%{?rhel} >= 7 mkdir -p $RPM_BUILD_ROOT/usr/lib/migration-tools-agent cp -r * $RPM_BUILD_ROOT/usr/lib/migration-tools-agent/ +%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools-agent.service $RPM_BUILD_ROOT%{_unitdir} %endif # Install server config %{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools.conf $RPM_BUILD_ROOT/etc/migration-tools +%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools-server.service $RPM_BUILD_ROOT%{_unitdir} +%posttrans +%{_bindir}/systemctl daemon-reload %post -n migration-tools-server pip3 install /usr/lib/migration-tools-server/agent-requires/xlwt-1.3.0-py2.py3-none-any.whl --no-cache-dir -mkdir -p /etc/migration-tools -mkdir -p /var/tmp/uos-migration -cp -r /usr/lib/migration-tools-server/server/migration-tools-server.service /usr/lib/systemd/system/ chmod +x /usr/lib/migration-tools-server/server/start_webview.sh -ln -s /usr/lib/migration-tools-server/server/start_webview.sh /usr/bin/migration-tools -systemctl daemon-reload -systemctl restart migration-tools-server.service -systemctl enable migration-tools-server.service +ln -sf /usr/lib/migration-tools-server/server/start_webview.sh /usr/bin/migration-tools -%if 0%{?rhel} >= 7 -%post -n migration-tools-agent -mkdir -p /etc/migration-tools -mkdir -p /var/tmp/uos-migration -cp -r /usr/lib/migration-tools-agent/server/migration-tools-agent.service /usr/lib/systemd/system/ -systemctl daemon-reload -%endif +%preun -n migration-tools-server +if [ $1 = 0 ];then + systemctl stop migration-tools-server.service +fi %postun -n migration-tools-server -systemctl disable migration-tools-server.service -rm -rf /usr/lib/migration-tools-server/ -rm -rf /usr/lib/migration-tools -rm -rf /usr/bin/migration-tools - -%if 0%{?rhel} >= 7 -%postun -n migration-tools-agent -rm -rf /usr/lib/migration-tools-agent/ -rm -rf /usr/lib/migration-tools rm -rf /usr/bin/migration-tools -%endif %files -n migration-tools-server /etc/migration-tools /usr/lib/migration-tools-server +%{_unitdir}/migration-tools-server.service %if 0%{?rhel} >= 7 %files -n migration-tools-agent +/etc/migration-tools /usr/lib/migration-tools-agent +%{_unitdir}/migration-tools-agent.service %endif %changelog +* Mon Mar 18 2024 lixin - 1.0.1-3 +- fix stop service display failed +- update spec + * Mon Mar 11 2024 lixin - 1.0.1-2 - fix : CVE-2024-24892 - use paramiko instead of sshpass to export migration log -- Gitee From 36ffb10ef1e3624664e7aaf0eb79ec85a4b3eab6 Mon Sep 17 00:00:00 2001 From: lixin Date: Mon, 18 Mar 2024 14:05:20 +0800 Subject: [PATCH 2/3] remove require: sshpass --- migration-tools.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/migration-tools.spec b/migration-tools.spec index 75dd6a8..7cf4e30 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -43,7 +43,6 @@ Summary: migration-tools-server License: MulanPSL-2.0 Requires: python3 Requires: python3-pip -Requires: sshpass Requires: python3-paramiko Requires: python3-flask Requires: python3-requests -- Gitee From eda59edc9d6f506167aad4a8e59e775c84f907a6 Mon Sep 17 00:00:00 2001 From: lixin Date: Mon, 18 Mar 2024 14:40:02 +0800 Subject: [PATCH 3/3] remove python3 --- migration-tools.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration-tools.spec b/migration-tools.spec index 7cf4e30..eb974e2 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,5 +1,3 @@ -%define __python /usr/bin/python3 - Name: migration-tools Version: 1.0.1 Release: 3 -- Gitee