Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Not connecting to secured database #17

Open
mougli123 opened this issue Feb 25, 2016 · 9 comments
Open

Not connecting to secured database #17

mougli123 opened this issue Feb 25, 2016 · 9 comments

Comments

@mougli123
Copy link

I'm trying to connect to a remote database that's secured with a username and password. I tried this code to test the connection:
do{
let client = try MongoClient(host: host, port: port, database: db, usernameAndPassword: (user,password))
print(try client.checkConnection())
}catch{
print(error)
}

This results in the following appearing in the console:
DEBUG: cluster: Authentication failed: The "SCRAM-SHA-1" authentication mechanism requires libmongoc built with --enable-ssl

@Danappelxx
Copy link
Owner

What platform is your code on? Are you building from Carthage? This issue will occur with Carthage because openssl is deprecated on OSX and not available on iOS. The folks behind libmongoc told me that they were working on it but I don't think they got to it yet. On the other hand, if you build with the Swift Package Manager, you won't have the same issue because you can just rebuild libmongoc with the --enable-ssl flag.

@mougli123
Copy link
Author

My code is on iOS using Xcode 7.2. I did install using Carthage. What would I have to build to make this work? Would I build all the packages in Carthage/Checkout or just one part in specific?

@Danappelxx
Copy link
Owner

Sorry for the delay. Unfortunately I have not thoroughly experimented building with ssl on iOS. If you can figure out how to link them together, simply changing the 0 in this file to a 1 should enable most ssl-related features.

Let me know if you get anywhere.

@csharpe0691
Copy link

I'm interested in the also, @mougli123 were you able to get it to work?

@RafaelRViana
Copy link

I'm trying to connect directly to mLab service. That is a secured database.
However, I'm getting Unexpected as connection status.

Did you get this working with a secured database?

@Danappelxx
Copy link
Owner

@RafaelRViana which version are you using?

@RafaelRViana
Copy link

I'm using the version available on Cocoapods.

@Danappelxx
Copy link
Owner

Oh jeez, that version is way too old! I've been trying to remove it from cocoa pods for a long time now but trunk is very buggy... Please use the version provided by SPM or at the very least Carthage :)

@RafaelRViana
Copy link

I've tried to install it using Carthage, however I'm getting the following error:

MacBook-Pro-de-Rafael:Whatsgon rafaelviana$ carthage update --platform iOS
*** Fetching SwiftMongoDB
*** Fetching libbson-xcode
*** Fetching libmongoc-xcode
*** Checking out libbson-xcode at "1.2.1"
*** Checking out SwiftMongoDB at "4b3476f058b35cecb1ea91afdbd60e7554662d2e"
*** Checking out libmongoc-xcode at "1.2.1"
*** xcodebuild output can be found in /var/folders/cx/4gj0sj6n7h53r64xpjzqwxp80000gn/T/carthage-xcodebuild.emVUY4.log
*** Building scheme "bson-ios" in bson.xcodeproj
*** Building scheme "mongoc-ios" in mongoc.xcodeproj
** BUILD FAILED **

