Tareas #101
Generar el primer spec
| Status: | Resuelta | Start date: | 12/26/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | 01/15/2010 | |
| Assignee: | % Done: | 100% |
||
| Category: | Desarrollo | |||
| Target version: | 1.0.6 |
Description
Adaptar el .spec provisto por el src.rpm para que sea aceptable para Fedora. Se deben usar los paquetes Fedora para las dependencias.
perl-Net-IPv4Addr perl-IPTables-Parse
History
Updated by Guillermo Gómez about 2 years ago
Después de unos primeros cambios al intentar construir mi rpm:
+ cd deps
/var/tmp/rpm-tmp.K2ICWb: line 37: cd: deps: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.K2ICWb (%prep)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.K2ICWb (%prep)
Al parecer está intentando cambiar a un directorio inexistente, esto debe ser porque estoy usando los fuentes "nodeps". Hay que arreglar la etapa %prep.
Updated by Guillermo Gómez about 2 years ago
Después de unas tantas modificaciones más:
+ cd deps
/var/tmp/rpm-tmp.hFeiX4: line 30: cd: deps: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.hFeiX4 (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.hFeiX4 (%build)
Toca ahora arreglar la etapa %build.
Updated by Guillermo Gómez about 2 years ago
Se sigue repitiendo el problema, ahora en la etapa %install:
+ cd deps /var/tmp/rpm-tmp.XR9EP2: line 55: cd: deps: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.XR9EP2 (%install)
Updated by Guillermo Gómez about 2 years ago
Ahora se complica un poco más la cosa ya que parece que en /deps vienen las reglas snort que el paquete original instala, digamos que no instalamos la reglas, por ahora.
cp: cannot stat `deps/snort_rules': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.yquVGJ (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.yquVGJ (%install)
Updated by Guillermo Gómez about 2 years ago
- Status changed from En Progreso to Resuelta
- % Done changed from 0 to 50
Después de un rato más, ya tengo un primer rpm resultado, se quedaron por fueran las reglas snort. Voy a realizarle ciertas pruebas a ver qué me reportan las herramientas.
[makerpm@fricky SPECS]$ rpmlint fwsnort.spec fwsnort.spec:16: W: non-standard-group System/Servers fwsnort.spec:51: W: rpm-buildroot-usage %prep [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT fwsnort.spec: W: no-cleaning-of-buildroot %install 0 packages and 1 specfiles checked; 0 errors, 3 warnings.
Updated by Guillermo Gómez about 2 years ago
Ajustado .spec me quito un alerta de rpmlint.
Group: System Environment/Daemons
Updated by Guillermo Gómez about 2 years ago
rpmlint me da algo más de información:
[makerpm@fricky SPECS]$ rpmlint -i fwsnort.spec fwsnort.spec:51: W: rpm-buildroot-usage %prep [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT $RPM_BUILD_ROOT should not be touched during %build or %prep stage, as it may break short circuit builds. fwsnort.spec: W: no-cleaning-of-buildroot %install You should clean $RPM_BUILD_ROOT in the %clean section and in the beginning of the %install section. Use "rm -rf $RPM_BUILD_ROOT". Some rpm configurations do this automatically; if your package is only going to be built in such configurations, you can ignore this warning for the section(s) where your rpm takes care of it. 0 packages and 1 specfiles checked; 0 errors, 2 warnings.
Updated by Guillermo Gómez about 2 years ago
- % Done changed from 50 to 60
Limpieza al comenzar %install me quita otra alerta.
%install rm -rf $RPM_BUILD_ROOT ...
Removí la referencia de limpieza de RPM_BUILD_ROOT en %prep. No más alertas de rpmlint.
[makerpm@fricky SPECS]$ rpmlint fwsnort.spec 0 packages and 1 specfiles checked; 0 errors, 0 warnings.
Updated by Guillermo Gómez about 2 years ago
Ahora rpmlint sobre el rpm:
[makerpm@fricky rpmbuild]$ rpmlint RPMS/i686/fwsnort-1.0.6-1.i686.rpm fwsnort.i686: W: name-repeated-in-summary Fwsnort fwsnort.i686: W: no-version-in-last-changelog fwsnort.i686: W: invalid-license GPL fwsnort.i686: E: no-binary fwsnort.i686: E: non-readable /usr/sbin/fwsnort 0500 fwsnort.i686: E: non-standard-executable-perm /usr/sbin/fwsnort 0500 fwsnort.i686: W: log-files-without-logrotate /var/log/fwsnort 1 packages and 0 specfiles checked; 3 errors, 4 warnings.
Ajuste en Summary removiendo Fwsnort:
[makerpm@fricky rpmbuild]$ rpmlint RPMS/i686/fwsnort-1.0.6-1.i686.rpm fwsnort.i686: W: summary-not-capitalized translates Snort rules into equivalent iptables rules fwsnort.i686: W: no-version-in-last-changelog fwsnort.i686: W: invalid-license GPL fwsnort.i686: E: no-binary fwsnort.i686: E: non-readable /usr/sbin/fwsnort 0500 fwsnort.i686: E: non-standard-executable-perm /usr/sbin/fwsnort 0500 fwsnort.i686: W: log-files-without-logrotate /var/log/fwsnort 1 packages and 0 specfiles checked; 3 errors, 4 warnings.
La primera letra en Summary debe estar en mayúscula. De lo de la licencia, revise http://fedoraproject.org/wiki/Licensing para ver cuál nombre es válido (GPL solo NO lo es). Viendo en los fuentes de fwsnort, asi comienza la licencia suministrada por el autor, entonces voy a usar GPLv2.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
...
Asi van mis pruebas rpmlint:
[makerpm@fricky rpmbuild]$ rpmlint RPMS/i686/fwsnort-1.0.6-1.i686.rpm fwsnort.i686: W: no-version-in-last-changelog fwsnort.i686: E: no-binary fwsnort.i686: E: non-readable /usr/sbin/fwsnort 0500 fwsnort.i686: E: non-standard-executable-perm /usr/sbin/fwsnort 0500 fwsnort.i686: W: log-files-without-logrotate /var/log/fwsnort 1 packages and 0 specfiles checked; 3 errors, 2 warnings.
Updated by Guillermo Gómez about 2 years ago
Al querer incluir:
BuildArch: noarch
Tengo una regresión ahora con el .spec:
[makerpm@fricky rpmbuild]$ rpmlint SPECS/fwsnort.spec SPECS/fwsnort.spec:104: W: libdir-macro-in-noarch-package (main package) %_libdir/%name 0 packages and 1 specfiles checked; 0 errors, 1 warnings.
Updated by Guillermo Gómez about 2 years ago
Guillermo Gómez escribió:
Al querer incluir:
[...]
Tengo una regresión ahora con el .spec:
[...]
Algo que no noté antes es que el RPM era para i686 cuando eso no tiene sentido ya que fwsnort es un noarch. Removi dichos rpms y construí nuevamente.
Updated by Guillermo Gómez about 2 years ago
Asi van mis pruebas rpmlint:
[makerpm@fricky rpmbuild]$ rpmlint RPMS/noarch/fwsnort-1.0.6-1.noarch.rpm fwsnort.noarch: W: no-version-in-last-changelog fwsnort.noarch: E: non-readable /usr/sbin/fwsnort 0500 fwsnort.noarch: E: non-standard-executable-perm /usr/sbin/fwsnort 0500 fwsnort.noarch: W: log-files-without-logrotate /var/log/fwsnort 1 packages and 0 specfiles checked; 2 errors, 2 warnings. [makerpm@fricky rpmbuild]$ rpmlint SPECS/fwsnort.spec SPECS/fwsnort.spec:104: W: libdir-macro-in-noarch-package (main package) %_libdir/%name 0 packages and 1 specfiles checked; 0 errors, 1 warnings.
Updated by Guillermo Gómez about 2 years ago
A la carga con otra herramienta rpm para reparar lo de la versión y el changelog:
[makerpm@fricky SPECS]$ rpmdev-bumpspec --comment="First Fedora spec compliant version, several modifications" --userstring="Guillermo Gómez guillermo.gomez@gmail.com" fwsnort.spec
Quedando el .spec:
... %changelog * Sat Dec 26 2009 Guillermo Gómez <guillermo.gomez@gmail.com> - 1.0.6-1 - First Fedora spec compliant version, several modifications * Sat May 29 2009 Michael Rash <mbr@cipherydne.org> - Added the "BuildRequires: perl-ExtUtils-MakeMaker" statement. - fwsnort-1.0.6 release ...
Y así vamos:
[makerpm@fricky rpmbuild]$ rpmlint RPMS/noarch/fwsnort-1.0.6-1.noarch.rpm fwsnort.noarch: E: non-readable /usr/sbin/fwsnort 0500 fwsnort.noarch: E: non-standard-executable-perm /usr/sbin/fwsnort 0500 fwsnort.noarch: W: log-files-without-logrotate /var/log/fwsnort 1 packages and 0 specfiles checked; 2 errors, 1 warnings. [makerpm@fricky rpmbuild]$ rpmlint SPECS/fwsnort.spec SPECS/fwsnort.spec:104: W: libdir-macro-in-noarch-package (main package) %_libdir/%name 0 packages and 1 specfiles checked; 0 errors, 1 warnings.
Updated by Guillermo Gómez about 2 years ago
- Status changed from Resuelta to En Progreso
Me deshice de
%_libdir/%name
en la sección %files, pendiente ya que eso es /usr/lib en general y no sé a qué se debe el error, por lo pronto mi paquete realmente no incluye nada allí, asi que lo puedo remover sin mayores problemas (por ahora).
Updated by Guillermo Gómez about 2 years ago
- % Done changed from 60 to 70
De los permisos del ejecutable, ajusté, de 0500 a 0755:
... install -m 755 fwsnort $RPM_BUILD_ROOT%_sbindir/ ...
Ahora voy así:
[makerpm@fricky rpmbuild]$ rpmlint RPMS/noarch/fwsnort-1.0.6-1.noarch.rpm fwsnort.noarch: W: log-files-without-logrotate /var/log/fwsnort 1 packages and 0 specfiles checked; 0 errors, 1 warnings. [makerpm@fricky rpmbuild]$ rpmlint SPECS/fwsnort.spec 0 packages and 1 specfiles checked; 0 errors, 0 warnings.
Básicamente no tengo una configuración para la rotación de logs, ya se la voy a poner :)
Updated by Guillermo Gómez about 2 years ago
Antes de crear la configuración de la rotación de logs, voy a probar funcionalidad con el rpm generado con esta primera versión de spec.
# yum --nogpgcheck localinstall /home/makerpm/rpmbuild/RPMS/noarch/fwsnort-1.0.6-1.noarch.rpm ... Resolving Dependencies ... --> Finished Dependency Resolution Dependencies Resolved ================================================================================================== Package Arch Version Repository Size ================================================================================================== Installing: fwsnort noarch 1.0.6-1 /fwsnort-1.0.6-1.noarch 130 k Installing for dependencies: perl-IPTables-Parse noarch 0.7-4.fc12 fedora 16 k perl-Net-IPv4Addr noarch 0.10-6.fc12 fedora 16 k Transaction Summary ================================================================================================== Install 3 Package(s) Upgrade 0 Package(s) Total size: 162 k Total download size: 32 k Is this ok [y/N]: y Downloading Packages: ... Dependency Installed: perl-IPTables-Parse.noarch 0:0.7-4.fc12 perl-Net-IPv4Addr.noarch 0:0.10-6.fc12 Complete!
Si bien la resolución de dependencias se ve bien "mi versión" no se similar a las demás, en particular el ".fc12" (investigando).
Updated by Guillermo Gómez about 2 years ago
Ajustado %release
...
Release: %release%{?dist}
...
Ahor voy así:
[makerpm@fricky rpmbuild]$ rpmlint RPMS/noarch/fwsnort-1.0.6-1.fc12.noarch.rpm fwsnort.noarch: W: log-files-without-logrotate /var/log/fwsnort 1 packages and 0 specfiles checked; 0 errors, 1 warnings. [makerpm@fricky rpmbuild]$ rpmlint SPECS/fwsnort.spec 0 packages and 1 specfiles checked; 0 errors, 0 warnings.
Note el cambio de nombre del paquete rpm generado con .fc12.
Updated by Guillermo Gómez about 2 years ago
Ahora el proceso de instalación local se ve así:
# yum --nogpgcheck localinstall /home/makerpm/rpmbuild/RPMS/noarch/fwsnort-1.0.6-1.fc12.noarch.rpm ... ========================================================================================================================== Package Arch Version Repository Size ========================================================================================================================== Installing: fwsnort noarch 1.0.6-1.fc12 /fwsnort-1.0.6-1.fc12.noarch 130 k Installing for dependencies: perl-IPTables-Parse noarch 0.7-4.fc12 fedora 16 k perl-Net-IPv4Addr noarch 0.10-6.fc12 fedora 16 k Transaction Summary ========================================================================================================================== Install 3 Package(s) Upgrade 0 Package(s) Total size: 162 k Total download size: 32 k ...
Mucho mejor, aparentemente... :)
Updated by Guillermo Gómez about 2 years ago
Al intentar ejecutar fwsnort de forma simple obtengo:
[root@fricky var]# fwsnort [*] No snort rules directory /etc/fwsnort/snort_rules, use --snort-rdir at /usr/sbin/fwsnort line 3112.
En este punto tengo un dilema, ¿se pueden usar las reglas del paquetes snort, y si es así, lo pongo como dependencia? En el paquete que se incluyen las dependencias, se incluyen las reglas, una opción es incluir dichas reglas en mi rpm.
En general no se requiere el paquete snort, pero si las reglas snort a utilizar. Antes de divagar primero voy a verificar el paquete snort y sus reglas. Al instalar el paquete snort, se nota que no hay reglas snort allí, ¿por qué?
- Why is there no Rules in this package? * sourcefire licenses the rules under a different license than snort. Sourcefire VRT Certified Rules are the official rules of snort.org. Each rule has been rigorously tested against the same standards the VRT uses for Sourcefire customers.
Updated by Guillermo Gómez about 2 years ago
Después de registrarme y descargar las reglas snort oficiales, y crear el directorio /etc/fwsnort/rules
[root@fricky snort_rules]# cp /root/snortrules/rules/icmp.rules .
[root@fricky snort_rules]# pwd
/etc/fwsnort/snort_rules
[root@fricky snort_rules]# fwsnort
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Snort Rules File Success Fail Ipt_apply Total
[+] icmp.rules 17 5 10 22
=======================================
17 5 10 22
[+] Generated iptables rules for 17 out of 22 signatures: 77.27%
[+] Found 10 applicable snort rules to your current iptables
policy.
[+] Logfile: /var/log/fwsnort.log
[+] iptables script: /etc/fwsnort/fwsnort.sh
[root@fricky snort_rules]#
Note como se han procesado 22 reglas de las cuales se han podido traducir 17.
http://netfilter.org/documentation/HOWTO/netfilter-extensions-HOWTO-3.html#ss3.6 << si desea parchar... por ahora no es asunto de empaquetamiento.
Updated by Guillermo Gómez about 2 years ago
Un pequeño cambio de dirección:
Las reglas suministradas por fwsnort son "libres" y en consecuencia las deseo en el rpm, por otro lado, no queremos los módulos que ya son suministrados por Fedora en otros paquetes
Las reglas que suministra el paquete fwsnort vienen en el directorios deps y en el fuente "con deps", asi que voy a ajustar para que se use dichos fuentes, pero sin construir los módulos.
Updated by Guillermo Gómez about 2 years ago
- Due date set to 01/15/2010
Updated by Guillermo Gómez about 2 years ago
- % Done changed from 70 to 80
Ya logré incluir las reglas en el paquete, me falta agregar la rotación de logs.
Updated by Guillermo Gómez about 2 years ago
- Status changed from En Progreso to Resuelta
- % Done changed from 80 to 100
Bueno, cierro esta petición para subir mi paquete y esperar revisión.