# Contributor: Stuart Cardall # Maintainer: Stuart Cardall global pkgname := 'fwsnort' global pkgver := '1.6.7' global pkgrel := '0' global pkgdesc := '"Application layer IDS/IPS by translating snort rules into iptables'" global url := '"http://www.cipherdyne.org/fwsnort/'" global arch := '"noarch'" global license := '"GPL'" global depends := '"perl perl-netaddr-ip perl-iptables-parse iptables ip6tables net-tools wget'" global install := ""$pkgname.post-install"" global source := ""http://www.cipherdyne.org/$pkgname/download/$pkgname-nodeps-$pkgver.tar.gz fwsnort.up fwsnort.update periodic.daily"" global builddir := ""$srcdir/$pkgname-nodeps-$pkgver"" proc build { cd $builddir # Disable Root requirement to build. var start = $[sed -n '/die "You need to be root (or equivalent UID 0"/=' ./install.pl] var end = $[expr $start + 1] # Busybox sed does not support +1d. sed "$start,$(end)d" ./install.pl -i # Prevent chmod 0500 halting the build. sed "s|0500|0755|" ./install.pl -i # Change MAN path so package builds. sed "s|/usr/share/man/man8|$pkgdir&|" ./install.pl -i # --install-test-dir sets the INSTALL_ROOT to $src/../test/fwsnort-test # avoids installation attempted into /etc /usr /var # -S disables dependency installs (we also build with the nodep sources) ./install.pl -S --install-test-dir } proc package { cd $builddir mkdir -p "$pkgdir"/etc "$pkgdir"/usr cp -rf test/fwsnort-install/* "$pkgdir"/ cp -f fwsnort.conf "$pkgdir"/etc/fwsnort/fwsnort.conf # Fix permissions. chmod 0500 "$pkgdir"/etc/fwsnort "$pkgdir"/etc/fwsnort/snort_rules chmod 0500 "$pkgdir"/usr/sbin/fwsnort chmod 0600 "$pkgdir"/etc/fwsnort/fwsnort.conf # Install rule / signature update script. install -Dm755 "$srcdir"/fwsnort.update \ "$pkgdir"/usr/bin/update-fwsnort # Install iptables rule splicing script. install -Dm755 "$srcdir"/fwsnort.up \ "$pkgdir"/etc/network/if-pre-up.d/fwsnort # Install daily cron. install -Dm755 "$srcdir"/periodic.daily \ "$pkgdir"/etc/periodic/daily/fwsnort } proc check { cd "$builddir/test" perl test-fwsnort.pl } global sha512sums := '"c2a4eae71c0c4e6ea0960d0bb5a43ad299624bbbdac21690b8e01eba83c979be260338fea940f5f294e6cd6eb1984576854c43d38c86c3a9548aeec60f9f2dae fwsnort-nodeps-1.6.7.tar.gz 3c97b5f4bb922086acd62305baae4ba1d91e6e627d063f131f98e08da3f57b607b35558eae2cf292b3997d25f09147039f95123161f8f29c5b97b71c80811e9f fwsnort.up 2a1e7ca6dc1c4a6e59907175c3483736f0efe1dcd8035dae2b903cd22fe953d29333939ad9e0a6f446480eda55370f4b11a77016932bef73e769b5e5401e92c0 fwsnort.update 763b459d43319e9b6678a5addd96b3542c629379f9f11095bc158b1ef08b039cd776ceedd6207953ab01000804d7580a3a8223b352b407d3cc6a05c27d96fcb0 periodic.daily'" (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgname) op:Equal rhs:{(fwsnort)} spids:[6])] spids: [6] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgver) op:Equal rhs:{(1.6.7)} spids:[9])] spids: [9] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgrel) op:Equal rhs:{(0)} spids:[12])] spids: [12] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("Application layer IDS/IPS by translating snort rules into iptables"))} spids: [15] ) ] spids: [15] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ ("http://www.cipherdyne.org/fwsnort/"))} spids: [20] ) ] spids: [20] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (noarch))} spids:[25])] spids: [25] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ (GPL))} spids:[30])] spids: [30] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:depends) op: Equal rhs: {(DQ ("perl perl-netaddr-ip perl-iptables-parse iptables ip6tables net-tools wget"))} spids: [35] ) ] spids: [35] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install) op: Equal rhs: {(DQ ($ VSub_Name "$pkgname") (.post-install))} spids: [40] ) ] spids: [40] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ ("http://www.cipherdyne.org/") ($ VSub_Name "$pkgname") (/download/) ($ VSub_Name "$pkgname") (-nodeps-) ($ VSub_Name "$pkgver") (".tar.gz\n") ("\tfwsnort.up\n") ("\tfwsnort.update\n") ("\tperiodic.daily") ) } spids: [46] ) ] spids: [46] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:builddir) op: Equal rhs: { (DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$pkgname") (-nodeps-) ($ VSub_Name "$pkgver")) } spids: [60] ) ] spids: [60] ) (FuncDef name: build body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:start) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(sed)} {(-n)} {(SQ <"/die \"You need to be root (or equivalent UID 0\"/=">)} {(./install.pl)} ) ] ) left_token: spids: [92 102] ) } spids: [91] ) ] spids: [89] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:end) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(expr)} {($ VSub_Name "$start")} {(Lit_Other "+")} {(1)})] ) left_token: spids: [108 116] ) } spids: [107] ) ] spids: [105] ) (C {(sed)} {(DQ ($ VSub_Name "$start") (",") (${ VSub_Name end) (d))} {(./install.pl)} {(-i)}) (C {(sed)} {(DQ ("s|0500|0755|"))} {(./install.pl)} {(-i)}) (C {(sed)} {(DQ ("s|/usr/share/man/man8|") ($ VSub_Name "$pkgdir") ("&|"))} {(./install.pl)} {(-i)} ) (C {(./install.pl)} {(-S)} {(--install-test-dir)}) ] spids: [74] ) spids: [70 73] ) (FuncDef name: package body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$pkgdir")) (/etc)} {(DQ ($ VSub_Name "$pkgdir")) (/usr)} ) (C {(cp)} {(-rf)} {(test/fwsnort-install/) (Lit_Other "*")} {(DQ ($ VSub_Name "$pkgdir")) (/)} ) (C {(cp)} {(-f)} {(fwsnort.conf)} {(DQ ($ VSub_Name "$pkgdir")) (/etc/fwsnort/fwsnort.conf)}) (C {(chmod)} {(0500)} {(DQ ($ VSub_Name "$pkgdir")) (/etc/fwsnort)} {(DQ ($ VSub_Name "$pkgdir")) (/etc/fwsnort/snort_rules)} ) (C {(chmod)} {(0500)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/sbin/fwsnort)}) (C {(chmod)} {(0600)} {(DQ ($ VSub_Name "$pkgdir")) (/etc/fwsnort/fwsnort.conf)}) (C {(install)} {(-Dm755)} {(DQ ($ VSub_Name "$srcdir")) (/fwsnort.update)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/bin/update-fwsnort)} ) (C {(install)} {(-Dm755)} {(DQ ($ VSub_Name "$srcdir")) (/fwsnort.up)} {(DQ ($ VSub_Name "$pkgdir")) (/etc/network/if-pre-up.d/fwsnort)} ) (C {(install)} {(-Dm755)} {(DQ ($ VSub_Name "$srcdir")) (/periodic.daily)} {(DQ ($ VSub_Name "$pkgdir")) (/etc/periodic/daily/fwsnort)} ) ] spids: [199] ) spids: [195 198] ) (FuncDef name: check body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir") (/test))}) (C {(perl)} {(test-fwsnort.pl)}) ] spids: [362] ) spids: [358 361] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha512sums) op: Equal rhs: { (DQ ( "c2a4eae71c0c4e6ea0960d0bb5a43ad299624bbbdac21690b8e01eba83c979be260338fea940f5f294e6cd6eb1984576854c43d38c86c3a9548aeec60f9f2dae fwsnort-nodeps-1.6.7.tar.gz\n" ) ( "3c97b5f4bb922086acd62305baae4ba1d91e6e627d063f131f98e08da3f57b607b35558eae2cf292b3997d25f09147039f95123161f8f29c5b97b71c80811e9f fwsnort.up\n" ) ( "2a1e7ca6dc1c4a6e59907175c3483736f0efe1dcd8035dae2b903cd22fe953d29333939ad9e0a6f446480eda55370f4b11a77016932bef73e769b5e5401e92c0 fwsnort.update\n" ) ( "763b459d43319e9b6678a5addd96b3542c629379f9f11095bc158b1ef08b039cd776ceedd6207953ab01000804d7580a3a8223b352b407d3cc6a05c27d96fcb0 periodic.daily" ) ) } spids: [380] ) ] spids: [380] ) ] )