s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
Macros | Functions | Variables
qmail-dksign.c File Reference
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "sig.h"
#include "stralloc.h"
#include "buffer.h"
#include "error.h"
#include "auto_qmail.h"
#include "control.h"
#include "str.h"
#include "exit.h"
#include "case.h"
#include "constmap.h"
#include "uint_t.h"
#include "fd.h"
#include "logmsg.h"
#include "open.h"
#include "fmt.h"
#include "fmtqfn.h"
#include "readwrite.h"
#include "qmail.h"
#include "wait.h"
#include "pathexec.h"
#include "rcpthosts.h"
Include dependency graph for qmail-dksign.c:

Go to the source code of this file.

Macros

#define WHO   "qmail-dksign"
 
#define DOMAINKEYS   "ssl/domainkeys/"
 

Functions

void die (int e)
 
void die_write (char *fn)
 
void die_read ()
 
void out (char *s)
 
void zero ()
 
void zerodie ()
 
void temp_nomem ()
 
void temp_chdir ()
 
void temp_create ()
 
void temp_unlink ()
 
void temp_control ()
 
void perm_usage ()
 
void temp_read ()
 
void temp_nosignkey ()
 
int get_controls ()
 
void fnmake_dkim (unsigned long id)
 
void dkim_unlink ()
 
void dkim_stage ()
 
int dkim_sign (const char *rsakeyfile, const char *ecckeyfile, const char *fnin, const char *fnout)
 
int qmail_remote (char **qargs, int fd)
 
void dkim_setup ()
 
int main (int argc, char **args)
 

Variables

char bufin [1000]
 
buffer bi = BUFFER_INIT(read,0,bufin,sizeof(bufin))
 
char bufout [1000]
 
buffer bo = BUFFER_INIT(write,1,bufout,sizeof(bufout))
 
stralloc fndkin = {0}
 
stralloc fndkout = {0}
 
stralloc sender = {0}
 
stralloc senddomain = {0}
 
stralloc originator = {0}
 
stralloc dkimdomains = {0}
 
struct constmap mapdkimdomains
 
stralloc ecckey = {0}
 
stralloc rsakey = {0}
 
char * dkimparams = 0
 
stralloc selector = {0}
 
stralloc selectore = {0}
 
stralloc sdid = {0}
 
stralloc auid = {0}
 
stralloc expire = {0}
 
stralloc canon = {0}
 
stralloc hash = {0}
 
stralloc length = {0}
 

Detailed Description

-- generate signature and attach in DKIM header to outgoing message

Steps:

a) DKIM controls: get private key for sending domain b) Prepare two staging files at queue/dkim (before and after signing) c) Read input at fd0 and insert CR for every line and store at dkim/x/pre d) DKIM sign the message with provided private key and store at dkim/y/post e) Copy signed file from fd to 0 f) Invoke qmail-remote (respecting the \r
) g) Remove staging files (pre/post)

Hack for hybrid signatures:

a) selector is a link to RSA private key b) selector2 is a link to Ed25519 private key c) Both are provided in the 'selector' field of dkimdomains separated by colon d) The coupled selector information is provided to qmail-dkim as: -yselector ,-Yselector2 e) The RSA privat key is given unaltered f) The Ed25519 private is supplied as additional argument

Definition in file qmail-dksign.c.

Macro Definition Documentation

◆ DOMAINKEYS

#define DOMAINKEYS   "ssl/domainkeys/"

Definition at line 31 of file qmail-dksign.c.

◆ WHO

#define WHO   "qmail-dksign"

Definition at line 29 of file qmail-dksign.c.

Function Documentation

◆ die()

void die ( int  e)

Definition at line 61 of file qmail-dksign.c.

Here is the call graph for this function:

◆ die_read()

void die_read ( void  )

Definition at line 63 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ die_write()

void die_write ( char *  fn)

Definition at line 62 of file qmail-dksign.c.

Here is the call graph for this function:

◆ dkim_setup()

void dkim_setup ( )

Definition at line 334 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dkim_sign()

int dkim_sign ( const char *  rsakeyfile,
const char *  ecckeyfile,
const char *  fnin,
const char *  fnout 
)

qmail-dkim [-h|-v|-s] [tags] [ ]

tags:

