Monday, September 19, 2011

TODO: patch for #RefRef

http://thehackernews.com/2011/07/refref-denial-of-service-ddos-tool.html

http://www.refref.org/

http://security.stackexchange.com/questions/6756/how-to-patch-against-refrefs-dos-attack

Friday, September 16, 2011

GD is Dead! libgd appears to be unmaintained and left in unbuildable state.

I had tried and given up on install the GD 2.46 Perl module on a "Red Hat Enterprise Linux Server release 6.1 (Santiago)" 64bit. And this is what happens ...


$ perl Makefile.PL
Notice: Type perl Makefile.PL -h for command-line option summary.

**UNRECOVERABLE ERROR**
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd.
... but I have libgd installed ...


$ rpm -q gd
gd-2.0.35-10.el6.x86_64
... so when I do as the error message suggest ...
$ perl Makefile.PL --ignore_missing_gd

Where is libgd installed? [/usr/lib]

Please choose the features that match how libgd was built:
Build JPEG support? [y] n
Build PNG support? [y] n
Build FreeType support? [y] n
Build GIF support? [y] n
Build XPM support? [y] n

If you experience compile problems, please check the @INC, @LIBPATH and @LIBS
arrays defined in Makefile.PL and manually adjust, if necessary.

Writing Makefile for GD
Writing MYMETA.yml
... I answered 'n' to all questions to give Makeperl.PL a good chance to execute without error. So now I can run make right ...

.... perl-5.14.1/bin/perl GD/Image.pm.PLS GD/Image.pm
Extracting Image.pm (with variable substitutions)
Skip blib/lib/GD/Polyline.pm (unchanged)
Skip blib/lib/qd.pl (unchanged)
Skip blib/lib/GD/Image.pm (unchanged)
Skip blib/lib/GD.pm (unchanged)
Skip blib/lib/GD/Simple.pm (unchanged)
Skip blib/lib/GD/Polygon.pm (unchanged)
Skip blib/lib/GD/Group.pm (unchanged)
gcc -c  -I/usr/include -I/usr/include/gd -Wformat=0 -O2   -DVERSION=\"2.46\" -DXS_VERSION=\"2.46\" -fPIC "-I/apps/RED/red-perl-5.14.1/lib/5.14.1/x86_64-linux-thread-multi/CORE"   GD.c
GD.xs:7:16: error: gd.h: No such file or directory
GD.xs:8:21: error: gdfontg.h: No such file or directory
GD.xs:9:21: error: gdfontl.h: No such file or directory
GD.xs:10:22: error: gdfontmb.h: No such file or directory
GD.xs:11:21: error: gdfonts.h: No such file or directory
GD.xs:12:21: error: gdfontt.h: No such file or directory
GD.xs:342: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âGD__Imageâ
GD.xs:343: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âGD__Fontâ
GD.xs:385: error: expected specifier-qualifier-list before âgdIOCtxâ
GD.xs:393: error: expected â)â before âctxâ
GD.xs:400: error: expected â)â before âctxâ
GD.xs:416: error: expected â)â before âctxâ
GD.xs:424: error: expected â)â before âctxâ
GD.xs:429: error: expected â)â before âctxâ
GD.xs:433: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â*â token
GD.xs:454: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âgd_cloneDimâ
GD.xs:478: error: expected â)â before âsrcâ
GD.xs:507: error: expected â)â before âimageâ
GD.c: In function âXS_GD__Image__newâ:
GD.c:682: error: âGD__Imageâ undeclared (first use in this function)
GD.c:682: error: (Each undeclared identifier is reported only once
GD.c:682: error: for each function it appears in.)
 ... I guess I need to gd-devel but I haven't got that in my yum repo :(

Looks like I will have to https://bitbucket.org/pierrejoye/gd-libgd/downloads and attempt to build my own RPM's from source. bleh!

Thursday, September 15, 2011

rpmbuild ... error: You must set "%_gpg_name" in your macro file

Found helpful answer here: http://www.perlmonks.org/?node_id=661992

Summary:

I bet I just need to counteract that 'sign' argument. Let's check the rpmbuild man page .. hmm, refers us to rpm, OK, check that man page .. bingo!
So let's try it with the no-sign argument instead ..
[alex@box FC8]$ cpan2rpm --no-sign http://search.cpan.org/CPAN/authors +/id/D/DC/DCLINTON/Cache-Cache-1.05.tar.gz -- cpan2rpm - Ver: 2.028 -- Upgrade check Fetch: HTTP [...] + rm -rf Cache-Cache-1.05 + exit 0 RPM: /home/box/alex/RPMS/RPMS/noarch/perl-Cache-Cache-1.05-1.noarch.rp +m SRPM: /home/box/alex/RPMS/SRPMS/perl-Cache-Cache-1.05-1.src.rpm -- Done --


