Snort3 (PulledPork)

PulledPork

・Perl module
    [root]# cpan LWP::UserAgent::Determined Net::SSLeay
                            LWP::Protocol::https Sys::Syslog Archive::Tar
・Installation
    [root]# mkdir -p /usr/local/pulledpork/etc
    [root]# git clone https://github.com/shirkdog/pulledpork.git
    [root]# cp -v pulledpork/pulledpork.pl /usr/local/pulledpork/
    [root]# cp -v pulledpork/etc/* /usr/local/pulledpork/etc/
    [root]# chown -R snort:snort /usr/local/pulledpork/
    [root]# chmod 755 /usr/local/pulledpork/pulledpork.pl
・Constitution
    [root]# vim /usr/local/pulledpork/etc/pulledpork.conf

      rule_url=https://www.snort.org/reg-rules/|snortrules-snapshot.tar.gz|<OINKCODE>

      #ignore=deleted.rules,experimental.rules,local.rules

      rule_path=/usr/local/snort/rules/snort.rules

      local_rules=/usr/local/snort/rules/local.rules

      sid_msg=/usr/local/snort/etc/snort/sid-msg.map

      sid_changelog=/var/log/sid_changes.log

      snort_path=/usr/local/snort/bin/snort

      config_path=/usr/local/snort/etc/snort/snort.lua

      distro=Centos-8

      block_list=/usr/local/snort/intel/ip-blocklist

      IPRVersion=/usr/local/snort/intel/

      snort_control=/usr/local/bin/snort_control

      pid_path=/var/log/snort/snort.pid

      #snort_version=3.1.0.0
      snort_version=3.2.0.0

      enablesid=/usr/local/pulledpork/etc/enablesid.conf
      dropsid=/usr/local/pulledpork/etc/dropsid.conf
      disablesid=/usr/local/pulledpork/etc/disablesid.conf
      modifysid=/usr/local/pulledpork/etc/modifysid.conf

      #ips_policy=security  <-- comment out

      version=0.8.0
・Run PulledPork and update rule file
    [root]# /usr/local/pulledpork/pulledpork.pl
                -c /usr/local/pulledpork/etc/pulledpork.conf -PE -v -T -H SIGHUP

    ※ If the rule file cannot be updated.

    [root]# curl -Lo snortrules-snapshot-3200.tar.gz
                https://www.snort.org/rules/snortrules-snapshot-3200.tar.gz?oinkcode=<OINKCODE>

    [root]# tar xvfz snortrules-snapshot-3200.tar.gz
    [root]# cat rules/*.rules > /usr/local/snort/rules/snort.rules
    [root]# ls -lh /usr/local/snort/rules/snort.rules

      -rw-r--r-- 1 root root   23M  2月 13 17:42 /usr/local/snort/rules/snort.rules
・Periodically run PulledPork with systemd timer instead of cron
    [root]# vim /etc/systemd/system/pulledpork.service

      [Unit]
      Description=PulledPork service for updating Snort 3 rules
      Wants=pulledpork.timer

      [Service]
      Type=oneshot
      RemainAfterExit = yes
      ProtectSystem = true
      ProtectHome = true
      ReadWritePaths = /usr/local/snort /usr/local/pulledpork
      ExecStart=/usr/local/pulledpork/pulledpork.pl
                    -c /usr/local/pulledpork/etc/pulledpork.conf -PE -v -T -H SIGHUP

      [Install]
      WantedBy=multi-user.target

    [root]# vim /etc/systemd/system/pulledpork.timer

      [Unit]
      Description=PulledPork service timer for updating Snort 3 rules
      Requires=pulledpork.service

      [Timer]
      Unit=pulledpork.service
      OnCalendar=*-*-* 00:15:00
      AccuracySec=1us

      [Install]
      WantedBy=timers.target

    [root]# systemctl daemon-reload
    [root]# systemctl enable pulledpork.timer