-c<canonicalization> - r=relaxed [DEFAULT], s=simple, t=relaxed/simple, u=simple/relaxed -d<sdid> - Signing Domain Identifier,if not provided it will be determined from the envelope originator/from header -i<auid> - Agent User Identifier, usually the sender's email address (optional) -l - include body length tag (optional) -q - include query method tag -t - include a timestamp tag (optional) -x<expire_time> - the expire time in seconds since epoch (optional, DEFAULT = current time + 604800) -y<selector> - set RSA selector (DEFAULT: default) -Y<selector> - set Ed25519 selector (DEFAULT: default) -z<hash> - set signature type (1=sha1, 2=sha256, 3=both, 4=ed25519, 5=hybrid)

Definition at line 264 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dkim_stage()

void dkim_stage ( )

Definition at line 197 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dkim_unlink()

void dkim_unlink ( )

Definition at line 189 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fnmake_dkim()

void fnmake_dkim ( unsigned long  id)

Definition at line 182 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_controls()

int get_controls ( )

Definition at line 128 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  args 
)

Definition at line 435 of file qmail-dksign.c.

Here is the call graph for this function:

◆ out()

void out ( char *  s)

Definition at line 64 of file qmail-dksign.c.

Here is the call graph for this function:

◆ perm_usage()

void perm_usage ( )

Definition at line 108 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qmail_remote()

int qmail_remote ( char **  qargs,
int  fd 
)

Definition at line 303 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_chdir()

void temp_chdir ( )

Definition at line 86 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_control()

void temp_control ( )

Definition at line 103 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_create()

void temp_create ( )

Definition at line 91 of file qmail-dksign.c.

Here is the call graph for this function:

◆ temp_nomem()

void temp_nomem ( void  )

Definition at line 81 of file qmail-dksign.c.

Here is the caller graph for this function:

◆ temp_nosignkey()

void temp_nosignkey ( )

Definition at line 118 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_read()

void temp_read ( )

Definition at line 113 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_unlink()

void temp_unlink ( )

Definition at line 98 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zero()

void zero ( )

Definition at line 65 of file qmail-dksign.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zerodie()

void zerodie ( void  )

Definition at line 66 of file qmail-dksign.c.

Here is the caller graph for this function:

Variable Documentation

◆ auid

stralloc auid = {0}

Definition at line 240 of file qmail-dksign.c.

◆ bi

buffer bi = BUFFER_INIT(read,0,bufin,sizeof(bufin))

Definition at line 57 of file qmail-dksign.c.

◆ bo

buffer bo = BUFFER_INIT(write,1,bufout,sizeof(bufout))

Definition at line 59 of file qmail-dksign.c.

◆ bufin

char bufin[1000]

Definition at line 56 of file qmail-dksign.c.

◆ bufout

char bufout[1000]

Definition at line 58 of file qmail-dksign.c.

◆ canon

stralloc canon = {0}

Definition at line 242 of file qmail-dksign.c.

◆ dkimdomains

stralloc dkimdomains = {0}

Definition at line 74 of file qmail-dksign.c.

◆ dkimparams

char* dkimparams = 0

Definition at line 79 of file qmail-dksign.c.

◆ ecckey

stralloc ecckey = {0}

Definition at line 77 of file qmail-dksign.c.

◆ expire

stralloc expire = {0}

Definition at line 241 of file qmail-dksign.c.

◆ fndkin

stralloc fndkin = {0}

Definition at line 68 of file qmail-dksign.c.

◆ fndkout

stralloc fndkout = {0}

Definition at line 69 of file qmail-dksign.c.

◆ hash

stralloc hash = {0}

Definition at line 243 of file qmail-dksign.c.

◆ length

stralloc length = {0}

Definition at line 244 of file qmail-dksign.c.

◆ mapdkimdomains

struct constmap mapdkimdomains

Definition at line 75 of file qmail-dksign.c.

◆ originator

stralloc originator = {0}

Definition at line 73 of file qmail-dksign.c.

◆ rsakey

stralloc rsakey = {0}

Definition at line 78 of file qmail-dksign.c.

◆ sdid

stralloc sdid = {0}

Definition at line 239 of file qmail-dksign.c.

◆ selector

stralloc selector = {0}

Definition at line 237 of file qmail-dksign.c.

◆ selectore

stralloc selectore = {0}

Definition at line 238 of file qmail-dksign.c.

◆ senddomain

stralloc senddomain = {0}

Definition at line 72 of file qmail-dksign.c.

◆ sender

stralloc sender = {0}

Definition at line 71 of file qmail-dksign.c.