Tuesday, September 13, 2011

Saturday, September 10, 2011

dnssec NSEC record poor man's axfr


$ dig +dnssec isc.org NSEC
; <<>> DiG 9.3.4 <<>> +dnssec isc.org NSEC
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47304
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags: do; udp: 4000
;; QUESTION SECTION:
;isc.org.                       IN      NSEC
;; ANSWER SECTION:
isc.org.                3600    IN      NSEC    _kerberos.isc.org. A NS SOA MX TXT AAAA NAPTR RRSIG NSEC DNSKEY TYPE99
;; Query time: 23 msec
;; SERVER: 68.87.76.182#53(68.87.76.182)
;; WHEN: Sat Sep 10 19:38:38 2011
;; MSG SIZE  rcvd: 82

Friday, September 09, 2011

getting out of zabasearch

RHEL6.1 64bit rpmbuild Processing files: perl-Test-Tester-0.107-1.x86_64 error: File not found: RPM build errors: Macro % has illegal name (%define) File not found:

I have found no solution on-line for the problem I had encountered when building rpm for various Perl Modules.  In this post I demonstrate the problem and how I eventually had to fix it.

Given ...

red@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ rpm -q rpm-build
rpm-build-4.8.0-16.el6.x86_64

... and given this Makefile ...

# Makefile for perl-Test-Tester

VER=0.107
RELEASE=1
RPM_NAME=perl-Test-Tester
ARCH=x86_64
TAR_NAME=Test-Tester
TOPDIR  := $(shell pwd)
FILES = \
${TOPDIR}/BUILD \
${TOPDIR}/BUILDROOT \
${TOPDIR}/SOURCES \
${TOPDIR}/RPMS \
${RPM_NAME}-${VER}.tar.gz \
${TOPDIR}/SOURCES/${RPM_NAME}-${VER}.tar.gz \
${RPM_NAME}-${VER}-${RELEASE}.${ARCH}.rpm


all : ${FILES}

${TOPDIR}/BUILD :
        mkdir -p ${TOPDIR}/BUILD

${TOPDIR}/BUILDROOT :
        mkdir -p $@/${RPM_NAME}-${VER}-${RELEASE}.${ARCH}

${TOPDIR}/RPMS :
        mkdir -p ${TOPDIR}/RPMS

${TOPDIR}/SOURCES :
        mkdir -p ${TOPDIR}/SOURCES

${TAR_NAME}-${VER}.tar.gz :
        #wget http://search.cpan.org/CPAN/authors/id/K/KR/KRUSCOE/${TAR_NAME}-${VER}.tar.gz this line is incorrect
        cvs update $@

${RPM_NAME}-${VER}.tar.gz : ${TAR_NAME}-${VER}.tar.gz
        tar -zxf $<
        mv ${TAR_NAME}-${VER}/ ${RPM_NAME}-${VER}
        tar -czvf $@ ${RPM_NAME}-${VER}
        rm -rf ${RPM_NAME}-${VER}

${TOPDIR}/SOURCES/${RPM_NAME}-${VER}.tar.gz : ${RPM_NAME}-${VER}.tar.gz
        cp $< $@

${RPM_NAME}-${VER}-${RELEASE}.${ARCH}.rpm : ${TOPDIR}/SOURCES/${RPM_NAME}-${VER}.tar.gz  ${RPM_NAME}.spec
        rpmbuild --define "_topdir ${TOPDIR}" -vv -bb ${RPM_NAME}.spec
        cp ${TOPDIR}/RPMS/${ARCH}/$@ .
        - rpm -i --force -v $@
        test -e $@

test: ${RPM_NAME}-${VER}-${RELEASE}.${ARCH}.rpm
         rpm -q --filesbypkg -p $<

clean:
        rm -rf ${FILES}
... and given the SPEC file perl-Test-Tester.spec ...

Summary: Install pre-complied Perl module Test::Tester
#
# Spec file
#
Name: perl-Test-Tester
Version: 0.107
Release: 1
License: Copyright Red Cricket Systems Inc. 2008
Group: None
Source: perl-Test-Tester-0.107.tar.gz
Requires: red-perl
BuildRequires: red-perl
Provides: perl(Test::Tester)
%description

