Orange-Cyberdefense / GOAD

game of active directory
GNU General Public License v3.0
4.63k stars 652 forks source link

Failed to add MSSQL admin SVR02 and SVR03 #180

Open GrizzlyByte7 opened 5 months ago

GrizzlyByte7 commented 5 months ago

I keep getting the following error when the servers.yml for svr02 and svr03. Any way to fix this?

TASK [mssql : Add MSSQL admin] ***** failed: [srv03] (item=ESSOS\khal.drogo) => {"ansible_loop_var": "item", "changed": true, "cmd": "SqlCmd -E -Q \"CREATE LOGIN [ESSOS\khal.drogo] FROM WINDOWS\"\nSqlCmd -E -Q \"SP_ADDSRVROLEMEMBER 'ESSOS\khal.drogo','SYSADMIN'\"", "delta": "0:00:18.687882", "end": "2024-01-28 05:28:36.483012", "item": "ESSOS\khal.drogo", "msg": "non-zero return code", "rc": 1, "start": "2024-01-28 05:28:17.795129", "stderr": "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..", "stderr_lines": ["Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.."], "stdout": "", "stdout_lines": []}

failed: [srv02] (item=NORTH\jon.snow) => {"ansible_loop_var": "item", "changed": true, "cmd": "SqlCmd -E -Q \"CREATE LOGIN [NORTH\jon.snow] FROM WINDOWS\"\nSqlCmd -E -Q \"SP_ADDSRVROLEMEMBER 'NORTH\jon.snow','SYSADMIN'\"", "delta": "0:00:18.919591", "end": "2024-01-28 05:28:38.160613", "item": "NORTH\jon.snow", "msg": "non-zero return code", "rc": 1, "start": "2024-01-28 05:28:19.241021", "stderr": "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.\r\nSqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..", "stderr_lines": ["Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.", "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.."], "stdout": "", "stdout_lines": []}

image

colebaty commented 4 months ago

I'm having the same issue. If I rerun the entire install script, jon.snow manages to go through, but I'm still having issues with khal.drogo.

Have you had any success?

SamBugler commented 4 months ago

Same issue. Any luck?

mahWae9i commented 3 months ago

I was experiencing the same issue with using the goad.sh script with ansible coming from docker ("-m docker"). When I changed ansible to local then it worked without any issue.

colebaty commented 3 months ago

Hey, sorry it took forever to get back.

I found a solution in another issue, called Issues

https://github.com/Orange-Cyberdefense/GOAD/issues/62#issuecomment-1831032113

Log in to SRV02 and SRV03 with vagrant:vagrant and follow the steps in the linked comment. This fixed it for me.

I build the lab with ./goad.sh -t install -l GOAD -p virtualbox -m docker

Because I'm using Docker, I follow the instructions in docs/provisioning.md for getting into the docker provisioning container, and then I run the servers.yml playbook on its own.

ansible-playbook -i ../ad/GOAD/data/inventory -i ../ad/GOAD/providers/virtualbox/inventory main.yml # this will configure the vms in order to play ansible when the vms are ready (for virtualbox provider and goad lab)

ANSIBLE_COMMAND="ansible-playbook -i ../ad/GOAD/data/inventory -i ../ad/GOAD/providers/virtualbox/inventory"
$ANSIBLE_COMMAND servers.yml          # Install IIS and MSSQL

Hope this helps.

Mayfly277 commented 3 months ago

if you got MSSQL install issue please follow this :

i don't know why but on some deployment mssql fail to install well as on my computer it work fine x) if you have any answer of why mssql install as fail please tell me :)