Skip to content

Commit

Permalink
finish exit_after_poll implementation; release 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jertel committed Dec 29, 2023
1 parent 177c65d commit 9828dd3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ An example configuration file is shown below, followed by descriptions of each s
| socket_timeout_seconds | false | Number of seconds (can be a decimal value) before timing out the POP3 connection. Defaults to 30 seconds.
| delete_messages | true | If set to 1, the messages will be deleted from the inbox after successful parsing. If set to 0, the messages will not be deleted (useful for debugging)
| delete_failures | false | If set to 1, invalid email messages will be deleted from the inbox. If set to 0, the failed messages will not be deleted (useful for debugging)
| exit_after_poll | false | If true, the process will exit after processing new messages. (useful for cron scheduling)
| exit_after_poll | false | If set to 1, the process will exit after processing new messages. Defaults to 0. (useful for cron scheduling)

## Environment Variables

Expand All @@ -109,7 +109,7 @@ The following environment variables are used as inputs for sensitive information
| SOCKET_TIMEOUT_SECONDS | false | Number of seconds (can be a decimal value) before timing out the POP3 connection. Defaults to 30 seconds.
| DELETE_MESSAGES | true | If set to 1, the messages will be deleted from the inbox after successful parsing. If set to 0, the messages will not be deleted (useful for debugging)
| DELETE_FAILURES | false | If set to 1, invalid email messages will be deleted from the inbox. If set to 0, the failed messages will not be deleted (useful for debugging)
| EXIT_AFTER_POLL | false | If true, the process will exit after processing new messages. (useful for cron scheduling)
| EXIT_AFTER_POLL | false | If set to 1, the process will exit after processing new messages. Defaults to 0. (useful for cron scheduling)

## Docker

Expand Down
4 changes: 2 additions & 2 deletions chart/dmarc2logstash/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
appVersion: "1.5.4"
appVersion: 1.6.0
description: Provides a POP3-polled DMARC XML report injector into Elasticsearch via Logstash and Filebeat
name: dmarc2logstash
version: 1.5.4
version: 1.6.0
home: https://github.com/jertel/dmarc2logstash
sources:
- https://github.com/jertel/dmarc2logstash
Expand Down
4 changes: 2 additions & 2 deletions chart/dmarc2logstash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The command removes all the Kubernetes components associated with the chart and
setting | description | default
----------------------------------|-----------------------------------------------------------------------------------------------------------------------|----------
dmarc2logstash.image.repository | dmarc2logstash Docker image repository | jertel/dmarc2logstash
dmarc2logstash.image.tag | dmarc2logstash image tag, typically the version, of the Docker image | 1.5.4
dmarc2logstash.image.tag | dmarc2logstash image tag, typically the version, of the Docker image | 1.6.0
dmarc2logstash.image.pullPolicy | dmarc2logstash Kubernetes image pull policy | IfNotPresent
delete_messages | Set to 1 to delete messages or 0 to preserve messages (useful for debugging) | 1
filebeat.image.repository | Elastic filebeat Docker image repository | docker.elastic.co/beats/filebeat
Expand All @@ -42,7 +42,7 @@ filebeat.image.pullPolicy | Elastic filebeat Kubernetes image pull polic
filebeat.logstash.host | Logstash service host; ex: logstash (this value must be provided) | ""
filebeat.logstash.port | Logstash service port | 5000
filebeat.logstash.sourceType | Logstash source type will allow custom filtering via the Logstash configuration | json-logs
filebeat.logstash.index | Elasticsearch index that will contain the new DMARC data (index will be created on-the-fly if doesn't exist) | dmarc
filebeat.logstash.index | Elasticsearch index that will contain the new DMARC data (index will be created on-the-fly if doesn't exist) | dmarc
filebeat.logstash.timeout | Seconds to wait before timing out the connection to logstash | 15

## Secrets
Expand Down
2 changes: 1 addition & 1 deletion chart/dmarc2logstash/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dmarc2logstash:
image:
repository: jertel/dmarc2logstash
tag: 1.5.4
tag: 1.6.0
pullPolicy: IfNotPresent
deleteMessages: 1
resources: {}
Expand Down
4 changes: 2 additions & 2 deletions src/dmarc2logstash.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def connect(server, username, password, timeout):
return conn

def isTrue(flag):
if flag == 1 or flag == "true" or flag == "True" or flag == "TRUE" or flag == True or flag == "yes" or flag == "YES" or flag == "Yes":
if flag == 1 or flag == "1" or flag == "true" or flag == "True" or flag == "TRUE" or flag == True or flag == "yes" or flag == "YES" or flag == "Yes":
return True
return False

Expand Down Expand Up @@ -189,7 +189,7 @@ def json_serial(obj):
raise TypeError ("Type %s not serializable" % type(obj))

def start(server, username, password, sleepSec, jsonOutputFile, timeout, shouldDelete, shouldDeleteFailures, exit_after_poll):
log.info("Starting DMARC to Logstash service; sleepSec=%d; jsonOutputFile=%s; shouldDelete=%s; shouldDeleteFailures=%s" % (sleepSec, jsonOutputFile, shouldDelete, shouldDeleteFailures))
log.info("Starting DMARC to Logstash service; sleepSec=%d; jsonOutputFile=%s; shouldDelete=%s; shouldDeleteFailures=%s; exit_after_poll=%s" % (sleepSec, jsonOutputFile, shouldDelete, shouldDeleteFailures, exit_after_poll))
while True:
download(server, username, password, jsonOutputFile, timeout, shouldDelete, shouldDeleteFailures)
if isTrue(exit_after_poll):
Expand Down
1 change: 1 addition & 0 deletions src/dmarc2logstash.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def testLookupHost(self):

def testIsTrue(self):
self.assertTrue(dmarc2logstash.isTrue(1))
self.assertTrue(dmarc2logstash.isTrue("1"))
self.assertTrue(dmarc2logstash.isTrue(True))
self.assertTrue(dmarc2logstash.isTrue('true'))
self.assertTrue(dmarc2logstash.isTrue('TRUE'))
Expand Down

0 comments on commit 9828dd3

Please sign in to comment.