Install pre-complied Perl module Test::Tester for RED

%prep
%global
%setup
%build
/usr/RED/perl/bin/perl Makefile.PL INSTALLDIRS=vendor
make
make test
%install
make install
%post
%clean
%files
%defattr(-,red,cricket)
/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester.pm
/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/CaptureRunner.pm
/apps/REDD/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Capture.pm
/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Delegate.pm
/apps/REDD/red-perl-5.14.1/man/man3/Test::Tester::Capture.3
/apps/REDD/red-perl-5.14.1/man/man3/Test::Tester.3
/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::CaptureRunner.3
%changelog

... when I execute make the output shows the error ...



redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ make
rpmbuild --define "_topdir /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester" -vv -bb perl-Test-Tester.spec
error: Macro % has illegal name (%define)
D: opening  db environment /var/lib/rpm cdb:mpool:joinenv
D: opening  db index       /var/lib/rpm/Packages rdonly mode=0x0
D: locked   db index       /var/lib/rpm/Packages
D: ========== +++ perl-Test-Tester-0.107-1 x86_64/linux 0x0
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D: opening  db index       /var/lib/rpm/Name rdonly mode=0x0
D:  read h#     622 Header sanity check: OK
D: added key gpg-pubkey-fd431d51-4ae0493b to keyring
D:  read h#     623 Header sanity check: OK
D: added key gpg-pubkey-2fa658e0-45700c69 to keyring
D:  read h#     624 Header sanity check: OK
D: added key gpg-pubkey-665b9872-3fd4f7c5 to keyring
D: Using legacy gpg-pubkey(s) from rpmdb
D: opening  db index       /var/lib/rpm/Providename rdonly mode=0x0
D:  read h#     656 Header SHA1 digest: OK (cac9c305ade60953baec0168c93953daa3dee1f7)
D:  Requires: red-perl                                      YES (db provides)
D: closed   db index       /var/lib/rpm/Providename
D: closed   db index       /var/lib/rpm/Name
D: closed   db index       /var/lib/rpm/Packages
D: closed   db environment /var/lib/rpm
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.C93SZy
+ umask 022
+ cd /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD
+ cd /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD
+ rm -rf perl-Test-Tester-0.107
+ /usr/bin/gzip -dc /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/SOURCES/perl-Test-Tester-0.107.tar.gz
+ /bin/tar -xvvf -
drwxr-xr-x 1000/1000         0 2008-03-01 16:17 perl-Test-Tester-0.107/
-rw-r--r-- 1000/1000     12462 2008-03-01 16:17 perl-Test-Tester-0.107/README
drwxr-xr-x 1000/1000         0 2008-03-01 16:17 perl-Test-Tester-0.107/t/
-rw-r--r-- 1000/1000       488 2005-07-04 18:09 perl-Test-Tester-0.107/t/capture.t
-rw-r--r-- 1000/1000      1775 2005-10-08 05:53 perl-Test-Tester-0.107/t/check_tests.t
-rw-r--r-- 1000/1000       379 2007-08-25 10:21 perl-Test-Tester-0.107/t/depth.t
-rw-r--r-- 1000/1000      4231 2007-08-25 10:11 perl-Test-Tester-0.107/t/run_test.t
-rw-r--r-- 1000/1000       336 2005-07-04 17:43 perl-Test-Tester-0.107/t/SmallTest.pm
drwxr-xr-x 1000/1000         0 2008-03-01 16:17 perl-Test-Tester-0.107/t/fail/
-rw-r--r-- 1000/1000       187 2005-02-12 02:53 perl-Test-Tester-0.107/t/fail/fail.t
-rw-r--r-- 1000/1000       464 2008-03-01 16:17 perl-Test-Tester-0.107/t/auto.t
-rw-r--r-- 1000/1000       127 2004-07-05 18:07 perl-Test-Tester-0.107/t/MyTest.pm
-rw-r--r-- 1000/1000        19 2003-03-04 20:27 perl-Test-Tester-0.107/TODO
-rw-r--r-- 1000/1000      6451 2004-07-11 04:35 perl-Test-Tester-0.107/ARTISTIC
-rw-r--r-- 1000/1000       603 2004-07-05 17:22 perl-Test-Tester-0.107/Makefile.PL
drwxr-xr-x 1000/1000         0 2008-03-01 16:17 perl-Test-Tester-0.107/lib/
drwxr-xr-x 1000/1000         0 2008-03-01 16:17 perl-Test-Tester-0.107/lib/Test/
drwxr-xr-x 1000/1000         0 2008-03-01 16:17 perl-Test-Tester-0.107/lib/Test/Tester/
-rw-r--r-- 1000/1000       372 2005-07-04 17:31 perl-Test-Tester-0.107/lib/Test/Tester/Delegate.pm
-rw-r--r-- 1000/1000      1273 2004-07-11 11:16 perl-Test-Tester-0.107/lib/Test/Tester/CaptureRunner.pm
-rw-r--r-- 1000/1000      4251 2008-03-01 16:13 perl-Test-Tester-0.107/lib/Test/Tester/Capture.pm
-rw-r--r-- 1000/1000     17068 2008-03-01 16:14 perl-Test-Tester-0.107/lib/Test/Tester.pm
-rw-r--r-- 1000/1000      3143 2008-03-01 16:12 perl-Test-Tester-0.107/CHANGES
-rw-r--r-- 1000/1000       349 2008-03-01 16:17 perl-Test-Tester-0.107/META.yml
-rw-r--r-- 1000/1000       307 2005-07-04 18:22 perl-Test-Tester-0.107/MANIFEST
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd perl-Test-Tester-0.107
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.JIXFCg
+ umask 022
+ cd /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD
+ cd perl-Test-Tester-0.107
+ /usr/RED/perl/bin/perl Makefile.PL INSTALLDIRS=vendor
Checking if your kit is complete...
Looks good
Writing Makefile for Test::Tester
Writing MYMETA.yml
+ make
make[1]: Entering directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
cp lib/Test/Tester.pm blib/lib/Test/Tester.pm
cp lib/Test/Tester/Capture.pm blib/lib/Test/Tester/Capture.pm
cp lib/Test/Tester/CaptureRunner.pm blib/lib/Test/Tester/CaptureRunner.pm
cp lib/Test/Tester/Delegate.pm blib/lib/Test/Tester/Delegate.pm
Manifying blib/man3/Test::Tester::Capture.3
Manifying blib/man3/Test::Tester.3
Manifying blib/man3/Test::Tester::CaptureRunner.3
make[1]: Leaving directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
+ make test
make[1]: Entering directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
PERL_DL_NONLAZY=1 /apps/RED/red-perl-5.14.1/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/auto.t ......... ok  
t/capture.t ...... ok  
t/check_tests.t .. ok      
t/depth.t ........ ok  
t/run_test.t ..... ok    
All tests successful.
Files=5, Tests=169,  0 wallclock secs ( 0.04 usr  0.00 sys +  0.10 cusr  0.01 csys =  0.15 CPU)
Result: PASS
make[1]: Leaving directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.RidKYZ
+ umask 022
+ cd /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD
+ cd perl-Test-Tester-0.107
+ make install
make[1]: Entering directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
Manifying blib/man3/Test::Tester::Capture.3
Manifying blib/man3/Test::Tester.3
Manifying blib/man3/Test::Tester::CaptureRunner.3
Installing /apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester.pm
Installing /apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Delegate.pm
Installing /apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/CaptureRunner.pm
Installing /apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Capture.pm
Installing /apps/RED/red-perl-5.14.1/man/man3/Test::Tester.3
Installing /apps/RED/red-perl-5.14.1/man/man3/Test::Tester::Capture.3
Installing /apps/RED/red-perl-5.14.1/man/man3/Test::Tester::CaptureRunner.3
Appending installation info to /apps/RED/red-perl-5.14.1/lib/5.14.1/x86_64-linux-thread-multi/perllocal.pod
make[1]: Leaving directory `/apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILD/perl-Test-Tester-0.107'
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
Processing files: perl-Test-Tester-0.107-1.x86_64
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester.pm
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/CaptureRunner.pm
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Capture.pm
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Delegate.pm
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::Capture.3
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester.3
error: File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::CaptureRunner.3


RPM build errors:
    Macro % has illegal name (%define)
    File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester.pm
    File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/CaptureRunner.pm
    File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Capture.pm
    File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/lib/vendor_perl/5.14.1/Test/Tester/Delegate.pm
    File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::Capture.3
    File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester.3
    File not found: /apps/users/redcricket/platform/red-vendor_perl/perl-Test-Tester/BUILDROOT/perl-Test-Tester-0.107-1.x86_64/apps/RED/red-perl-5.14.1/man/man3/Test::Tester::CaptureRunner.3
make: *** [perl-Test-Tester-0.107-1.x86_64.rpm] Error 1
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.1 (Santiago)
The problem is that for one reason or another rpmbuild does not want to place the installed files into the BUILDROOT/perl-Test-tester-0.107.x86_64 directory.  So to correct this I wrote the shell script ...

redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ cat ../process_install_output.sh
#!/bin/sh
#
# $Id: process_install_output.sh,v 1.1.2.1 2011/09/09 19:24:34 redcricket Exp $
#
#       This script is used in perl-<Module>.spec files
#
INSTALL_OUTPUT=$1
BUILDROOT=$2

if [ -z "$INSTALL_OUTPUT" ]
then
        echo "Usage : $0 <install output file> <rpm build root directory>"
        exit 1
fi

if [ -z "$BUILDROOT" ]
then
        echo "Usage : $0 <install output file> <rpm build root directory>"
        exit 1
fi
cat $INSTALL_OUTPUT
echo "grep "Installing" $INSTALL_OUTPUT"
for installed_file in `grep "Installing" $INSTALL_OUTPUT | cut -d' ' -f2`
do
        installed_dir=`dirname $installed_file`
        echo "Executing [mkdir -p $BUILDROOT/$installed_dir]"
        mkdir -p $BUILDROOT/$installed_dir
        echo "Execute [cp -p $installed_file $BUILDROOT/$installed_dir]"
        cp -p $installed_file $BUILDROOT/$installed_dir
done
 Then I call this script in the %install section of my SPEC file like so ...
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ cp perl-Test-Tester.spec perl-Test-Tester.spec_broken
 redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ vim perl-Test-Tester.spec
redcricket@cel6-test:~/platform/red-vendor_perl/perl-Test-Tester$ diff perl-Test-Tester.spec perl-Test-Tester.spec_broken
27,29c27
< make install > %{_topdir}/%{name}.install.out
< chmod +x ../../../process_install_output.sh
< ../../../process_install_output.sh %{_topdir}/%{name}.install.out ../../BUILDROOT/%{name}-%{version}-%{release}.%{_arch}
---
> make install

... doing that solved my problem. :)

Wednesday, September 07, 2011

list of bad actor ip addresses. great infosec data

ipaddress browser

How to block/blackhole all Chinese subnets on port 22 (sshd)


  1. Get a list of subnets like so: $ wget http://www.okean.com/chinacidr.txt
  2. Execute this command ...
 $  for i in `grep -v "^#" chinacidr.txt | cut -f1 -d' '`; do sudo ~/scripts/blackhole-port22.sh $i; done

... where ...

$ cat ~/scripts/blackhole-port22.sh

#!/bin/sh
hole=$1
sudo /sbin/iptables -v -t filter -I INPUT -p tcp --dport 22 -s $hole -j REJECT

... maybe someday the Chinese will stop attempting brute force attacks against sshd. LOL!



Saturday, September 03, 2011

RPM build errors: File must begin with "/": ./perl File must begin with "/": installman File must begin with "/": --destdir=

If you get these errors...
RPM build errors:
    File must begin with "/": ./perl
    File must begin with "/": installman
    File must begin with "/": --destdir=
... when running rpmbuild to make a RPM, double check your %files section of your spec file:

I found that I had the line ...

./perl installman --destdir=

... in my file list! I guess when I put the file list into my spec file's %file section I forget to remove that junk line.


Thursday, September 01, 2011

annoying interview questions

I do not know the value of what I call "riddle-of-the-spinx" technical job interviews.  Back in the day it was, "show me how you would write a double-linked listed" but who the heck writes double-linked list now a days?

I am not really looking for a new job right now.  I like the job I have, but I thought should go out on some job interviews just to practice.  An interviewer asked me to write, in pseudo code, and program that would output the "Fibonacci numbers" ... you know 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144.  I told the interview I can do that but it will take me some time and I didn't feel like wasting time that way and I really don't like having to code that in a clutch situation, like a job interview.

So I went home and it took me about 10 minutes and I came up with a shell script ...

red@cricket:~$ ./fib.sh
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
red@cricket:~$ cat fib.sh
#!/bin/sh

first=0
second=1
echo -n "$first, $second, "
thrid=`expr $first + $second`
echo -n $thrid
while [ $thrid -lt 100 ]
do
        first=$second
        second=$thrid
        thrid=`expr $first + $second`
        echo -n ", $thrid"
done
echo ""

... so really what did the interviewer learn from asking me that question?  That I do not like to write code on a white board that cannot execute my code?  That white boards are not good for testing code?
who knows.