logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


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

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: Yubikey authentication using mod_authn_yubikey
Author
sratrerier



Joined: 19 Mar 2009
Posts: 4

PostPosted: Thu 10 May '12 20:57    Post subject: Yubikey authentication using mod_authn_yubikey Reply with quote

There's an Apache module mod_authn_yubikey at:

http://datapile.coffeecrew.org/mod_authn_yubikey-yubikey-apache-module/

which I was hoping to use on a Windows server. Does anyone have any experience of this, or able to create a Windows binary?

I'd rather use this module for this authentication, than doing it in my application's code since there isn't an API available for the specific language.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Sat 23 Jun '12 14:27    Post subject: Reply with quote

I tried to compile it, but there are too many errors to try harder

Code:

C:\build\modules\authn_yubikey>cl  /nologo /MD /O2 /LD /W3 -DWIN32 -D_WIN32 -I%APACHE%\include /c /Fomod_authn_yubikey.obj mod_authn_yubikey.c
mod_authn_yubikey.c
mod_authn_yubikey.c(309) : warning C4013: 'apr_password_validate' undefined; assuming extern returning int
mod_authn_yubikey.c(361) : error C2143: syntax error : missing ';' before 'type'
mod_authn_yubikey.c(362) : error C2143: syntax error : missing ';' before 'type'
mod_authn_yubikey.c(363) : error C2275: 'apr_size_t' : illegal use of this type as an expression
        c:\apache22-x86\include\apr.h(366) : see declaration of 'apr_size_t'
mod_authn_yubikey.c(363) : error C2146: syntax error : missing ';' before identifier 'passwordLength'
mod_authn_yubikey.c(363) : error C2065: 'passwordLength' : undeclared identifier
mod_authn_yubikey.c(364) : error C2275: 'apr_time_t' : illegal use of this type as an expression
        \Apache22-x86\include\apr_time.h(46) : see declaration of 'apr_time_t'
mod_authn_yubikey.c(364) : error C2146: syntax error : missing ';' before identifier 'lookedUpDate'
mod_authn_yubikey.c(364) : error C2065: 'lookedUpDate' : undeclared identifier
mod_authn_yubikey.c(375) : error C2065: 'passwordLength' : undeclared identifier
mod_authn_yubikey.c(378) : error C2065: 'passwordLength' : undeclared identifier
mod_authn_yubikey.c(406) : error C2065: 'lookedUpToken' : undeclared identifier
mod_authn_yubikey.c(406) : warning C4047: '=' : 'int' differs in levels of indirection from 'char *'
mod_authn_yubikey.c(408) : error C2065: 'lookedUpPassword' : undeclared identifier
mod_authn_yubikey.c(408) : error C2065: 'lookedUpToken' : undeclared identifier
mod_authn_yubikey.c(408) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
mod_authn_yubikey.c(408) : warning C4024: 'apr_strtok' : different types for formal and actual parameter 1
mod_authn_yubikey.c(408) : warning C4047: '=' : 'int' differs in levels of indirection from 'char *'
mod_authn_yubikey.c(409) : error C2065: 'lookedUpDate' : undeclared identifier
mod_authn_yubikey.c(409) : warning C4244: '=' : conversion from 'apr_int64_t' to 'int', possible loss of data
mod_authn_yubikey.c(419) : error C2065: 'lookedUpPassword' : undeclared identifier
mod_authn_yubikey.c(422) : error C2065: 'lookedUpDate' : undeclared identifier
mod_authn_yubikey.c(425) : error C2065: 'lookedUpToken' : undeclared identifier
mod_authn_yubikey.c(427) : error C2065: 'lookedUpToken' : undeclared identifier
mod_authn_yubikey.c(432) : error C2065: 'lookedUpPassword' : undeclared identifier
mod_authn_yubikey.c(432) : warning C4047: '!=' : 'int' differs in levels of indirection from 'void *'
mod_authn_yubikey.c(432) : error C2065: 'lookedUpPassword' : undeclared identifier
mod_authn_yubikey.c(432) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
mod_authn_yubikey.c(432) : warning C4024: 'strcmp' : different types for formal and actual parameter 1
mod_authn_yubikey.c(432) : error C2065: 'passwordLength' : undeclared identifier
mod_authn_yubikey.c(434) : error C2065: 'lookedUpDate' : undeclared identifier
mod_authn_yubikey.c(449) : error C2065: 'passwordLength' : undeclared identifier
mod_authn_yubikey.c(462) : error C2065: 'passwordLength' : undeclared identifier

C:\build\modules\authn_yubikey>
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sun 24 Jun '12 1:53    Post subject: Reply with quote

mod_authn_yubikey.c

apr_password_validate() is declared in apr_md5.h so add an #include to that header file.

around line 360 move:
key.dptr = NULL;
dbUserRecord.dptr = NULL;

below:
apr_time_t lookedUpDate = 0;
(a few lines down basically)

Done.

now that leaves us with libykclient.c, what to do with it I guess is link it in per modules.mk
makefile indicates the need for libcurl, libcurl.dll will need to be in Apache's /bin folder

a problem with libykclient.c is, it uses asprintf() which doesn't exist on windows nor is there an equivalent to it. but there is
http://src.opensolaris.org/source/raw/onnv/onnv-gate/usr/src/lib/libc/port/print/asprintf.c

libykclient.h

Add under the includes:

#define YK_PACKAGE "mod_authn_yubikey"
#define YK_PACKAGE_VERSION "0.1"


then before the #endif at the bottom add

int asprintf(char **str, const char *format, ...);

asprintf.c

for MSVC compatability and a little security from buffer overruns change line 52 to

(void) strcpy_s(newstr, len, string);

of course the (void) probably removes any chance of security since the code does not check for a return of EINVAL but the security of the original strlcpy() (BSD) is questionable from what I read.

=============================================================
[adjust paths to match]

set APACHE=\Apache22
set LCURL=\build3\curl-7.21.7

cl /nologo /O2 /MD /W3 -DWIN32 -D_WIN32 -D _CRT_SECURE_NO_WARNINGS -I%LCURL%\include -I%APACHE%\include /c *.c
link kernel32.lib "%LCURL%\build\lib\libcurl_imp.lib" "%APACHE%\lib\libhttpd.lib" "%APACHE%\lib\libapr-1.lib" "%APACHE%\lib\libaprutil-1.lib" /nologo /subsystem:windows /dll /machine:X86 /out:mod_authn_yubikey.so *.obj
MT -manifest mod_authn_yubikey.so.manifest -outputresource:mod_authn_yubikey.so;2


Will it work? I don't know, it loads.
Back to top


Reply to topic   Topic: Yubikey authentication using mod_authn_yubikey View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules