{"id":26091804,"url":"https://github.com/nabbar/opendmarc-reports","last_synced_at":"2025-03-09T10:24:06.115Z","repository":{"id":57511350,"uuid":"141884278","full_name":"nabbar/opendmarc-reports","owner":"nabbar","description":"This tools import opendmarc history file into database and generate report from this database","archived":false,"fork":false,"pushed_at":"2019-04-27T20:20:19.000Z","size":191,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T03:54:35.875Z","etag":null,"topics":["ftp","golang","http","import","opendmarc","report","smtp"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nabbar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-22T09:57:03.000Z","updated_at":"2021-03-15T17:06:33.000Z","dependencies_parsed_at":"2022-08-29T04:42:18.252Z","dependency_job_id":null,"html_url":"https://github.com/nabbar/opendmarc-reports","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabbar%2Fopendmarc-reports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabbar%2Fopendmarc-reports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabbar%2Fopendmarc-reports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabbar%2Fopendmarc-reports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabbar","download_url":"https://codeload.github.com/nabbar/opendmarc-reports/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242676078,"owners_count":20167655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ftp","golang","http","import","opendmarc","report","smtp"],"created_at":"2025-03-09T10:24:05.512Z","updated_at":"2025-03-09T10:24:06.108Z","avatar_url":"https://github.com/nabbar.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenDMARC Report generator\n\nThis tools import opendmarc history file into database and generate report from database\nThis tools run in multi thread process to limit time for generating report\n\nThis tools is based on OpenDmarc Perl script but without errors and with more efficient process\n\nIn add, this tools allow to send report in HTTP(s) / FTP(s) rua in add of Mail.\n\n## Build the tools\nIt is never recommended to use directly built binary who's not included in offical os repository\nIn fact, if you find this tools in your distribution you can install it directly.\nOtherwise, it is recommend to use the source to build it your self, in your secure environment.\n\nFor a best security, rebuilt this tools each week with this recommanded 4 steps process.\n\n### 1 - Get the dependencies tools \nthe build use the golang dep tools : https://golang.github.io/dep/\n```shell\nSRCTGZ=$(mktemp)\nSRCURL=$(curl -s https://api.github.com/repos/golang/dep/releases/latest | jq '.tarball_url')\nPKGDIR=$(echo \"${GOPATH}/src/github.com/golang/dep\")\n[ -e ${PKGDIR} ] || mkdir -vp ${PKGDIR}\nwget -O ${SRCTGZ} ${SRCURL} \ntar -xzf ${SRCTGZ} --strip 1 -C ${PKGDIR}\ncd ${PKGDIR}\nmake install\n```\n\n### 2 - Get source in correct the correct package folder in go path:\nWe will download a tarball archive of the source\n```shell\nSRCTGZ=$(mktemp)\nSRCURL=$(curl -s https://api.github.com/repos/nabbar/opendmarc-reports/releases/latest | jq '.tarball_url')\nPKGDIR=$(echo \"${GOPATH}/src/github.com/nabbar/opendmarc-reports\")\n[ -e ${PKGDIR} ] || mkdir -vp ${PKGDIR}\nwget -O ${SRCTGZ} ${SRCURL}\ntar -xzf ${SRCTGZ} --strip 1 -C ${PKGDIR}\ncd ${PKGDIR}\n```\n\n### 3 - Regen Root Certificates\nWe will print all RootCA to include your own rootCA.\nWhen running the script, we will use rootCA added of this list of CA\n```shell\ncd ${GOPATH}/src/github.com/nabbar/opendmarc-reports\n./makeCertif\n```\n\n### 4 - Build the tools\n```shell\ncd ${GOPATH}/src/github.com/nabbar/opendmarc-reports\n./genVersion\n[ ! -e opendmarc-reports ] || mv -vf opendmarc-reports /usr/local/bin/opendmarc-reports\n```\n\n## Use the tools\nBasicly running the tools without config file or params will show : \n\n```shell\nallow to import history file into mysql DB,\ngenerate report from this mysql DB normalized as OpenDMARC reports\nand send them to MX server of each reports'domains'\n\nUsage:\n  opendmarc-reports [command]\n\nAvailable Commands:\n  config      Generate config file\n  help        Help about any command\n  import      Import dat history file\n  report      Generate a report and send it\n\nFlags:\n  -c, --config string         config file (default is $HOME/.opendmarc.[yaml|json|toml])\n  -d, --database string       Mysql Database params formatted as DSN string: \u003cuser\u003e:\u003cpassword\u003e@protocol(\u003chost\u003e:\u003cport\u003e|\u003csocket path\u003e)/\u003cdatabase\u003e[?[params[=value]]] (default \"opendmarc:opendmarc@tcp(localhost:3306)/opendmarc\")\n  -y, --day                   Send report for yesterday's data (default true)\n  -m, --domain strings        Force a report for named domain list (multiple flag allowed)\n  -h, --help                  help for opendmarc-reports\n  -i, --interval string       Report interval duration (default \"24h\")\n  -e, --no-domain strings     Omit a report for named domain list (multiple flag allowed)\n  -u, --no-update             Don't record report transmission\n      --report-copy string    Report bcc email list (comma separated)\n      --report-email string   Report email sender\n      --report-org string     Report organisation sender\n  -s, --smtp string           SMTP server params formatted as DSN string: \u003cuser\u003e:\u003cpassword\u003e@tcp(\u003chost|ip\u003e:\u003cport\u003e)/[none|tls|starttls][?[serverName|skiptlsverify]=\u003cvalue\u003e] (default \"postmaster@localdomain:opendmarc@tcp(localhost:25)/tls\")\n  -t, --test                  Don't send reports\n  -z, --utc                   Operate in UTC\n  -v, --verbose count         Enable verbose mode (multi allowed v, vv, vvv)\n      --version               version for opendmarc-reports\n\nUse \"opendmarc-reports [command] --help\" for more information about a command.\n\n```\n\nNote : the tables in the database will be create if they are not existing, but for security this tools will not create the database.\nThe right assign to the user must be in the database : CREATE TABLE, SELECT, INSERT, DELETE, UPDATE\n\n### 1 - Generate a default config file \n\nUse the command \"config\" with args as you want to generate a config file.\nThe exact use is this : \n\n```shell\nGenerate a configuration file based on\ngiving existing config flag\noverride by passed flag in command line\nand completed with default for non existing values\n.\n\nUsage:\n  opendmarc-reports config \u003cfile path to be generated\u003e [flags]\n\nExamples:\nconfig ~/.dmarc-reports.yml\n\nFlags:\n  -h, --help   help for config\n\nGlobal Flags:\n  -c, --config string         config file (default is $HOME/.opendmarc.[yaml|json|toml])\n  -d, --database string       Mysql Database params formatted as DSN string: \u003cuser\u003e:\u003cpassword\u003e@protocol(\u003chost\u003e:\u003cport\u003e|\u003csocket path\u003e)/\u003cdatabase\u003e[?[params[=value]]] (default \"opendmarc:opendmarc@tcp(localhost:3306)/opendmarc\")\n  -y, --day                   Send report for yesterday's data (default true)\n  -m, --domain strings        Force a report for named domain list (multiple flag allowed)\n  -i, --interval string       Report interval duration (default \"24h\")\n  -e, --no-domain strings     Omit a report for named domain list (multiple flag allowed)\n  -u, --no-update             Don't record report transmission\n      --report-copy string    Report bcc email list (comma separated)\n      --report-email string   Report email sender\n      --report-org string     Report organisation sender\n  -s, --smtp string           SMTP server params formatted as DSN string: \u003cuser\u003e:\u003cpassword\u003e@tcp(\u003chost|ip\u003e:\u003cport\u003e)/[none|tls|starttls][?[serverName|skiptlsverify]=\u003cvalue\u003e] (default \"postmaster@localdomain:opendmarc@tcp(localhost:25)/tls\")\n  -t, --test                  Don't send reports\n  -z, --utc                   Operate in UTC\n  -v, --verbose count         Enable verbose mode (multi allowed v, vv, vvv)\n\n```\n\nWhen generated you can use this config as default config by specify -c if not in the default path and default name.\nThe great interest of this file is to store your credentials but still allow you to override any config the current run without saving this overrides.\nAs the for example to use defautl config but for this run use UTC date/time, you can run a command like this :\n```shell\nopendmarc-reports \u003ccommand\u003e -c \u003cpath to no default config path\u003e --utc \u003cargs...\u003e\n```\n\nOnce generated, you can modify the config file as you want or calling again the config command to overwrite your file with other default config\n\n### 2 - Import history files\nTo import history file, the command is \"import\".\nBy default this tools will looking for job id in database and if find a same jobid, It will update it, otherwise it will insert it.\nThe import command will run a multi thread of each path given. The path could be folder, file or pattern.\nthe help of this command will show : \n\n```shell\nImport OpenDMARC history file\ninto mysql database. If not exist create\nthe record else update it.\n\nUsage:\n  opendmarc-reports import \u003cdat file pattern\u003e [\u003cdat file pattern\u003e, ...] [flags]\n\nExamples:\nimport /var/tmp/dmarc.dat /var/tmp/opendmarc.*\n\nFlags:\n  -h, --help   help for import\n\nGlobal Flags:\n  -c, --config string         config file (default is $HOME/.opendmarc.[yaml|json|toml])\n  -d, --database string       Mysql Database params formatted as DSN string: \u003cuser\u003e:\u003cpassword\u003e@protocol(\u003chost\u003e:\u003cport\u003e|\u003csocket path\u003e)/\u003cdatabase\u003e[?[params[=value]]] (default \"opendmarc:opendmarc@tcp(localhost:3306)/opendmarc\")\n  -y, --day                   Send report for yesterday's data (default true)\n  -m, --domain strings        Force a report for named domain list (multiple flag allowed)\n  -i, --interval string       Report interval duration (default \"24h\")\n  -e, --no-domain strings     Omit a report for named domain list (multiple flag allowed)\n  -u, --no-update             Don't record report transmission\n      --report-copy string    Report bcc email list (comma separated)\n      --report-email string   Report email sender\n      --report-org string     Report organisation sender\n  -s, --smtp string           SMTP server params formatted as DSN string: \u003cuser\u003e:\u003cpassword\u003e@tcp(\u003chost|ip\u003e:\u003cport\u003e)/[none|tls|starttls][?[serverName|skiptlsverify]=\u003cvalue\u003e] (default \"postmaster@localdomain:opendmarc@tcp(localhost:25)/tls\")\n  -t, --test                  Don't send reports\n  -z, --utc                   Operate in UTC\n  -v, --verbose count         Enable verbose mode (multi allowed v, vv, vvv)\n\n```\n\nThis command will not modify any file !\n\n### 3 - Generate and Send report\nTo send the report to each rua of db store job, use the \"report\" command.\nThe process will make a thread for each rua domain * rua request * rua protocol destination.\nThis feature is interessting to having a running time like the more long send report to one destination.\n\nIn this case, this tools will open multiple connection to SMTP server, HTTP(s) destination, FPT(s) destination.\nIn your SMTP server, if you have a DKIM signature process the generated mail will use it.\n\nthe help for the report command is :\n\n```shell\nLoad OpenDMARC history data from mysql database,\ngenerate report for selected domains or all domains,\nand sent it by mail through SMTP server.\n\nUsage:\n  opendmarc-reports report [flags]\n\nExamples:\nreport\n\nFlags:\n  -h, --help   help for report\n\nGlobal Flags:\n  -c, --config string         config file (default is $HOME/.opendmarc.[yaml|json|toml])\n  -d, --database string       Mysql Database params formatted as DSN string: \u003cuser\u003e:\u003cpassword\u003e@protocol(\u003chost\u003e:\u003cport\u003e|\u003csocket path\u003e)/\u003cdatabase\u003e[?[params[=value]]] (default \"opendmarc:opendmarc@tcp(localhost:3306)/opendmarc\")\n  -y, --day                   Send report for yesterday's data (default true)\n  -m, --domain strings        Force a report for named domain list (multiple flag allowed)\n  -i, --interval string       Report interval duration (default \"24h\")\n  -e, --no-domain strings     Omit a report for named domain list (multiple flag allowed)\n  -u, --no-update             Don't record report transmission\n      --report-copy string    Report bcc email list (comma separated)\n      --report-email string   Report email sender\n      --report-org string     Report organisation sender\n  -s, --smtp string           SMTP server params formatted as DSN string: \u003cuser\u003e:\u003cpassword\u003e@tcp(\u003chost|ip\u003e:\u003cport\u003e)/[none|tls|starttls][?[serverName|skiptlsverify]=\u003cvalue\u003e] (default \"postmaster@localdomain:opendmarc@tcp(localhost:25)/tls\")\n  -t, --test                  Don't send reports\n  -z, --utc                   Operate in UTC\n  -v, --verbose count         Enable verbose mode (multi allowed v, vv, vvv)\n```\n\n## Contribute\n\nThe day have only 24h and so I will thanks you a lot if you want contribute.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabbar%2Fopendmarc-reports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabbar%2Fopendmarc-reports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabbar%2Fopendmarc-reports/lists"}