aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Jung <mail@umaxx.net>2016-05-18 22:19:16 +0200
committerJoerg Jung <mail@umaxx.net>2016-05-18 22:19:16 +0200
commitdb1440a1dba17d8d88bcdb41db361b3503babf4c (patch)
treef2bfd561b19edd0cd403bad0c17e651333814d20
parentbring back EAI_NODATA compat fixing freebsd (diff)
downloadOpenSMTPD-extras-db1440a1dba17d8d88bcdb41db361b3503babf4c.tar.xz
OpenSMTPD-extras-db1440a1dba17d8d88bcdb41db361b3503babf4c.zip
add -c and -C chroot option to filter-dkim-signer as well
-rw-r--r--extras/wip/filters/filter-dkim-signer/filter-dkim-signer.821
-rw-r--r--extras/wip/filters/filter-dkim-signer/filter_dkim_signer.c18
2 files changed, 34 insertions, 5 deletions
diff --git a/extras/wip/filters/filter-dkim-signer/filter-dkim-signer.8 b/extras/wip/filters/filter-dkim-signer/filter-dkim-signer.8
index ebdf2c9..5b7dc42 100644
--- a/extras/wip/filters/filter-dkim-signer/filter-dkim-signer.8
+++ b/extras/wip/filters/filter-dkim-signer/filter-dkim-signer.8
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 16 2016 $
+.Dd $Mdocdate: May 18 2016 $
.Dt FILTER-DKIM-SIGNER 8
.Os
.Sh NAME
@@ -22,7 +22,8 @@
.Nd smtpd filter to add DKIM signatures
.Sh SYNOPSIS
.Nm
-.Op Fl dv
+.Op Fl Cdv
+.Op Fl c Ar path
.Op Fl D Ar domain
.Op Fl p Ar private-key
.Op Fl s Ar selector
@@ -35,6 +36,21 @@ SMTP headers
.Pp
The options are as follows:
.Bl -tag -width "-p private-key"
+.It Fl C
+No
+.Xr chroot 2
+mode, if this option is specified,
+.Nm
+will not run in a chroot.
+.It Fl c Ar path
+Set the chroot
+.Ar path .
+.Pp
+The default
+.Ar path
+is
+.Pa /var/empty
+(compile option).
.It Fl D Ar domain
Set the DKIM
.Ar domain
@@ -80,6 +96,7 @@ With
enabled, an rsa-sha256 DKIM signature header is added to mails passing
through the filter.
.Sh SEE ALSO
+.Xr chroot 2 ,
.Xr filter_api 3 ,
.Xr smtpd.conf 5 ,
.Xr smtpd 8
diff --git a/extras/wip/filters/filter-dkim-signer/filter_dkim_signer.c b/extras/wip/filters/filter-dkim-signer/filter_dkim_signer.c
index 78117ab..ccd4655 100644
--- a/extras/wip/filters/filter-dkim-signer/filter_dkim_signer.c
+++ b/extras/wip/filters/filter-dkim-signer/filter_dkim_signer.c
@@ -266,16 +266,22 @@ on_disconnect(uint64_t id)
int
main(int argc, char **argv)
{
- int ch, d = 0, v = 0;
+ int ch, C = 0, d = 0, v = 0;
const char *p = PRIVATE_KEY;
- char *D = NULL, *s = NULL;
+ char *c = NULL, *D = NULL, *s = NULL;
FILE *fp;
static char hostname[SMTPD_MAXHOSTNAMELEN];
log_init(1);
- while ((ch = getopt(argc, argv, "D:dp:s:v")) != -1) {
+ while ((ch = getopt(argc, argv, "Cc:D:dp:s:v")) != -1) {
switch (ch) {
+ case 'C':
+ C = 1;
+ break;
+ case 'c':
+ c = optarg;
+ break;
case 'D':
D = optarg;
break;
@@ -300,6 +306,8 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
+ if (c)
+ c = strip(c);
if (D)
domain = strip(D);
if (s)
@@ -328,6 +336,10 @@ main(int argc, char **argv)
filter_api_on_eom(on_eom);
filter_api_on_reset(on_reset);
filter_api_on_rollback(on_rollback);
+ if (c)
+ filter_api_set_chroot(c);
+ if (C)
+ filter_api_no_chroot();
filter_api_loop();
log_debug("debug: exiting");