-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client certificate authentication #83
Comments
Hello, Right now you can't use https client certificate authentication in ulfius, but it's an interesting feature, I'll probably add it in a future release. |
Yeah thanks That will be much helpful. |
I think we can use MHD_start_daemon to authenticate client, for this will have to link application against gnutls. (Don't know how to do this) |
Yes, that's my intention |
Hello @akhileshsarda , Can you test the client certificate authentication using the branch client-cert-auth? You'll need GnuTLS library and you must enable websocket support to have client certificate authentication. In there you have a new startup function called int ulfius_start_secure_ca_trust_framework(struct _u_instance * u_instance, const char * key_pem, const char * cert_pem, const char * root_ca_pem); It works the same as Then, on the callback function for an endpoint, you have the Check the udated example_program/auth_example for an example of use: |
Ignore above comment. |
@akhileshsarda , In my case, when I run auth_server on a terminal I have the following output: test@test:/usr/src/ulfius/example_programs/auth_example$ ./auth_server server.key server.crt ca.crt
2018-12-04T22:40:53 - auth_server INFO: logs start
Start secure framework on port 2884
Press <enter> to quit server
2018-12-04T22:41:42 - auth_server DEBUG: dn of the client: C=CA,ST=Quebec,L=Quebec,O=Ulfius,OU=test-client,CN=localhost,EMAIL=webmaster@localhost
2018-12-04T22:41:42 - auth_server DEBUG: dn of the issuer: C=CA,ST=Quebec,L=Quebec,O=Ulfius,OU=test-ca,CN=localhost,EMAIL=webmaster@localhost
End framework You can see the startup message is On the client terminal, I have the following output: test@test:/usr/src/ulfius/example_programs/auth_example$ ./auth_client client.crt client.key password
2018-12-04T22:47:23 - auth_client INFO: logs start
Press <enter> to run client certificate authentication test
status is
200
string body is
client dn: 'C=CA,ST=Quebec,L=Quebec,O=Ulfius,OU=test-client,CN=localhost,EMAIL=webmaster@localhost', ussued by: 'C=CA,ST=Quebec,L=Quebec,O=Ulfius,OU=test-ca,CN=localhost,EMAIL=webmaster@localh
ost' Can you try again the test, but first run $ cd ulfius
$ make clean
$ cd src
$ make && sudo make install
$ cd ../example_programs/auth_example
$ make
$ ./auth_server server.key server.crt ca.crt # on one terminal
$ ./auth_client client.crt client.key password # on another terminal |
Thanks for quick response. I tried doing clean up exactly as you mentioned above, but it didn't work. So, i cloned it on new setup, there also it showing same error. (It works in master branch but it is in non secure mode)
|
Websocket support is enabled by default. Have you checked out the branch $ git checkout client-cert-auth |
From the beginning, the commands should look like this: $ git clone https://github.com/babelouest/ulfius.git
$ cd ulfius
$ git checkout client-cert-auth
$ cd src
$ make && sudo make install
$ cd ../example_programs/auth_example
$ make
$ # generate or copy the certificates
$ ./auth_server server.key server.crt ca.crt |
Yes, I did the same. I am doing this after checking out in client-cert-auth. Only thing i changed is Makefile in auth_example as it was failing while building.(as it depends on libyder as follow)
|
OK there's a small bug in the Concerning your initial problem (testing auth_example with certificates), I don't understand it yet. Can you copy-paste your console output again? I'll try to figure out what's missing |
Git status:
The below is console output:
Terminal 2:
And content of ulfius/inlude/ulfius-cfg.h
|
OK so there was a problem when you built ulfius because the config file says websocket is disabled, so client cert auth is disabled too. I've updated the $ cd ulfius/src
$ make clean release The correct build output should looke like this:
|
Also, check your version of libmicrohttpd, you must have at least 0.9.53 to enable websocket support. |
@akhileshsarda , I've merged the branch |
This is the ouput of dpkg (to see version of installed library). Is this okay?
I have pulled git repo. after you have merged the branch.(then cleaned and built as mentioned before) I'm still facing same issue. May be i messed up something, i will try cleaning all stuff and rebuilding. |
Thanks, if you find out what was wrong, can you let me know? Maybe soething's not clear in the documentation. |
I don't know what was that; while doing make clean release i saw
Thanks a lot for such quick responses. |
And that too resolved by installing pkg-config. |
And that solves the problem :)
Fixed in the documentation: 93541a8 Thanks for the help @akhileshsarda ! |
Hi
I want to allow only specific client to connect to server (running as ./simple_example), using ssl/tls certificates.
So that it reads the client's certificate verifying its authentic then will start communication.
In my case, i tried creating certificates (using openssl) which i pass as argument to server, but it seems that server sends these files to any client which tries to connect it. So it's able to communicate over HTTPS.
But, I want to allow a client which has server signed certificate.
How can do it ?
The text was updated successfully, but these errors were encountered: