Add missing requires to auoms package (#369)

* Clean auoms.spec with linter feedback

* Add missing requirements to auoms
This commit is contained in:
Daniel McIlvaney 2020-11-13 12:40:36 -08:00 коммит произвёл GitHub
Родитель 717eb55dcf
Коммит fc79645dec
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 64 добавлений и 55 удалений

Просмотреть файл

@ -1,10 +1,12 @@
%define debug_package %{nil}
Summary: Auditd plugin that forwards audit events to OMS Agent for Linux
Name: auoms
Version: 2.2.5
Release: 2%{?dist}
Release: 4%{?dist}
License: MIT
Vendor: Microsoft Corporation
Distribution: Mariner
Group: Applications/System
URL: https://github.com/microsoft/OMS-Auditd-Plugin
#Source0: https://github.com/microsoft/OMS-Auditd-Plugin/archive/v2.2.5-0.tar.gz
Source0: %{name}-%{version}.tar.gz
@ -15,30 +17,28 @@ Source2: msgpack-c-cpp-2.0.0.zip
#Source3: https://github.com/Tencent/rapidjson/archive/v1.0.2.tar.gz
Source3: rapidjson-1.0.2.tar.gz
Patch0: auoms.patch
Group: Applications/System
Vendor: Microsoft Corporation
Distribution: Mariner
BuildRequires: unzip
BuildRequires: cmake
BuildRequires: wget
BuildRequires: sudo
BuildRequires: grep
BuildRequires: sed
BuildRequires: audit-devel
BuildRequires: bash
BuildRequires: bash-devel
BuildRequires: audit-devel
BuildRequires: boost-devel
BuildRequires: cmake
BuildRequires: grep
BuildRequires: python2
BuildRequires: python2-devel
BuildRequires: sed
BuildRequires: sudo
BuildRequires: unzip
BuildRequires: wget
Requires: audit
Requires: sudo
Requires: bash
Requires: sed
Requires: chkconfig
Requires: glibc
Requires: initscripts
Requires: libstdc++
Requires: perl
Requires: glibc
Requires: procps-ng
Requires: sed
Requires: sudo
%description
OMS Audit data collection daemon
@ -53,8 +53,8 @@ cp %{SOURCE3} ./
%build
grep AUOMS_BUILDVERSION auoms.version | head -n 4 | cut -d'=' -f2 | tr '\n' '.' | sed 's/.$//' | sed 's/^/#define AUOMS_VERSION "/' > auoms_version.h
sed -i 's/$/"/' auoms_version.h
cp -R /usr/include/boost /usr/local/include/boost
mv /usr/include/boost /usr/include/boost148
cp -R %{_includedir}/boost /usr/local/include/boost
mv %{_includedir}/boost /usr/include/boost148
cd build
./configure --enable-ulinux && make clean && make
@ -65,11 +65,11 @@ install -vdm 755 %{buildroot}%{_sysconfdir}/opt/microsoft/auoms/outconf.d
install -vdm 755 %{buildroot}%{_sysconfdir}/opt/microsoft/auoms/rules.d
install -vdm 755 %{buildroot}/opt/microsoft/auoms
install -vdm 755 %{buildroot}/opt/microsoft/auoms/bin
install -vdm 755 %{buildroot}/usr/share/selinux/packages/auoms
install -vdm 750 %{buildroot}/var/opt/microsoft/auoms/data
install -vdm 750 %{buildroot}/var/opt/microsoft/auoms/data/outputs
install -vdm 755 %{buildroot}%{_datadir}/selinux/packages/auoms
install -vdm 750 %{buildroot}%{_var}/opt/microsoft/auoms/data
install -vdm 750 %{buildroot}%{_var}/opt/microsoft/auoms/data/outputs
install -m 644 intermediate/selinux/* %{buildroot}/usr/share/selinux/packages/auoms
install -m 644 intermediate/selinux/* %{buildroot}%{_datadir}/selinux/packages/auoms
install -m 555 installer/auoms.init %{buildroot}%{_sysconfdir}/init.d/auoms
install -m 644 installer/conf/auoms.conf %{buildroot}%{_sysconfdir}/opt/microsoft/auoms
install -m 644 installer/conf/auomscollect.conf %{buildroot}%{_sysconfdir}/opt/microsoft/auoms
@ -82,25 +82,25 @@ install -m 755 intermediate/builddir/release/bin/auoms %{buildroot}/opt
install -m 755 intermediate/builddir/release/bin/auomsctl %{buildroot}/opt/microsoft/auoms/bin
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
%pre
#!/bin/sh
if [ $1 -gt 1 ] ; then
if [ -e /etc/audisp/plugins.d/auoms.conf ]; then
if [ -e %{_sysconfdir}/audisp/plugins.d/auoms.conf ]; then
echo "Pre: found etc/audisp/plugins.d/auoms.conf"
if [ -e /etc/audisp/plugins.d/auoms.conf.auomssave ]; then
rm /etc/audisp/plugins.d/auoms.conf.auomssave
if [ -e %{_sysconfdir}/audisp/plugins.d/auoms.conf.auomssave ]; then
rm %{_sysconfdir}/audisp/plugins.d/auoms.conf.auomssave
fi
cp -p /etc/audisp/plugins.d/auoms.conf /etc/audisp/plugins.d/auoms.conf.auomssave
cp -p %{_sysconfdir}/audisp/plugins.d/auoms.conf %{_sysconfdir}/audisp/plugins.d/auoms.conf.auomssave
fi
if [ -e /etc/audit/plugins.d/auoms.conf ]; then
if [ -e %{_sysconfdir}/audit/plugins.d/auoms.conf ]; then
echo "Pre: found etc/audit/plugins.d/auoms.conf"
if [ -e /etc/audit/plugins.d/auoms.conf.auomssave ]; then
rm /etc/audit/plugins.d/auoms.conf.auomssave
if [ -e %{_sysconfdir}/audit/plugins.d/auoms.conf.auomssave ]; then
rm %{_sysconfdir}/audit/plugins.d/auoms.conf.auomssave
fi
cp -p /etc/audit/plugins.d/auoms.conf /etc/audit/plugins.d/auoms.conf.auomssave
cp -p %{_sysconfdir}/audit/plugins.d/auoms.conf %{_sysconfdir}/audit/plugins.d/auoms.conf.auomssave
fi
fi
@ -117,24 +117,24 @@ fi
SERVICEDIR=/opt/microsoft/auoms
if [ $1 -gt 1 ] ; then
if [ -e /etc/audisp/plugins.d/auoms.conf.auomssave ]; then
echo "Post: found /etc/audisp/plugins.d/auoms.conf"
if [ -e /etc/audisp/plugins.d/auoms.conf ]; then
rm /etc/audisp/plugins.d/auoms.conf
if [ -e %{_sysconfdir}/audisp/plugins.d/auoms.conf.auomssave ]; then
echo "Post: found %{_sysconfdir}/audisp/plugins.d/auoms.conf"
if [ -e %{_sysconfdir}/audisp/plugins.d/auoms.conf ]; then
rm %{_sysconfdir}/audisp/plugins.d/auoms.conf
fi
cp -p /etc/audisp/plugins.d/auoms.conf.auomssave /etc/audisp/plugins.d/auoms.conf
cp -p %{_sysconfdir}/audisp/plugins.d/auoms.conf.auomssave %{_sysconfdir}/audisp/plugins.d/auoms.conf
fi
if [ -e /etc/audit/plugins.d/auoms.conf.auomssave ]; then
echo "Post: found /etc/audit/plugins.d/auoms.conf"
if [ -e /etc/audit/plugins.d/auoms.conf ]; then
rm /etc/audit/plugins.d/auoms.conf
if [ -e %{_sysconfdir}/audit/plugins.d/auoms.conf.auomssave ]; then
echo "Post: found %{_sysconfdir}/audit/plugins.d/auoms.conf"
if [ -e %{_sysconfdir}/audit/plugins.d/auoms.conf ]; then
rm %{_sysconfdir}/audit/plugins.d/auoms.conf
fi
cp -p /etc/audit/plugins.d/auoms.conf.auomssave /etc/audit/plugins.d/auoms.conf
cp -p %{_sysconfdir}/audit/plugins.d/auoms.conf.auomssave %{_sysconfdir}/audit/plugins.d/auoms.conf
fi
echo "Post: executing upgrade"
/opt/microsoft/auoms/bin/auomsctl upgrade
fi
for dir in /usr/lib/systemd/system /lib/systemd/system; do
for dir in %{_lib}/systemd/system /lib/systemd/system; do
if [ -e $dir ]; then
install -m 644 ${SERVICEDIR}/auoms.service $dir
systemctl enable auoms.service
@ -142,20 +142,20 @@ for dir in /usr/lib/systemd/system /lib/systemd/system; do
fi
done
sudo /opt/microsoft/auoms/bin/auomsctl enable
rm -f /etc/audisp/plugins.d/auoms.conf.*
rm -f /etc/audit/plugins.d/auoms.conf.*
rm -f %{_sysconfdir}/audisp/plugins.d/auoms.conf.*
rm -f %{_sysconfdir}/audit/plugins.d/auoms.conf.*
%postun
#!/bin/sh
if [ $1 -eq 0 ]; then
rm -f /etc/audisp/plugins.d/auoms.conf*
rm -f /etc/audit/plugins.d/auoms.conf*
rm -f %{_sysconfdir}/audisp/plugins.d/auoms.conf*
rm -f %{_sysconfdir}/audit/plugins.d/auoms.conf*
rm -rf -v /etc/opt/microsoft/auoms
rm -rf -v /var/opt/microsoft/auoms
rm -rf -v %{_sysconfdir}/opt/microsoft/auoms
rm -rf -v %{_var}/opt/microsoft/auoms
fi
for dir in /usr/lib/systemd/system /lib/systemd/system; do
for dir in %{_lib}/systemd/system /lib/systemd/system; do
if [ -e ${dir}/auoms.service ]; then
systemctl disable auoms.service
rm -f ${dir}/auoms.service
@ -165,8 +165,8 @@ done
%files
%defattr(-,root,root)
/usr/share/selinux/packages/auoms
/usr/share/selinux/packages/auoms/*
%{_datadir}/selinux/packages/auoms
%{_datadir}/selinux/packages/auoms/*
%{_sysconfdir}/init.d/auoms
%{_sysconfdir}/opt/microsoft/auoms
%{_sysconfdir}/opt/microsoft/auoms/auoms.conf
@ -182,12 +182,21 @@ done
/opt/microsoft/auoms/bin/auomscollect
/opt/microsoft/auoms/bin/auoms
/opt/microsoft/auoms/bin/auomsctl
/var/opt/microsoft/auoms
/var/opt/microsoft/auoms/data
/var/opt/microsoft/auoms/data/outputs
%{_var}/opt/microsoft/auoms
%{_var}/opt/microsoft/auoms/data
%{_var}/opt/microsoft/auoms/data/outputs
%changelog
* Wed Nov 11 2020 Daniel McIlvaney <damcilva@microsoft.com> - 2.2.5-4
- Add dependnecy on chkconfig to avoid ownership conflict with /etc/init.d directory
- Add dependency on procps-ng so auomsctl can use pgrep
- Add dependnecy on initscripts so auomsctl can use /usr/sbin/service
* Wed Nov 11 2020 Daniel McIlvaney <damcilva@microsoft.com> - 2.2.5-3
- Clean up spec file with feedback from linter
* Sat Oct 24 2020 Andrew Phelps <anphel@microsoft.com> 2.2.5-2
- Fix setup macro
* Thu Oct 22 2020 Andrew Phelps <anphel@microsoft.com> 2.2.5-1
- Initial CBL-Mariner version.