Ticket #42856: patch-bro-Portfile2.diff

File patch-bro-Portfile2.diff, 9.8 KB (added by jul_bsd@…, 10 years ago)

v2.3

  • net/bro/Portfile

    old new  
    11# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
    2 # $Id: Portfile 128545 2014-11-23 00:13:06Z ryandesign@macports.org $
     2# $Id: Portfile 113683 2013-11-23 02:18:18Z ryandesign@macports.org $
    33
    44PortSystem          1.0
    55
    6 name                bro
    7 version             2.2
     6PortGroup           github 1.0
     7
     8github.setup        bro bro 2.3.1 v
    89categories          net security
    910platforms           darwin
    1011maintainers         gmail.com:tanawts openmaintainer
     
    1718                    traffic and looks for suspicious activity.
    1819
    1920homepage            http://www.bro.org/
    20 master_sites        ${homepage}downloads/release/ \
    21                     ${homepage}downloads/archive/
    22 
    23 checksums           rmd160  ad1820eae034062c0e1125e4a4ac1e61960ad126 \
    24                     sha256  86909361c2d804681f314604a6ce763be663937b2f045c8d25d810528a633dc9
    2521
    2622depends_build       port:cmake \
    2723                    port:libgeoip \
     
    3026# use the system-provided flex
    3127depends_lib         port:bison \
    3228                    port:curl \
    33                     port:libmagic \
    3429                    port:libpcap \
    3530                    port:openssl \
    3631                    port:perl5 \
     
    3833                    port:readline \
    3934                    port:zlib
    4035
    41 patchfiles          patch-CMakeLists.txt.diff
    42 patchfiles-append   patch-htonll.diff
     36variant universal {}
     37configure.cflags-append "${configure.cflags} [get_canonical_archflags cc]"
     38configure.universal_args
     39## CCL.h:8:14: error: unknown type name 'ptr_compat_int'; did you mean 'ptr_compat_intList'? => ???
     40
     41test.run            yes
     42test.target         test-all
    4343
    44 universal_variant   no
     44## https://github.com/Homebrew/homebrew/blob/614a96fe0eb86b46587cce9332bb305299370943/Library/Formula/bro.rb
     45## http://pdb.finkproject.org/pdb/browse.php?summary=bro = nothing
    4546
    46 configure.args      --enable-mobile-ipv6
     47## FIXME! ${prefix}/etc/bro, ${prefix}/var/spool/bro, ${prefix}/var/log/bro
     48configure.args      --enable-mobile-ipv6 --conf-files-dir=${prefix}/etc/bro
    4749
    4850post-destroot {
    49     move ${destroot}${prefix}/etc/broccoli.conf ${destroot}${prefix}/etc/broccoli.conf.dist
     51    xinstall -d ${destroot}${prefix}/share/examples/${name}
     52    move ${destroot}${prefix}/etc/bro/broccoli.conf ${destroot}${prefix}/share/examples/${name}/
     53    move ${destroot}${prefix}/etc/bro/node.cfg ${destroot}${prefix}/share/examples/${name}/
     54    move ${destroot}${prefix}/etc/bro/networks.cfg ${destroot}${prefix}/share/examples/${name}/
     55    move ${destroot}${prefix}/etc/bro/broctl.cfg ${destroot}${prefix}/share/examples/${name}/
     56    reinplace "s|${prefix}/spool|${prefix}/var/spool/bro|" ${destroot}${prefix}/share/examples/${name}/broctl.cfg
     57    reinplace "s|${prefix}/logs|${prefix}/var/log/bro|" ${destroot}${prefix}/share/examples/${name}/broctl.cfg
     58
     59    reinplace "s|/usr/bin/python|${prefix}/bin/python2.7|" ${destroot}${prefix}/bin/broctl
     60    reinplace "s| /usr/bin/env python|${prefix}/bin/python2.7|" ${destroot}${prefix}/bin/trace-summary
     61
     62    xinstall -d ${destroot}${prefix}/Library/LaunchDaemons/
     63    copy ${filespath}/org.macports.bro.plist ${destroot}${prefix}/Library/LaunchDaemons/
     64    reinplace "s|%%PREFIX%%|${prefix}|g" ${destroot}${prefix}/Library/LaunchDaemons/org.macports.bro.plist
     65
     66    xinstall -d ${destroot}${prefix}/etc/${name}
     67    xinstall -d ${destroot}${prefix}/var/log/${name}
     68    destroot.keepdirs ${destroot}${prefix}/etc/${name} \
     69        ${destroot}${prefix}/var/log/${name}
    5070}
    5171
    5272post-activate {
    53     if {![file exists ${prefix}/etc/broccoli.conf]} {
    54         copy ${prefix}/etc/broccoli.conf.dist ${prefix}/etc/broccoli.conf
     73    if {![file exists ${prefix}/etc/bro/broccoli.conf]} {
     74        copy ${prefix}/share/examples/${name}/broccoli.conf ${prefix}/etc/bro/broccoli.conf
     75    }
     76    if {![file exists ${prefix}/etc/bro/node.cfg]} {
     77        copy ${prefix}/share/examples/${name}/node.cfg ${prefix}/etc/bro/node.cfg
     78    }
     79    if {![file exists ${prefix}/etc/bro/networks.cfg]} {
     80        copy ${prefix}/share/examples/${name}/networks.cfg ${prefix}/etc/bro/networks.cfg
     81    }
     82    if {![file exists ${prefix}/etc/bro/broctl.cfg]} {
     83        copy ${prefix}/share/examples/${name}/broctl.cfg ${prefix}/etc/bro/broctl.cfg
     84    }
     85}
     86
     87startupitem.create      yes
     88startupitem.netchange   yes
     89startupitem.start       "${prefix}/bin/broctl start"
     90startupitem.stop        "${prefix}/bin/broctl stop"
     91startupitem.restart     "${prefix}/bin/broctl restart"
     92
     93notes "
     94You'll need to set your BROHOME to ${prefix}/share/bro and your
     95BROPATH to ${prefix}/share/bro/site:${prefix}/share/bro/policy
     96to use the provided policies. (which user?)
     97
     98Check online documentation to finish install
     99http://www.bro.org/sphinx/quickstart/index.html
     100
     1011) review config: node.cfg, network.cfg, broctl.cfg
     102   especially network interface, MailTo
     103   Existing files have not been modified
     104
     1052) Run as root or w sudo
     106     # broctl
     107     \[BroControl\] > install
     108     \[BroControl\] > start
     1093) Use scheduled task for maintenance
     110  # ln -s ${prefix}/Library/LaunchDaemons/org.macports.bro.plist /Library/LaunchDaemons/
     111  # launchctl load -w /Library/LaunchDaemons/org.macports.bro.plist
     112
     113**** UPGRADING ****
     114
     115Paths have been changed to respect macports hierarchy
     116${prefix}/etc -> ${prefix}/etc/bro
     117${prefix}/spool -> ${prefix}/var/spool/bro
     118${prefix}/logs -> ${prefix}/var/log/bro
     119
     120BUG: System App firewall ask at each launch if bro can accept incoming connections.
     121BUG: eating cpu...
     122
     123"
     124
     125if {${subport} eq ${name}} {
     126    master_sites        ${homepage}downloads/release/ \
     127                        ${homepage}downloads/archive/
     128   
     129    checksums           bro-${version}.tar.gz \
     130                        rmd160  c386e91d348600159a1ee14851b059a24a1861ed \
     131                        sha256  ff32d21e335d2ddb3e2942527c3212de6ead4e7ffd6ac958497fa80e04e60800 \
     132
     133    depends_lib-append  port:libmagic
     134
     135    post-patch {
     136        reinplace "s|\${BroBase}/spool|\${BroBase}/var/spool/bro|" ${worksrcpath}/aux/broctl/BroControl/options.py
     137        reinplace "s|\${BroBase}/logs|\${BroBase}/var/log/bro|" ${worksrcpath}/aux/broctl/BroControl/options.py
     138        reinplace "s|\${PREFIX}/logs|\${PREFIX}/var/log/bro|" ${worksrcpath}/aux/broctl/CMakeLists.txt
     139        reinplace "s|{BroBase}/logs|{BroBase}/var/log/bro|" ${worksrcpath}/aux/broctl/doc/broctl.rst
     140        reinplace "s|\${PREFIX}/spool|\${PREFIX}/var/spool/bro|" ${worksrcpath}/aux/broctl/CMakeLists.txt
     141        reinplace "s|{BroBase}/spool|{BroBase}/var/spool/bro|" ${worksrcpath}/aux/broctl/doc/broctl.rst
     142    }
     143
     144    conflicts  ${name}-devel
     145}
     146
     147subport ${name}-devel {
     148
     149    version    20141024
     150    #fetch.type git
     151    #git.url    https://github.com/bro/bro.git
     152    ## no support for tag, last one is release
     153    #git.branch 80d7a1482cbf44be8bc6fc1a9b8f1901e33c0bca
     154    patchfiles-delete   patch-CMakeLists.txt.diff
     155    distname    087a9f975d23ef141ad331ca7dc39264402617f6
     156    checksums           ${distname}.tar.gz \
     157                        rmd160  ba3afe6da0b7771d6ea6f24fe8b23f89ab55aee1 \
     158                        sha256  d67bcf993d29008fa6b6242ae6f8877e8c0dd8f03d9f7a9694f2844c040f1af4
     159
     160    post-patch {
     161        ## FIXME! need to include subproject https://github.com/bro/cmake
     162        ##        or git clone --recursive git://git.bro-ids.org/bro
     163        ##        http://comments.gmane.org/gmane.comp.security.detection.bro/5044
     164        #system "cd ${worksrcpath} && git clone https://github.com/bro/cmake" => NOK other subproject
     165        foreach m { cmake aux/binpac aux/bro-aux aux/broccoli aux/broctl aux/btest src/3rdparty } {
     166             system -W ${worksrcpath} "git submodule update --init --recursive ${m}"
     167        }
     168
     169        reinplace "s|\${BroBase}/spool|\${BroBase}/var/spool/bro|" ${worksrcpath}/aux/broctl/BroControl/options.py
     170        reinplace "s|\${BroBase}/logs|\${BroBase}/var/log/bro|" ${worksrcpath}/aux/broctl/BroControl/options.py
     171        reinplace "s|\${PREFIX}/logs|\${PREFIX}/var/log/bro|" ${worksrcpath}/aux/broctl/CMakeLists.txt
     172        reinplace "s|{BroBase}/logs|{BroBase}/var/log/bro|" ${worksrcpath}/aux/broctl/doc/broctl.rst
     173        reinplace "s|\${PREFIX}/spool|\${PREFIX}/var/spool/bro|" ${worksrcpath}/aux/broctl/CMakeLists.txt
     174        reinplace "s|{BroBase}/spool|{BroBase}/var/spool/bro|" ${worksrcpath}/aux/broctl/doc/broctl.rst
     175    }
     176
     177    conflicts  ${name}
     178    livecheck.type      none
     179}
     180
     181default_variants      +mhr
     182
     183## Extra scripts? http://www.bro.org/sphinx/scripts/scripts.html
     184variant mhr description { add plugin to query Team Cymru Malware Hash Registry } {
     185    master_sites-append   http://www.bro.org/sphinx/_downloads/
     186    distfiles-append    detect-MHR.bro
     187    ## This file has changed at least once, but is not versioned
     188    checksums-append    \
     189                        detect-MHR.bro \
     190                        rmd160  0a6f949e106bee07961864e4fefbb5396a5d3aab \
     191                        sha256  a33d0da4e527c2759a8f8db32fd224974ad4c8bfe71bd25cbf7086fdaf1ad868
     192
     193    post-destroot {
     194        ## no further actions needed. will be loaded by bro at next start
     195        copy ${distpath}/detect-MHR.bro ${destroot}${prefix}/share/broctl/scripts/
    55196    }
    56197}
    57198
    58 notes \
    59 "You'll need to set your BROHOME to ${prefix}/share/bro and your\
    60 BROPATH to ${prefix}/share/bro/site:${prefix}/share/bro/policy\
    61 to use the provided policies."
     199## https://github.com/LiamRandall/bro-scripts/tree/master/fire-scripts
     200## http://scrapbook.zscaler.com/2012/05/bro-script-to-extract-artifacts-from.html
     201## web ui: http://brownian.bro-ids.org/ ? but "Error! Could not connect to server - please check ELASTICSEARCH_SERVER in settings.py "
    62202
    63203livecheck.type      regex
    64204livecheck.url       ${homepage}download/