From 96923ed3de7b3137456ee3959fb9d272d1b00d08 Mon Sep 17 00:00:00 2001 From: Art Date: Fri, 14 Jun 2019 19:31:48 +0300 Subject: [PATCH 1/6] change hardcode timezone from UTC to Europe/Moscow --- phplib/Target/Jira.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phplib/Target/Jira.php b/phplib/Target/Jira.php index f80b365..d107c7e 100644 --- a/phplib/Target/Jira.php +++ b/phplib/Target/Jira.php @@ -38,7 +38,8 @@ public function process(Alert $alert, $date) { $title = sprintf('[%s] %s', $site['name'], $search['name']); $desc = []; - $desc[] = sprintf('Date: %s', gmdate(DATE_RSS, $alert['alert_date'])); + date_default_timezone_set('Europe/Moscow'); + $desc[] = sprintf('Date: %s', date(DATE_RSS, $alert['alert_date'])); // Don't show the link if this Alert isn't persisted. if(!$alert->isNew()) { From 858b8ae7556fd95e00a59391f446b929c89aa025 Mon Sep 17 00:00:00 2001 From: Art Date: Fri, 14 Jun 2019 19:34:32 +0300 Subject: [PATCH 2/6] move exim config to /data volume --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 188dfe9..89eb60a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM php:7-apache AS builder -ARG COMPOSER=composer-es2x.json +ARG COMPOSER=composer-es6x.json WORKDIR /app RUN apt-get update && \ @@ -74,6 +74,11 @@ RUN ln -sf /data/411.conf /etc/apache2/sites-available/000-default.conf RUN ln -sf /data/mail.ini /usr/local/etc/php/conf.d/ RUN ln -sf /data/411_cron /etc/cron.d/ +RUN cp /etc/exim4/passwd.client /data/passwd.client +RUN cp /etc/exim4/update-exim4.conf.conf /data/update-exim4.conf.conf +RUN ln -sf /data/passwd.client /etc/exim4/passwd.client +RUN ln -sf /data/update-exim4.conf.conf /etc/exim4/update-exim4.conf.conf + VOLUME /data EXPOSE 80 CMD ["/usr/bin/supervisord", "-c", "/data/supervisord.conf"] From cce7d140b50c2c59d46a4cd59fffabecfef017eb Mon Sep 17 00:00:00 2001 From: Art Date: Tue, 25 Jun 2019 12:10:51 +0300 Subject: [PATCH 3/6] modify ES class for es7x support --- htdocs/assets/js/views/searches/search/load.js | 2 +- phplib/Search/ES.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/assets/js/views/searches/search/load.js b/htdocs/assets/js/views/searches/search/load.js index d723bd0..7a0090d 100755 --- a/htdocs/assets/js/views/searches/search/load.js +++ b/htdocs/assets/js/views/searches/search/load.js @@ -19,7 +19,7 @@ define(function(require) { SearchView.registerSubclass('http', HTTPSearchView); SearchView.registerSubclass('graphite', GraphiteSearchView); SearchView.registerSubclass('threatexchange', ThreatexchangeSearchView); - SearchView.registerSubclass('es', ElasticsearchSearchView); + SearchView.registerSubclass('_doc', ElasticsearchSearchView); SearchView.registerSubclass('alert', ElasticsearchSearchView); SearchView.registerSubclass('ecl', ECLSearchView); SearchView.registerSubclass('push', PushSearchView); diff --git a/phplib/Search/ES.php b/phplib/Search/ES.php index ec3c3ab..68db9c0 100644 --- a/phplib/Search/ES.php +++ b/phplib/Search/ES.php @@ -3,7 +3,7 @@ namespace FOO; class ES_Search extends Elasticsearch_Search { - public static $TYPE = 'es'; + public static $TYPE = '_doc'; public static function getSources() { $sources = []; From ef03340c3d94707fa00d0eb7d2ac1c1121137c89 Mon Sep 17 00:00:00 2001 From: Art Date: Tue, 25 Jun 2019 14:24:19 +0300 Subject: [PATCH 4/6] create composer file for es7x and fix it in dockerfile --- Dockerfile | 2 +- composer-es7x.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100755 composer-es7x.json diff --git a/Dockerfile b/Dockerfile index 89eb60a..d001c34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM php:7-apache AS builder -ARG COMPOSER=composer-es6x.json +ARG COMPOSER=composer-es7x.json WORKDIR /app RUN apt-get update && \ diff --git a/composer-es7x.json b/composer-es7x.json new file mode 100755 index 0000000..ead7090 --- /dev/null +++ b/composer-es7x.json @@ -0,0 +1,42 @@ +{ + "name": "etsy/411", + "description": "An Alert Management Web Application", + "config": { + "platform": { + "php": "7.0.0" + } + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/dsvetlov/esquery" + } + ], + "require": { + "mtdowling/cron-expression": "^1.1", + "php-curl-class/php-curl-class": "^4.6", + "setasign/fpdf": "^1.7", + "symfony/expression-language": "^3.1", + "elasticsearch/elasticsearch": "^6.0", + "kiwiz/esquery": "dev-master", + "kiwiz/ecl": ">=1.0", + "ext-pcntl": ">=5.5", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "d11wtq/boris": "^1.0", + "phpdocumentor/phpdocumentor": "^2.8", + "techlivezheng/phpctags": "^0.6.0" + }, + "authors": [ + { + "name": "Kai Zhong", + "email": "z@kwi.li" + }, + { + "name": "Ken Lee", + "email": "kennysanx@hotmail.com" + } + ] +} From f5a8e350523d26f8576185dfc851b76e8ed730f5 Mon Sep 17 00:00:00 2001 From: Art Date: Wed, 26 Jun 2019 19:12:41 +0300 Subject: [PATCH 5/6] fix index template for es7x --- phplib/ESClient.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/phplib/ESClient.php b/phplib/ESClient.php index 11206ff..8f0107e 100644 --- a/phplib/ESClient.php +++ b/phplib/ESClient.php @@ -87,7 +87,6 @@ public function initializeIndex() { 'body' => [ 'template' => '411_alerts_*', 'mappings' => [ - '_default_' => [ 'properties' => [ 'alert_date' => ['type' => 'date', 'format' => 'epoch_second'], 'assignee_type' => ['type' => 'long'], @@ -109,7 +108,6 @@ public function initializeIndex() { 'update_date' => ['type' => 'date', 'format' => 'epoch_second'], ] ] - ] ] ]); } From 6ededa26af27d603b0c44d10a394d1b31ad9adf1 Mon Sep 17 00:00:00 2001 From: golaso <42374572+golaso@users.noreply.github.com> Date: Wed, 26 Jun 2019 19:20:08 +0300 Subject: [PATCH 6/6] return GMT timezone to Jira target --- phplib/Target/Jira.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phplib/Target/Jira.php b/phplib/Target/Jira.php index d107c7e..35c15a7 100644 --- a/phplib/Target/Jira.php +++ b/phplib/Target/Jira.php @@ -38,9 +38,8 @@ public function process(Alert $alert, $date) { $title = sprintf('[%s] %s', $site['name'], $search['name']); $desc = []; - date_default_timezone_set('Europe/Moscow'); - $desc[] = sprintf('Date: %s', date(DATE_RSS, $alert['alert_date'])); - + $desc[] = sprintf('Date: %s', gmdate(DATE_RSS, $alert['alert_date'])); + // Don't show the link if this Alert isn't persisted. if(!$alert->isNew()) { $desc[] = sprintf('[Link to Alert|%s]', $site->urlFor(