You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Eddy <ed...@gmail.com> on 2010/06/10 08:34:26 UTC

Modify the body of a post request Multipar/form-data?

Hi,

I have a Firefox module that encrypts the body content for a POST and GET
request.
The apache module  must decrypt the content and send a crypted reply to the
client.
So, in my apache module, i have a filter to modify the body. For a  POST
 x-www-form-urlencoded, the content is decrypt but
in case of multipart the content is decrypted too late, the mod php has
already tried to process the content.
So I add a handler to my module and i get the data before php, so I decrypt
the content  but I can't inject the uncrypted data in the request.
How modify (decrypt data) the body content before all module ?

Regards,
Eddy

Re: Modify the body of a post request Multipar/form-data?

Posted by Eddy <ed...@gmail.com>.
Thanks, I like that ! The files is really very well documented !!

I have already read your firefox extension for my module and now it's your
apache extension !!

Thanks a lot,
Eddy

On Fri, Jun 11, 2010 at 11:23 PM, Arturo 'Buanzo' Busleiman <
buanzo@buanzo.com.ar> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> Eddy wrote:
> > For illustrate my problem :
> >
> > I have register a filter like in deflate :
>
> Your problem reminds me of the time when I tried to get help from this list
> to implement
> mod_openpgp - I recommend you check out mod_transform.c off svn://
> svn.buanzo.org/mod_openpgp which
> is a module implemented by Kevin Kiley (author of the excellent mod_gzip)
> that allows full request
> transformation.
>
> - --
> Arturo "Buanzo" Busleiman
> Independent Linux and Security Consultant - OWASP - SANS - OISSG
> http://www.buanzo.com.ar/pro/eng.html
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEAREKAAYFAkwSqWIACgkQAlpOsGhXcE2YYgCeMqMRjKdLlkKgkRU7q4VqR9Hz
> Sj8An1EGpaxBiBlFYbHzaOSEb67NuW1l
> =tcyQ
> -----END PGP SIGNATURE-----
>

Re: Modify the body of a post request Multipar/form-data?

Posted by Arturo 'Buanzo' Busleiman <bu...@buanzo.com.ar>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Eddy wrote:
> For illustrate my problem :
> 
> I have register a filter like in deflate :

Your problem reminds me of the time when I tried to get help from this list to implement
mod_openpgp - I recommend you check out mod_transform.c off svn://svn.buanzo.org/mod_openpgp which
is a module implemented by Kevin Kiley (author of the excellent mod_gzip) that allows full request
transformation.

- --
Arturo "Buanzo" Busleiman
Independent Linux and Security Consultant - OWASP - SANS - OISSG
http://www.buanzo.com.ar/pro/eng.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREKAAYFAkwSqWIACgkQAlpOsGhXcE2YYgCeMqMRjKdLlkKgkRU7q4VqR9Hz
Sj8An1EGpaxBiBlFYbHzaOSEb67NuW1l
=tcyQ
-----END PGP SIGNATURE-----

Re: Modify the body of a post request Multipar/form-data?

Posted by Eddy <ed...@gmail.com>.
For illustrate my problem :

I have register a filter like in deflate :
ap_register_input_filter(PerseusFilterName,perseus_in_filter, NULL,
AP_FTYPE_CONTENT_SET);

In httpd.conf :
SetInputFilter PERSEUS

So, I test with a crypted content and i hae in error.log :


Perseus handler, Perseus header found : pcc
[Thu Jun 10 11:29:28 2010] [error] [client 127.0.0.1] PHP Warning:  Missing
boundary in multipart/form-data POS
T data in Unknown on line 0, referer: http://localhost/
Input Filter begin
The handler do nothing, then php processes the encrypted content and fails.
Then, my Filter begin and decrypt the data but it's too late.

May-be I forget something, i don't understand the problem.

For the deflate module,  just set SetInputFilter Deflate in httpd.conf
enought?

Eddy




On Thu, Jun 10, 2010 at 10:54 AM, Eddy <ed...@gmail.com> wrote:

> Yes i try to do the same thing but I have a problem, my filter begins too
> late and php has already process the data.
> I must do a error somewhere.
> Thanks for your help.
> Eddy
>
>   On Thu, Jun 10, 2010 at 10:29 AM, Nick Kew <ni...@apache.org> wrote:
>
>>
>> On 10 Jun 2010, at 07:34, Eddy wrote:
>>
>> > How modify (decrypt data) the body content before all module ?
>>
>> That's what filters do.
>>
>> See mod_ssl for secure encryption.  Or in your case since it's only the
>> body content, see for example mod_deflate for a comparable task.
>>
>> --
>> Nick Kew
>>
>
>

Re: Modify the body of a post request Multipar/form-data?

Posted by Eddy <ed...@gmail.com>.
Yes i try to do the same thing but I have a problem, my filter begins too
late and php has already process the data.
I must do a error somewhere.
Thanks for your help.
Eddy

On Thu, Jun 10, 2010 at 10:29 AM, Nick Kew <ni...@apache.org> wrote:

>
> On 10 Jun 2010, at 07:34, Eddy wrote:
>
> > How modify (decrypt data) the body content before all module ?
>
> That's what filters do.
>
> See mod_ssl for secure encryption.  Or in your case since it's only the
> body content, see for example mod_deflate for a comparable task.
>
> --
> Nick Kew
>

Re: Modify the body of a post request Multipar/form-data?

Posted by Nick Kew <ni...@apache.org>.
On 10 Jun 2010, at 07:34, Eddy wrote:

> How modify (decrypt data) the body content before all module ?

That's what filters do.

See mod_ssl for secure encryption.  Or in your case since it's only the 
body content, see for example mod_deflate for a comparable task.

-- 
Nick Kew