Bypass ssl with MongoDB in Mono

Hi, I want to ask if it possible somehow to ignore errors with SSL certification in MongoDB, it is disabled. But still it spits errors that it uses SSL functions.
Lion warns me about it in this thread: Using NuGet Cassandra database package in C#

But still is it possible? Because I don’t understand why only SSL has impact… It is insane.

Any TLS/SSL things are not working because they depend on some weird native binaries/libraries. I’ve tried to get MongoDB up and running without any success.

If you have the time and patience, you can modify the C# mongodb driver where you hack and slash out all the SSL/TLS parts, this might produce some bugs. I gave up because that would seems too time consuming.

Personally I’m using LiteDB on my server backend.

Okay thank you for the answer. So in Mono there is only problem with SSL? Other libraries that not associated with it should work fine?

No mono specific, FXserver simply does not support SSL/TLS. Anything related to that is out of the question.

Can we expected it fixed in the future? :slight_smile:

Some transcription from discord:

Syntasu - 02/15/2018
Question(s): Why is System.Net.Security not included in the artifacts? Does this have a technical reason? And would it be possible to still use libraries that depend on the System.Net.Security namespace? Can someone shed some light onto this? Thanks! :smile: (or would the forums be a better place to ask this? :ThinkingSnail:

seaborgium - 02/15/2018
because it depends on a weird native TLS library
we’re planning on updating windows mono and making it reproducible sometime tho
both cl/sv variants even!

So the answer is yes, somewhere in the future :stuck_out_tongue:

Thanks, hope it will.

I just connected to MongoDB and inserted a simple document without any issues using the official mongo-csharp-driver (link) through NuGet. I got no dependency issues when starting the server.

Server Console

MongoDB Shell

Code:

using System;
using System.Threading.Tasks;
using CitizenFX.Core;
using MongoDB.Bson;
using MongoDB.Driver;

namespace FivemTest
{
    public class User {
        public ObjectId Id { get; set; }
        public string Name { get; set; }
    }

    public class MyClass : BaseScript
    {
        MongoClient client;
        IMongoDatabase database;
        IMongoCollection<FivemTest.User> collection;

        bool firstTick = true;
        public MyClass()
        {
            client = new MongoClient("mongodb://localhost:27017");
            database = client.GetDatabase("foo");
            collection = database.GetCollection<User>("bar");

            Tick += OnTick;

        }

        private async Task OnTick(){
            if (firstTick)
            {
                await collection.InsertOneAsync(new User { Name = "d0p3t" });

                var list = await collection.Find(x => x.Name == "d0p3t")
                    .ToListAsync();

                foreach (var person in list)
                {
                    Debug.WriteLine(person.Name);
                }

                firstTick = false;

                Debug.WriteLine("DONE");
            }
        }
    }
}

So I don’t know what driver you guys try to use, but this works.

I’m on Linux using the latest artifact.

Mongodb driver work fine before 2.8.1 after impossible to connect on database.