HW-1.6 testsaslauthd failing and can't connect to database VM


I am working on M310-HW-1.6. I have these files ready:
/etc/saslauthd.conf and /etc/default/saslauthd.

This is the contents of /etc/saslauthd.conf:

ldap_servers: ldap://infrastructure.m310.mongodb.university:389
ldap_search_base: ou=Users,dc=mongodb,dc=com
ldap_filter: (cn=%u)

And this is the contents of /etc/default/saslauthd:


I have run:

$ sudo service saslauthd start

Here are two questions:

  1. Using testsaslauthd is not working. Why?

This is what I get:

[vagrant@infrastructure shared]$ testsaslauthd -u adam -p password -f /var/run/saslauthd/mux
0: NO "authentication failed"
[vagrant@infrastructure shared]$
  1. If I open a second terminal tab to connect to the database VM, I can’ connect. Why?

This is what I get:

My-Mac:m310-vagrant-env me$ vagrant ssh database
My-Mac:m310-vagrant-env me$

I have solved this issue. In case it happens to someone else this is what I did wrong.

For the testsaslauthd command not working:

I had my files /etc/saslauthd.conf and /etc/default/saslauthd on the infrastructure server.
They should be on the database server.

The same goes for the command:

service saslauthd start

it should be run on the database server.

And the same for:

testsaslauthd -u adam -p password -f /var/run/saslauthd/mux

For the vagrant ssh database not working:

I ran this two commands and it fixed the problem:

vagrant destroy database
vagrant up database