Skip to content

Commit d95b8e4

Browse files
committed
Merge pull request trusteddomainproject#228 from r-a-z-v-a-n/CheckSigningTable
Add CheckSigningTable config option When CheckSigningTable is set to no, the keys in KeyTable are no longer verified when config is loaded. Also implement a command line option -g for skipping SigningTable verification. trusteddomainproject#228
2 parents ad3ac8c + c7d845b commit d95b8e4

File tree

5 files changed

+33
-2
lines changed

5 files changed

+33
-2
lines changed

opendkim/opendkim-config.h

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct configdef dkimf_config[] =
4444
{ "Canonicalization", CONFIG_TYPE_STRING, FALSE },
4545
{ "CaptureUnknownErrors", CONFIG_TYPE_BOOLEAN, FALSE },
4646
{ "ChangeRootDirectory", CONFIG_TYPE_STRING, FALSE },
47+
{ "CheckSigningTable", CONFIG_TYPE_BOOLEAN, FALSE },
4748
{ "ClockDrift", CONFIG_TYPE_INTEGER, FALSE },
4849
#ifdef _FFR_CONDITIONAL
4950
{ "ConditionalSignatures", CONFIG_TYPE_STRING, FALSE },

opendkim/opendkim.8.in

+4
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ Normally
282282
forks and exits immediately, leaving the service running in the background.
283283
This flag suppresses that behaviour so that it runs in the foreground.
284284
.TP
285+
.I \-g
286+
Skip checking the SigningTable for any missing keys in the KeyTable. This
287+
is the same as setting CheckSigningTable=no in opendkim.conf(5).
288+
.TP
285289
.I \-F time
286290
Specifies a fixed time to use when generating signatures. Ignored unless
287291
also used in conjunction with

opendkim/opendkim.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
#endif /* _FFR_REPUTATION */
138138

139139
/* macros */
140-
#define CMDLINEOPTS "Ab:c:d:De:fF:k:lL:no:p:P:Qrs:S:t:T:u:vVWx:X?"
140+
#define CMDLINEOPTS "Ab:c:d:De:fF:gk:lL:no:p:P:Qrs:S:t:T:u:vVWx:X?"
141141

142142
#ifndef MIN
143143
# define MIN(x,y) ((x) < (y) ? (x) : (y))
@@ -248,6 +248,7 @@ struct dkimf_config
248248
_Bool conf_noheaderb; /* suppress "header.b" */
249249
_Bool conf_singleauthres; /* single Auth-Results */
250250
_Bool conf_safekeys; /* check key permissions */
251+
_Bool conf_checksigningtable; /* skip checking keys on startup */
251252
#ifdef _FFR_RESIGN
252253
_Bool conf_resignall; /* resign unverified mail */
253254
#endif /* _FFR_RESIGN */
@@ -5892,6 +5893,7 @@ dkimf_config_new(void)
58925893
new->conf_atpshash = dkimf_atpshash[0].str;
58935894
#endif /* _FFR_ATPS */
58945895
new->conf_selectcanonhdr = SELECTCANONHDR;
5896+
new->conf_checksigningtable = TRUE;
58955897

58965898
memcpy(&new->conf_handling, &defaults, sizeof new->conf_handling);
58975899

@@ -6209,6 +6211,10 @@ dkimf_config_load(struct config *data, struct dkimf_config *conf,
62096211
sizeof conf->conf_softstart);
62106212
#endif /* (USE_LDAP || USE_ODBX) */
62116213

6214+
(void) config_get(data, "CheckSigningTable",
6215+
&conf->conf_checksigningtable,
6216+
sizeof conf->conf_checksigningtable);
6217+
62126218
(void) config_get(data, "DNSConnect",
62136219
&conf->conf_dnsconnect,
62146220
sizeof conf->conf_dnsconnect);
@@ -8333,7 +8339,7 @@ dkimf_config_load(struct config *data, struct dkimf_config *conf,
83338339
** missing KeyTable entries.
83348340
*/
83358341

8336-
if (conf->conf_signtabledb != NULL)
8342+
if (conf->conf_signtabledb != NULL && conf->conf_checksigningtable != FALSE)
83378343
{
83388344
_Bool first = TRUE;
83398345
_Bool found;
@@ -15508,6 +15514,7 @@ usage(void)
1550815514
"\t-e name \textract configuration value and exit\n"
1550915515
"\t-f \tdon't fork-and-exit\n"
1551015516
"\t-F time \tfixed timestamp to use when signing (test mode only)\n"
15517+
"\t-g \tdo not walk SigningTable when loading config\n"
1551115518
"\t-k keyfile \tlocation of secret key file\n"
1551215519
"\t-l \tlog activity to system log\n"
1551315520
"\t-L limit \tsignature limit requirements\n"
@@ -15687,6 +15694,11 @@ main(int argc, char **argv)
1568715694
}
1568815695
break;
1568915696

15697+
case 'g':
15698+
curconf->conf_checksigningtable = FALSE;
15699+
break;
15700+
15701+
1569015702
case 'k':
1569115703
if (optarg == NULL || *optarg == '\0')
1569215704
return usage();

opendkim/opendkim.conf.5.in

+5
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ requires superuser access. A warning will be generated if
179179
.I UserID
180180
is not also set.
181181

182+
.TP
183+
.I CheckSigningTable (Boolean)
184+
If set to yes, it walks the SigningTable on boot when it loads the config
185+
file to check for missing keys in KeyTable. The default is yes.
186+
182187
.TP
183188
.I ClockDrift (integer)
184189
Sets the tolerance in seconds to be applied when determining whether a

opendkim/opendkim.conf.sample

+9
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@
129129

130130
# Canonicalization simple/simple
131131

132+
## CheckSigningTable { yes | no }
133+
## default "yes"
134+
##
135+
## If set, the SigningTable will be checked for missing keys in
136+
## KeyTable when loading the config. This can take a longer time with
137+
## larger databases. Requires opendbx.
138+
139+
# CheckSigningTable yes
140+
132141
## ClockDrift n
133142
## default 300
134143
##

0 commit comments

Comments
 (0)