logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



Building mod_authnz_external on 64bit Windows (Windows 10)

 
Post new topic   Reply to topic    Apache Forum Index -> Apache Building & Member Downloads



View previous topic :: View next topic  
Author Message
totallykvothe



Joined: 30 Aug 2018
Posts: 1
Location: United States, Colville

PostPosted: Thu 30 Aug '18 19:00    Post subject: Building mod_authnz_external on 64bit Windows (Windows 10) Reply with quote

Hey all. Here's something I was able to find minimal help online for, but I've got a solution that worked for me. Basically, if you have to use BasicAuth due to some sort of restrictions (Like legacy Excel spreadsheets that need to access your site that you have no control over), but you want some sort of decent security, mod_authnz_external is your only way to go.

The repository can be found here: https://github.com/kitech/mod_authnz_external/

There is some really good documentation for it as far as installation goes on Linux, as well as Apache conf file editing, but for Windows users, you have to figure it out on your own. Luckily, it's not that hard. I was able to get it working and I'm not finding any problems with the implementation so far.

1) Download and open mod_authnz_external.c in a text editor

2) Remove all lines containing `SIGCHLD` or `sigchld`. These reference Linux-specific process handles and only cause errors on Windows.

3) Write your authentication function. I have not found a way to make this work other than using the _HARDCODE_method, as the module doesn't pass the password correctly, and I'm not good enough at C to figure out exactly what it's doing wrong and fix it. A workaround you can use is to just write your own pipe in C and then you can still write your authentication file in php or perl or whatever you'd like as long as it can be called from the command line with parameters. (example of this can be found in my version of the file here: https://pastebin.com/q56Q7wth. Also the instructions for how to implement this function are here: https://github.com/kitech/mod_authnz_external/blob/master/INSTALL.HARDCODE)

4) Save mod_authnz_external.c to your Apache installation's include directory (usually C:\Apache\include).

5) Open VS's x64 Native Tools Command Prompt and navigate to the include directory. (Search for 'Native x64' in the Windows search. Obviously you need to have Visual Studio installed. You can also probably do this with any c++ compiler, but you're gonna need to look up the equivalent option flags for that compiler)

6) Compile the module:
Code:
cl -nologo -MD -W3 -O2 -c -DWIN32 -D_WINDOWS -DNDEBUG  -IC:\Apache24\include mod_authnz_external.c

Code:
link /nologo /dll /subsystem:windows /machine:x64 /libpath:C:\Apache24\lib kernel32.lib ws2_32.lib libhttpd.lib libapr-1.lib libaprutil-1.lib /out:mod_authnz_external.so mod_authnz_external.obj


7) Fix any compile errors you might get here. Probably don't worry about the warnings. There were a lot of warnings that popped up using `cl` that most likely didn't under `gcc`, so it depends on your compiler. Again, I'm not a C expert, so I probably can't help you on this step if something goes wrong. Anyway, once you've satisfied the compiler and it's built without errors (but probably with warnings), move to the next step

8) Move mod_authnz_external.so to the modules directory (Probably C:\Apache\modules).

9) Delete unneeded files in the include directory, like the .obj file or the .lib file. Move the .c file out of there too, so that it looks the same way it did when you found it.

10) Follow the rest of the normal instructions as far as loading the module in Apache goes. (Can be found here: https://github.com/kitech/mod_authnz_external/blob/master/INSTALL


That should do it! If you're lucky, this should get you the ability to implement some decent security with BasicAuth. Good luck!

Many thanks to this post: http://www.apachelounge.com/viewtopic.php?p=25999 for helping with the compiling and linking.
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Apache Building & Member Downloads
Page 1 of 1