Add OpenDKIM Domain Key handling by Freddo3000 · Pull Request #631 · postfixadmin/postfixadmin · GitHub
Skip to content

Add OpenDKIM Domain Key handling#631

Merged
DavidGoodwin merged 5 commits into
postfixadmin:masterfrom
Freddo3000:feature/dkim
Jul 18, 2022
Merged

Add OpenDKIM Domain Key handling#631
DavidGoodwin merged 5 commits into
postfixadmin:masterfrom
Freddo3000:feature/dkim

Conversation

@Freddo3000

Copy link
Copy Markdown
Contributor

This pull request adds support for OpenDKIM's SQL Backend for KeyTable and SigningTable, allowing domain admins to add domain keys for their domains. There can be multiple domain keys for each domain, and the signing table allows admins to assign certain keys to domains and/or mailboxes.

Images

image
dkim-add-domain-key
image
dkim-add-sign-table-entry

Notes

  • This has not been tested with PostgreSQL, as I don't have experience working with it
  • This is also my first venture into PHP, though I tried to follow in the tracks of other components.
  • I'd like to have the two tables on a single page, but couldn't find any easy way to do it.
  • I'd also like to add the domain key description to the domain key option when creating sign table entries, though same issue as above.
  • I haven't done deep testing with OpenDKIM beyond that it reads from the database, as I don't have a full postfix/dovecot/etc setup on hand.

References


Resolves #335

@DavidGoodwin DavidGoodwin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@mo-rijndael

Copy link
Copy Markdown

@Freddo3000

Freddo3000 commented Jul 17, 2022

Copy link
Copy Markdown
Contributor Author

Is it possible to automatically generate keypair using opendkim-genkey? Also, IMO, would be nice to show only public key as DNS record, to just copy-paste it

Probably possible, though I don't have the time to add it in this PR. Also wanted to keep it relatively simple to start of with.

@DavidGoodwin

Copy link
Copy Markdown
Member

Is it possible to automatically generate keypair using opendkim-genkey? Also, IMO, would be nice to show only public key as DNS record, to just copy-paste it

Yes, I've been thinking the same :)

I've only not merged it because I've not had time to try using it ....

@DavidGoodwin

Copy link
Copy Markdown
Member

Code works on PostgreSQL now - the original SQL in upgrade.php didn't work with PostgreSQL (it didn't like backticks, it didn't like an index being created in the table spec) - so I just copied it into it's own _pgsql type function.

@DavidGoodwin DavidGoodwin merged commit 1bf978b into postfixadmin:master Jul 18, 2022
@Freddo3000 Freddo3000 deleted the feature/dkim branch July 18, 2022 20:17
@cboltz

cboltz commented Jul 18, 2022

Copy link
Copy Markdown
Member

I did two follow-up fixes:

  • 6a53b1a: Drop duplicate db_delete() call from DkimHandler and DkimsigningHandler. The hardcoded name is the same as $this->db_table, which effectively means running the same query twice. One of them is enough.
  • a8b4e3f: Update translations with DKIM texts so that DKIM support also works in other languages (done with language-update.sh --patch)

I also have a question: Would it be ok for you to rename the txtlarge field type to txta (short for "textarea")? That would have the small advantage to keep the type "column" in init_struct() limited to 4 chars, instead of widening it just for one field type.

@Freddo3000

Copy link
Copy Markdown
Contributor Author

I did two follow-up fixes:

* [6a53b1a](https://github.com/postfixadmin/postfixadmin/commit/6a53b1ab882446dda7111d63664afb06f4adf9af): Drop duplicate db_delete() call from DkimHandler and DkimsigningHandler. The hardcoded name is the same as $this->db_table, which effectively means running the same query twice. One of them is enough.

* [a8b4e3f](https://github.com/postfixadmin/postfixadmin/commit/a8b4e3f4358425ef06b08397637b31ac25e00be5): Update translations with DKIM texts so that DKIM support also works in other languages (done with `language-update.sh --patch`)

I also have a question: Would it be ok for you to rename the txtlarge field type to txta (short for "textarea")? That would have the small advantage to keep the type "column" in init_struct() limited to 4 chars, instead of widening it just for one field type.

I see no problem with that

cboltz added a commit that referenced this pull request Jul 23, 2022
... (think "textarea") to keep the field type name short.

This is a follow-up up #631 (comment)
@cboltz

cboltz commented Jul 23, 2022

Copy link
Copy Markdown
Member

txtlarge -> txta rename done.

@ETE-Design

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: DKIM

5 participants