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} |
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 | |
| 87 | startupitem.create yes |
| 88 | startupitem.netchange yes |
| 89 | startupitem.start "${prefix}/bin/broctl start" |
| 90 | startupitem.stop "${prefix}/bin/broctl stop" |
| 91 | startupitem.restart "${prefix}/bin/broctl restart" |
| 92 | |
| 93 | notes " |
| 94 | You'll need to set your BROHOME to ${prefix}/share/bro and your |
| 95 | BROPATH to ${prefix}/share/bro/site:${prefix}/share/bro/policy |
| 96 | to use the provided policies. (which user?) |
| 97 | |
| 98 | Check online documentation to finish install |
| 99 | http://www.bro.org/sphinx/quickstart/index.html |
| 100 | |
| 101 | 1) review config: node.cfg, network.cfg, broctl.cfg |
| 102 | especially network interface, MailTo |
| 103 | Existing files have not been modified |
| 104 | |
| 105 | 2) Run as root or w sudo |
| 106 | # broctl |
| 107 | \[BroControl\] > install |
| 108 | \[BroControl\] > start |
| 109 | 3) 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 | |
| 115 | Paths 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 | |
| 120 | BUG: System App firewall ask at each launch if bro can accept incoming connections. |
| 121 | BUG: eating cpu... |
| 122 | |
| 123 | " |
| 124 | |
| 125 | if {${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 | |
| 147 | subport ${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 | |
| 181 | default_variants +mhr |
| 182 | |
| 183 | ## Extra scripts? http://www.bro.org/sphinx/scripts/scripts.html |
| 184 | variant 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/ |