Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: users

extract email from tls_peerdn ?

 

 

exim users RSS feed   Index | Next | Previous | View Threaded


nicolas.kowalski at gmail

Oct 27, 2011, 7:28 AM

Post #1 of 6 (492 views)
Permalink
extract email from tls_peerdn ?

Hello,

Using Exim 4.75, I am looking for the best method to extract the
emailAddress field from tls_peerdn variable.

For example, with my certificate, the SSL peer debug shows:
/C=FR/ST=Ille-et-Vilaine/O=Home/OU=Computing/CN=Nicolas KOWALSKI/emailAddress=niko [at] petole

I currently extract the emailAddress using a double extract, first by
choosing the last field (separated by /), then a simple extract using
emailAddress as key.

${extract{emailAddress}{${extract{-1}{/}{${tls_peerdn}}}}}

Obviously, this will fail if the /-separated last field is not the
emailAddress.

Thanks,
--
Nicolas

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


exim-users at spodhuis

Oct 27, 2011, 9:16 PM

Post #2 of 6 (489 views)
Permalink
Re: extract email from tls_peerdn ? [In reply to]

On 2011-10-27 at 16:28 +0200, Nicolas KOWALSKI wrote:
> /C=FR/ST=Ille-et-Vilaine/O=Home/OU=Computing/CN=Nicolas KOWALSKI/emailAddress=niko [at] petole

> ${extract{emailAddress}{${extract{-1}{/}{${tls_peerdn}}}}}
>
> Obviously, this will fail if the /-separated last field is not the
> emailAddress.

How about:
${filter {</ $tls_peerdn}{eqi{${substr_0_13:$item}}{emailAddress=}}}

?

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


Lena at lena

Oct 28, 2011, 5:14 AM

Post #3 of 6 (484 views)
Permalink
Re: extract email from tls_peerdn ? [In reply to]

> From: Nicolas KOWALSKI

> For example, with my certificate, the SSL peer debug shows:
> /C=FR/ST=Ille-et-Vilaine/O=Home/OU=Computing/CN=Nicolas KOWALSKI/emailAddress=niko [at] petole
>
> I currently extract the emailAddress using a double extract, first by
> choosing the last field (separated by /), then a simple extract using
> emailAddress as key.
>
> ${extract{emailAddress}{${extract{-1}{/}{${tls_peerdn}}}}}
>
> Obviously, this will fail if the /-separated last field is not the
> emailAddress.

${extract{emailAddress}{$sg{$tls_peerdn}{/}{ }}}

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


nicolas.kowalski at gmail

Oct 28, 2011, 8:27 AM

Post #4 of 6 (491 views)
Permalink
Re: extract email from tls_peerdn ? [In reply to]

On Fri, Oct 28, 2011 at 12:16:34AM -0400, Phil Pennock wrote:
> On 2011-10-27 at 16:28 +0200, Nicolas KOWALSKI wrote:
> > /C=FR/ST=Ille-et-Vilaine/O=Home/OU=Computing/CN=Nicolas KOWALSKI/emailAddress=niko [at] petole
>
> > ${extract{emailAddress}{${extract{-1}{/}{${tls_peerdn}}}}}
> >
> > Obviously, this will fail if the /-separated last field is not the
> > emailAddress.
>
> How about:
> ${filter {</ $tls_peerdn}{eqi{${substr_0_13:$item}}{emailAddress=}}}

Thanks for your reply.

I tried, but the 'emailAddress' string is not removed from the result.
Not sure why.

--
Nicolas

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


tlyons at ivenue

Oct 28, 2011, 8:37 AM

Post #5 of 6 (485 views)
Permalink
Re: extract email from tls_peerdn ? [In reply to]

On Fri, Oct 28, 2011 at 8:27 AM, Nicolas KOWALSKI
<nicolas.kowalski [at] gmail> wrote:
>> > ${extract{emailAddress}{${extract{-1}{/}{${tls_peerdn}}}}}
>> How about:
>>   ${filter {</ $tls_peerdn}{eqi{${substr_0_13:$item}}{emailAddress=}}}
> I tried, but the 'emailAddress' string is not removed from the result.
> Not sure why.

Try Lena's method in the subsequent post. It allows for the order to
change and does the same type of extract command that you're used to.

Regards... Todd
--
If Americans could eliminate sugary beverages, potatoes, white bread,
pasta, white rice and sugary snacks, we would wipe out almost all the
problems we have with weight and diabetes and other metabolic
diseases. -- Dr. Walter Willett, Harvard School of Public Health

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


nicolas.kowalski at gmail

Oct 28, 2011, 10:38 AM

Post #6 of 6 (489 views)
Permalink
Re: extract email from tls_peerdn ? [In reply to]

On Fri, Oct 28, 2011 at 03:14:12PM +0300, Lena [at] lena wrote:
> > For example, with my certificate, the SSL peer debug shows:
> > /C=FR/ST=Ille-et-Vilaine/O=Home/OU=Computing/CN=Nicolas KOWALSKI/emailAddress=niko [at] petole
> >
> > I currently extract the emailAddress using a double extract, first by
> > choosing the last field (separated by /), then a simple extract using
> > emailAddress as key.
> >
> > ${extract{emailAddress}{${extract{-1}{/}{${tls_peerdn}}}}}
> >
> > Obviously, this will fail if the /-separated last field is not the
> > emailAddress.
>
> ${extract{emailAddress}{$sg{$tls_peerdn}{/}{ }}}

Thanks for your help Lena, I will try your solution.

--
Nicolas

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

exim users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.