Ticket #46087: patch-logsentry-Portfile.diff

File patch-logsentry-Portfile.diff, 9.7 KB (added by jul_bsd@…, 10 years ago)
  • security/logsentry/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 128369 2014-11-20 04:10:57Z khindenburg@macports.org $
     2# $Id: Portfile 50984 2009-05-14 21:08:43Z and.damore@macports.org $
    33
    44PortSystem          1.0
    55
    66name                logsentry
    77version             1.1.1
     8revision            1
    89distname            logcheck-${version}
    910categories          security
    10 maintainers         touche.fr.st:julien.touche
    11 description         logfile auditing tool
    12 long_description \
    13     Logsentry is a scheduled auditing tool that scans system log files \
    14     for security violations and unusual activity. Reports of suspicious \
    15     log entries are mailed to a specified user (usually root). \
    16     \
    17     Logsentry was formerly known as logcheck.
    18 
     11maintainers         yahoo.fr:jul_bsd openmaintainer
     12description         logfile auditing tool (previously logcheck)
     13long_description  \
     14          Logsentry is a scheduled auditing tool that scans system log files \
     15          for security violations and unusual activity. Reports of suspicious \
     16          log entries are mailed to a specified user (usually root). \
     17          \
     18          Logsentry was formerly known as logcheck.
    1919homepage            http://sourceforge.net/projects/sentrytools
    20 master_sites        sourceforge:sentrytools
    21 
    2220platforms           darwin
    23 checksums           md5 e97c2f096e219e20310c1b80e9e1bc29
     21license             GPL-2
    2422
    25 configure {}
    26 build.target        build
     23use_configure       no
     24#post-configure {
     25#    addgroup logcheck
     26#    add_users logcheck gid=[existsgroup logcheck] home=${prefix}/var/db/logcheck shell=/sbin/nologin realname=logcheck\ user
     27#}
     28add_users logcheck group=logcheck home=${prefix}/var/db/logcheck shell=/sbin/nologin realname=logcheck\ user
     29
     30
     31## original tool but unmaintained since 2003
     32if {${subport} eq ${name}} {
     33    checksums           rmd160  1865f598b4bf32af466d4aec5e0803249a61c442 \
     34                        sha256  dfe4cb29305c619dc0a0aca5b11b2bd397baccf3076b48f03457f66f299ab42e
     35    master_sites        sourceforge:sentrytools
     36    patchfiles          patch-Makefile.diff
     37    post-patch {
     38        reinplace "s|^TMPDIR = /usr/local/etc/tmp|TMPDIR = /var/tmp|" ${worksrcpath}/Makefile
     39        reinplace "s|^TMPDIR=/usr/local/etc/tmp|TMPDIR=/var/tmp|" ${worksrcpath}/systems/generic/logcheck.sh
     40        reinplace "s|/usr/local/etc/logcheck.|${prefix}/etc/${name}/logcheck.|" ${worksrcpath}/systems/generic/logcheck.sh
     41        reinplace "s|/usr/local/|${prefix}/|" ${worksrcpath}/systems/generic/logcheck.sh
     42    }
     43    build.target        build
     44    destroot.target     install
     45    variant universal {}
     46    build.args          CC=${configure.cc}
     47    configure.cflags-append "${configure.cflags} [get_canonical_archflags cc]"
     48
     49    destroot {
     50        xinstall -d ${destroot}${prefix}/etc/${name}
     51        xinstall -d ${destroot}${prefix}/share/doc/${name}
     52        foreach doc_file { CREDITS INSTALL README README.how.to.interpret README.keywords } {
     53            xinstall -m 644 ${worksrcpath}/$doc_file ${destroot}${prefix}/share/doc/${name}/
     54        }
     55        foreach file { logcheck.violations logcheck.violations.ignore \
     56             logcheck.ignore logcheck.hacking } {
     57            xinstall -m 644 ${worksrcpath}/systems/generic/$file ${destroot}${prefix}/etc/${name}/
     58        }
     59        xinstall -m 755 ${worksrcpath}/src/logtail ${destroot}${prefix}/bin/
     60        xinstall -m 755 ${worksrcpath}/systems/generic/logcheck.sh ${destroot}${prefix}/bin/
     61
     62        xinstall -d ${destroot}${prefix}/share/examples/logcheck
     63        xinstall ${filespath}/org.macports.logsentry.plist ${destroot}${prefix}/share/examples/logcheck/
     64        reinplace "s|%%PREFIX%%|${prefix}|" ${destroot}${prefix}/share/examples/logcheck/org.macports.logsentry.plist
     65    }
     66
     67    livecheck.type      regex
     68    livecheck.url       http://sourceforge.net/projects/sentrytools/files/logcheck%201.x/
     69    livecheck.regex     "logcheck-(\\d+(?:\\.\\d+)*)"
    2770
    28 patchfiles          patch-Makefile
    29 destroot.target     install
    30 
    31 post-patch {
    32     reinplace "s|^TMPDIR = /usr/local/etc/tmp|TMPDIR = ${prefix}/var/tmp|" ${worksrcpath}/Makefile
     71    conflicts ${name}-debian
    3372}
    3473
    35 destroot {
    36     file mkdir ${destroot}${prefix}/etc/${name}
    37     file mkdir ${destroot}${prefix}/share/doc/${name}
    38     foreach doc_file {
    39         CREDITS INSTALL README README.how.to.interpret README.keywords
    40     } { system "install -m 644 ${worksrcpath}/$doc_file ${destroot}${prefix}/share/doc/${name}" }
    41     foreach file {
    42         logcheck.violations logcheck.violations.ignore \
    43         logcheck.ignore logcheck.hacking
    44     } { system "install -m 644 ${worksrcpath}/systems/generic/$file ${destroot}${prefix}/etc/${name}" }
    45     system "install -m 755 ${worksrcpath}/src/logtail ${destroot}${prefix}/bin/"
    46     system "install -m 755 ${worksrcpath}/systems/generic/logcheck.sh ${destroot}${prefix}/bin/"
    47 }
     74## currently maintained tool by debian team, both install are not conflicting except for new plist
     75## FIXME! debian logcheck need lockfile-progs/liblockfile OK, syslog-summary?
     76subport ${name}-debian {
     77    homepage            https://packages.debian.org/fr/sid/logcheck
     78    version             1.3.17
     79    ## any mirror/keyword for debian?
     80    master_sites        http://ftp.de.debian.org/debian/pool/main/l/logcheck/
     81    distname            logcheck_${version}
     82    use_xz              yes
     83    checksums           rmd160  7fd13a3b41c97fe8458925031737c9e2d79c0afc \
     84                        sha256  c2d3fc323e8c6555e91d956385dbfd0f67b55872ed0f6a7ad8ad2526a9faf03a
     85    worksrcdir          logcheck-${version}
     86
     87    depends_run         port:lockfile-progs port:p5.16-mime-construct
     88
     89    ## All executable are now scripts: shell or perl
     90    build {}
     91    supported_archs     noarch
     92    destroot.destdir    DESTDIR=${destroot}${prefix}
     93
     94    post-patch {
     95        reinplace "s|DIR = usr/|DIR = |" ${worksrcpath}/Makefile
     96        reinplace "s|PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin|PATH=${prefix}/sbin:${prefix}/bin:/sbin:/bin:/usr/sbin:/usr/bin|" ${worksrcpath}/debian/logcheck.cron.d
     97        reinplace "s|/usr/bin/lockfile-|${prefix}/bin/lockfile-|" ${worksrcpath}/src/logcheck
     98        reinplace "s|=\"/etc|=\"${prefix}/etc|" ${worksrcpath}/src/logcheck
     99        reinplace "s|=\"/var|=\"${prefix}/var|" ${worksrcpath}/src/logcheck
     100        reinplace "s|=/var/lock|=${prefix}/var/lock|" ${worksrcpath}/src/logcheck
     101        reinplace "s|/usr/sbin/logtail2|${prefix}/sbin/logtail2|" ${worksrcpath}/src/logcheck
     102        reinplace "s|mktemp -d -p \"\$\{TMP:-/tmp\}\" |mktemp -d \${TMP:-/tmp}/|" ${worksrcpath}/src/logcheck
     103        reinplace "s|mime-construct|mime-construct-5.16|" ${worksrcpath}/src/logcheck
     104
     105        ## review install permissions, nothing sensitive
     106        reinplace "s|-m 750 |-m 755 |;s|-m 2750 |-m 2755 |;s|-m 640 |-m 644|;" ${worksrcpath}/Makefile
     107    }
     108    pre-destroot {
     109        xinstall -d -m 755 ${destroot}${prefix}/etc/logcheck
     110    }
     111    post-destroot {
     112        xinstall -d ${destroot}${prefix}/share/examples/logcheck
     113        xinstall ${worksrcpath}/debian/logcheck.cron.d ${destroot}${prefix}/share/examples/logcheck/
     114        xinstall ${filespath}/org.macports.logsentry.plist ${destroot}${prefix}/share/examples/logcheck/
     115        reinplace "s|%%PREFIX%%|${prefix}|" ${destroot}${prefix}/share/examples/logcheck/org.macports.logsentry.plist
     116        xinstall -d -o logcheck ${destroot}${prefix}/var/lib/logcheck
     117        xinstall -d ${destroot}${prefix}/share/docs/logcheck
     118        xinstall ${worksrcpath}/debian/README.Debian ${destroot}${prefix}/share/docs/logcheck/
     119        foreach f { README-psionic README.how.to.interpret README.keywords README.logcheck README.logcheck-database README.logtail } {
     120            xinstall ${worksrcpath}/docs/${f} ${destroot}${prefix}/share/docs/logcheck/
     121        }
     122        xinstall ${worksrcpath}/debian/header.txt ${destroot}${prefix}/etc/logcheck/
     123
     124        reinplace "s|/var/log/syslog|/private/var/log/system.log|;s|/var/log/auth.log|/var/log/authd.log|;" ${destroot}${prefix}/etc/logcheck/logcheck.logfiles
     125
     126        xinstall -o logcheck -d ${destroot}${prefix}/var/lock/logcheck
     127        destroot.keepdirs ${destroot}${prefix}/var/lib/logcheck ${destroot}${prefix}/var/lock/logcheck
     128    }
     129    test.run            yes
     130    test.target         system-test
     131
     132    livecheck.type      regex
     133    livecheck.url       ${homepage}
     134    livecheck.regex     "logcheck \\((\\d+(?:\\.\\d+)*)\\)"
     135
     136    ## FIXME! on run
     137    ## /opt/local/sbin/logcheck : ligne 426 : 47161 Segmentation fault: 11  $LOGTAIL $LOGTAIL_OPTS -f "$file" -o "$offsetfile" >> "$TMPDIR/logoutput/$(basename "$file")" 2>&1
     138
     139    notes "
     140This package contains Debian version of logcheck as original project is currently unmaintained since 2003.
     141You have an example cron and launchd configuration files in examples dir which are fit to run as the dedicated logcheck user.
     142
     143In order for logcheck user to read system log files, you have to include it in admin group
     144    # dseditgroup -o edit -a logcheck -t user admin
     145
     146You are also advised to check that local or remote mail delivery is enabled. You may need to adjust files
     147    /System/Library/LaunchDaemons/org.postfix.master.plist
     148    /etc/aliases
    48149
    49 post-destroot {
    50     file mkdir ${destroot}${prefix}/var/tmp
    51     system "touch ${destroot}${prefix}/var/tmp/.turd"
    52     system "chmod 700 ${destroot}${prefix}/var/tmp"
     150Please adapt to your environment before using in production.
     151"
     152
     153    conflicts ${name}
    53154}
     155
     156## FIXME! cron/launchd conf
     157