trusteddomainproject / OpenDKIM

Other
97 stars 52 forks source link

Insufficient validation when parsing SigningTable leads to crash #118

Open mdomsch opened 3 years ago

mdomsch commented 3 years ago

Original report: https://bugzilla.redhat.com/show_bug.cgi?id=1871751 Description of problem: When postfix send the mail via milter to the opendkim daemon for singing, opendkim will crash

Version-Release number of selected component (if applicable): opendkim-2.11.0-0.1.el7.x86_64

Actual results: Crash of the daemon.

Expected results: That the signature is added.

Additional crash data is available in the above bugzilla bug.

After some tests, it looks like opendkim don't validate the config file syntax. Using @foo.foo instant of @foo.foo foo.foo in the /etc/opendkim/SigningTable file will trigger the crash

giosh94mhz commented 8 months ago

I was able to reproduce this issue on a production server with a simple /etc/opendkim/SigningTable containing only * . According to the man this configuration should match everything, and map to no key which I expected will resolve to "no signing", but instead it crashes

futatuki commented 8 months ago

I cannot reproduce it with the code from latest develop branch + some PRs https://github.com/futatuki/OpenDKIM/tree/main. With SigningTable only contains @foo.foo without space or with trailing space or tab, or only contains * without space or with trailing space or tab, it shows

opendkim: /usr/local/etc/mail/opendkim.conf: could not find valid key record "" in KeyTable

and exit with code 1

Is it already fixed between OpenDKIM-2.11.0-Alpha0 and HEAD of develop branch ? (I don't think emploied PRs I did not related to this issue)

futatuki commented 8 months ago

It seems this is already fixed in https://github.com/trusteddomainproject/OpenDKIM/commit/8139342b5e3ed455f7941f3205fd7e7c3ddf47bf before 2.11.0-BETA2.