The following build commands failed:
CompileC /Users/rafaelviana/Library/Developer/Xcode/DerivedData/mongoc-glhabixuqyphzbbfvgkcarbmcgei/Build/Intermediates/mongoc.build/Release-iphoneos/mongoc-ios.build/Objects-normal/armv7/mongoc-list.o mongoc/mongoc-list.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-oid.c:36:23: warning: unused variable 'gHexCharPairs' [-Wunused-const-variable]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:62:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:66:38: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:180:19: warning: variable 'gmt' is not needed and will not be emitted [-Wunneeded-internal-declaration]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-oid.c:36:23: warning: unused variable 'gHexCharPairs' [-Wunused-const-variable]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:62:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:66:38: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:180:19: warning: variable 'gmt' is not needed and will not be emitted [-Wunneeded-internal-declaration]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:62:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:66:38: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:180:19: warning: variable 'gmt' is not needed and will not be emitted [-Wunneeded-internal-declaration]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:62:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:66:38: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libbson-xcode/bson/bson/bson-timegm.c:180:19: warning: variable 'gmt' is not needed and will not be emitted [-Wunneeded-internal-declaration]
warning: using 'ALWAYS_SEARCH_USER_PATHS = YES' while building targets which define modules ('DEFINES_MODULE = YES') may fail. Please migrate to using 'ALWAYS_SEARCH_USER_PATHS = NO'.
warning: no rule to process file '/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-counters.defs' of type text for architecture armv7
warning: using 'ALWAYS_SEARCH_USER_PATHS = YES' while building targets which define modules ('DEFINES_MODULE = YES') may fail. Please migrate to using 'ALWAYS_SEARCH_USER_PATHS = NO'.
warning: using 'ALWAYS_SEARCH_USER_PATHS = YES' while building targets which define modules ('DEFINES_MODULE = YES') may fail. Please migrate to using 'ALWAYS_SEARCH_USER_PATHS = NO'.
warning: no rule to process file '/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-counters.defs' of type text for architecture arm64
warning: using 'ALWAYS_SEARCH_USER_PATHS = YES' while building targets which define modules ('DEFINES_MODULE = YES') may fail. Please migrate to using 'ALWAYS_SEARCH_USER_PATHS = NO'.
warning: no rule to process file '/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-counters.defs' of type text for architecture armv7
warning: using 'ALWAYS_SEARCH_USER_PATHS = YES' while building targets which define modules ('DEFINES_MODULE = YES') may fail. Please migrate to using 'ALWAYS_SEARCH_USER_PATHS = NO'.
warning: no rule to process file '/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-counters.defs' of type text for architecture arm64
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/Carthage/Build/iOS/bson.framework/Headers/bson-compat.h:115:11: error: include of non-modular header inside framework module 'bson.bson_compat' [-Werror,-Wnon-modular-include-in-framework-module]
:1:1: warning: umbrella header for module 'bson' does not include header 'b64_ntop.h' [-Wincomplete-umbrella]
:1:1: warning: umbrella header for module 'bson' does not include header 'b64_pton.h' [-Wincomplete-umbrella]
:1:1: warning: umbrella header for module 'bson' does not include header 'bson-ios.h' [-Wincomplete-umbrella]
:1:1: warning: umbrella header for module 'bson' does not include header 'bson-stdint-win32.h' [-Wincomplete-umbrella]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-cursor.h:24:10: fatal error: could not build module 'son'
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/Carthage/Build/iOS/bson.framework/Headers/bson-compat.h:115:11: error: include of non-modular header inside framework module 'bson.bson_compat' [-Werror,-Wnon-modular-include-in-framework-module]
:1:1: warning: umbrella header for module 'bson' does not include header 'b64_ntop.h' [-Wincomplete-umbrella]
:1:1: warning: umbrella header for module 'bson' does not include header 'b64_pton.h' [-Wincomplete-umbrella]
:1:1: warning: umbrella header for module 'bson' does not include header 'bson-ios.h' [-Wincomplete-umbrella]
:1:1: warning: umbrella header for module 'bson' does not include header 'bson-stdint-win32.h' [-Wincomplete-umbrella]
/Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-list-private.h:24:10: fatal error: could not build module 'son'
A shell task (/usr/bin/xcrun xcodebuild -project /Users/rafaelviana/Documents/workspace-ios/Whatsgon/Carthage/Checkouts/libmongoc-xcode/mongoc.xcodeproj -scheme mongoc-ios -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** BUILD FAILED **

The following build commands failed:
CompileC /Users/rafaelviana/Library/Developer/Xcode/DerivedData/mongoc-glhabixuqyphzbbfvgkcarbmcgei/Build/Intermediates/mongoc.build/Release-iphoneos/mongoc-ios.build/Objects-normal/armv7/mongoc-list.o mongoc/mongoc-list.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Maybe, could it be a problem of using Carthage in the same project it's being used CocoaPods?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants