IvanoBilenchi / FaceAuth

Enhancing weak client-server user authentication with facial recognition.
MIT License
6 stars 3 forks source link

Edit AppConfig.swift and cert_gen.sh with your local server name and cert info. #1

Open BhavinGupta opened 6 years ago

BhavinGupta commented 6 years ago

Can you explain in detail how to set the local server name? need this on urgent bases as i have to integrate in my live projects

IvanoBilenchi commented 6 years ago

You need to change Config.API.Server.name in AppConfig.swift, and the COMMON_NAME variable in cert_gen.sh to match the local address of your machine (either local IP or mDNS .local domain are fine).

BhavinGupta commented 6 years ago

After doing that what should i do to start the server which i followed but then it gives me that could not connet to server

BhavinGupta commented 6 years ago

see this i have done with below images screen shot 2018-06-19 at 1 41 58 pm screen shot 2018-06-19 at 1 42 06 pm

BhavinGupta commented 6 years ago

What about AuthServerAPI.swift file is there any changes to be made ?

IvanoBilenchi commented 6 years ago

Pretty sure nothing needs to be changed there. I just tried cloning this and reconfiguring from scratch on another machine, you just need changes to the local name. Did you launch the server via start.sh? What's the server output on the CLI?

BhavinGupta commented 6 years ago

This is what i get after making configurations as below:

screen shot 2018-06-19 at 2 00 09 pm

BhavinGupta commented 6 years ago

am i doing correct to start this server please help me ?

IvanoBilenchi commented 6 years ago

That's fine. I just noticed you changed the port in AppConfig.swift. Try reverting it to 5000 and it should work fine. If you really need the server to run on port 9090, you also need to edit API.Server.port in server/face_auth/config.py.

BhavinGupta commented 6 years ago

See this images i am getting that "cancelled"

after changing everything properly

screen shot 2018-06-19 at 2 15 19 pm screen shot 2018-06-19 at 2 15 24 pm screen shot 2018-06-19 at 2 15 33 pm

IvanoBilenchi commented 6 years ago

That's likely an issue with SSL. Did you by chance edit the App Transport Security setting in the app's Info.plist? It should have an Allow arbitrary loads key set to YES (of course this means you're breaking ATS, but the whole project is experimental).

Please also ensure the server and client-side certificates (cert.der) are exactly the same.

BhavinGupta commented 6 years ago

No i didnt change that

BhavinGupta commented 6 years ago

i am still facing the same error with cancelled status

BhavinGupta commented 6 years ago

How you generated the cert.der? please help me out with this my configurations are correct then why it is not registering the example properly ?

IvanoBilenchi commented 6 years ago

It is generated by cert_gen.sh. Try deleting everything in the server/res/certs folder, delete the app from your device, then run start.sh again (to regenerate certificates and start the server) and finally build and deploy the app to your device via Xcode. This will ensure the certificates are fresh and in sync.

BhavinGupta commented 6 years ago

i have tried that @IvanoBilenchi now its working fine but i am not able to register nor i am able to login even after deleting the application and running on my local machine server see this below screen shot 2018-06-19 at 6 30 40 pm screen shot 2018-06-19 at 6 31 14 pm

BhavinGupta commented 6 years ago

See this as well @IvanoBilenchi screen shot 2018-06-19 at 6 36 47 pm

BhavinGupta commented 6 years ago

I am getting these above invalid request :( i have now set up with scratch example and need to run this successfully the whole integration is done properly but still i am not able to register and login in example of your @IvanoBilenchi

please guide me for near misses if any

BhavinGupta commented 6 years ago

Do we need to save the cert.der in the keychain and make the ssl certificate trusted ?

is that to be done or not as i have tried doing that to but the error is still the same i am getting the invalid request with this error below:

[BoringSSL] Function boringssl_session_errorlog: line 2878 [boringssl_session_write] SSL_ERROR_SYSCALL(5): operation failed externally to the library.

Last login: Wed Jun 20 12:28:15 on console BhavinGupta:~ bhavingupta$ cd /Users/bhavingupta/Downloads/FaceAuth/server BhavinGupta:server bhavingupta$ source venv/bin/activate (venv) BhavinGupta:server bhavingupta$ python3 start.py

please help me with this @IvanoBilenchi

IvanoBilenchi commented 6 years ago

Sorry, I am not able to follow up a lot with this. You should debug the Python code and see why it's returning 400 bad request. It should be pretty straightforward as I am explicitly failing when the request does not match what the server expects. I'd recommend debugging server/face_auth/server.py, which contains the register, login, update and delete handlers.

IvanoBilenchi commented 6 years ago

In particular, from one of your earlier screenshots it looks like the server cannot find the encrypted face model when logging in with a previously registered user. Upon registration, you should make sure the server creates a new directory for the user in server/res/users containing a .yml.aes file (the encrypted face model). I'd recommend deleting the existing database (server/res/users/users.db) and starting fresh.

BhavinGupta commented 6 years ago

Debugging with these above files which you have mentioned is already done by me and i am actually having least knowledge regarding python file as i have no expertise on python so please let me know is there any other way to debug this python file. I got your point and i personally feel that there is definitely some issue regarding the erver/face_auth/server.py file i have deleted the (server/res/users/users.db) and started with fresh demo as well but still there is only one error with below

192.168.10.189 - - [20/Jun/2018 12:51:10] "POST /register HTTP/1.1" 400 -

BhavinGupta commented 6 years ago

server/res/users containing a .yml.aes

no such file is created by server in the above path when i make a hit towards register URL

why is it so any idea @IvanoBilenchi ?

BhavinGupta commented 6 years ago

See this screenshot while hitting the register URL and video as well for proper error i am facing right now @IvanoBilenchi below:

screen shot 2018-06-20 at 3 08 40 pm

BhavinGupta commented 6 years ago

See this video in zip file and let me know what exactly the problem in server python file with proper credentials with min 8 length

faceauth.m4v.zip

BhavinGupta commented 6 years ago

@IvanoBilenchi where are you please sort this out as it is taking too long to integrate i am still getting the bad request 400 even after debugging the server.py file

IvanoBilenchi commented 6 years ago

As I already stated, I don't have time to follow up on this nor to sort it out, since this is just a POC that works fine on my machines and that I don't intend to support. The only way you'll get this to work is finding out why the server is failing on your specific configuration, which means you should debug the python code and fix it. If you find out the code is faulty, feel free to submit a pull request and I'll merge it in.

BhavinGupta commented 6 years ago

ok @IvanoBilenchi

but i think there i something in send the request which containing the invlaid json request and i dont have that much knowledge regading the python i told you before

so what should i do now ?

heenamansoori commented 4 years ago

you have to export FLASK_APP=face_auth/server.py then python start.py and run the app on iphone.It works fine. Thank you @IvanoBilenchi great work. Just add these commands in readme.txt file.