!8 [sync] PR-7: 添加blackbox_exporter的安全编译选项strip和pie

From: @openeuler-sync-bot 
Reviewed-by: @yangzhao_kl 
Signed-off-by: @yangzhao_kl
This commit is contained in:
openeuler-ci-bot 2023-03-07 01:21:25 +00:00 committed by Gitee
commit fa3a201917
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,20 @@
diff -Nur a/.promu.yml b/.promu.yml
--- a/.promu.yml 2023-02-09 14:54:47.876832158 +0800
+++ b/.promu.yml 2023-02-09 14:56:28.322288215 +0800
@@ -7,11 +7,11 @@
build:
flags: -a -tags netgo
ldflags: |
- -X github.com/prometheus/common/version.Version={{.Version}}
- -X github.com/prometheus/common/version.Revision={{.Revision}}
- -X github.com/prometheus/common/version.Branch={{.Branch}}
- -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
- -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.Version={{.Version}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.Revision={{.Revision}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.Branch={{.Branch}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
tarball:
files:
- blackbox.yml

View File

@ -2,13 +2,14 @@
%define debug_package %{nil}
Name: blackbox_exporter
Version: 0.23.0
Release: 1
Release: 2
Summary: Prometheus blackbox prober exporter
License: Apache-2.0
URL: https://github.com/prometheus/blackbox_exporter
Source0: https://github.com/prometheus/blackbox_exporter/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: %{name}.service
Source2: vendor.tar.gz
Patch0: add-parameters-to-solve-the-strip.patch
BuildRequires: golang promu
Requires(pre): prometheus2
%description
@ -17,6 +18,7 @@ The blackbox exporter allows blackbox probing of endpoints over HTTP, HTTPS, DNS
%prep
%setup -q -n %{name}-%{version}
tar xvf %{SOURCE2} -C .
%patch0 -p1
%build
export GOFLAGS="-mod=vendor"
@ -41,6 +43,9 @@ install -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/prometheus/blackbox.yml
%changelog
* Thu Mar 02 2023 wulei <wulei80@h-partners.com> - 0.23.0-2
- Add strip and pie
* Tue Jan 31 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 0.23.0-1
- Update package to version 0.23.0