diff --git a/mod_security_crs.spec b/mod_security_crs.spec index e09e6ae..1197e07 100644 --- a/mod_security_crs.spec +++ b/mod_security_crs.spec @@ -40,17 +40,19 @@ mv crs-setup.conf.example %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/crs-set %post # activate base_rules -for f in `ls %{buildroot}%{_datarootdir}/mod_modsecurity_crs/rules/` ; do - ln -s %{_datarootdir}/mod_modsecurity_crs/rules/$f %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f; +for f in `ls %{_datarootdir}/mod_modsecurity_crs/rules/` ; do + ln -s %{_datarootdir}/mod_modsecurity_crs/rules/$f %{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f; done -sed '/Include(Optional)? modsecurity.d\/\*\.conf/a\tInclude$1 modsecurity.d/plugins/*-config.conf\n\tInclude$1 modsecurity.d/plugins/*-before.conf' %{_httpd_confdir}/mod_security.conf -sed '/Include(Optional)? modsecurity.d\/local_rules\/\*\.conf/a\tInclude$1 modsecurity.d/plugins/*-after.conf' %{_httpd_confdir}/mod_security.conf +sed -i '/IncludeOptional modsecurity\.d\/\*\.conf/ a\ IncludeOptional modsecurity.d\/plugins\/*-config.conf\n IncludeOptional modsecurity.d\/plugins\/*-before.conf' %{_httpd_confdir}/mod_security.conf +sed -i '/Include modsecurity\.d\/\*\.conf/a\ Include modsecurity.d/plugins/*-config.conf\n Include modsecurity.d/plugins/*-before.conf' %{_httpd_confdir}/mod_security.conf +sed -i '/IncludeOptional modsecurity\.d\/local_rules\/\*\.conf/a\ IncludeOptional modsecurity.d\/plugins\/*-after.conf' %{_httpd_confdir}/mod_security.conf +sed -i '/Include modsecurity\.d\/local_rules\/\*\.conf/a\ Include modsecurity.d\/plugins\/*-after.conf' %{_httpd_confdir}/mod_security.conf %postun -sed '/Include(Optional)? modsecurity.d\/plugins/d' %{_httpd_confdir}/mod_security.conf -for f in `ls %{buildroot}%{_datarootdir}/mod_modsecurity_crs/rules/` ; do - %{__rm} %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f; +sed -iE '/Include(Optional)? modsecurity.d\/plugins/d' %{_httpd_confdir}/mod_security.conf +for f in `ls %{_datarootdir}/mod_modsecurity_crs/rules/` ; do + %{__rm} %{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f; done %files