GOAD icon indicating copy to clipboard operation
GOAD copied to clipboard

Failed to add MSSQL admin SVR02 and SVR03

Open GrizzlyByte7 opened this issue 1 year ago • 5 comments

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

GrizzlyByte7 avatar Jan 28 '24 06:01 GrizzlyByte7

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?

colebaty avatar Feb 17 '24 18:02 colebaty

Same issue. Any luck?

SamBugler avatar Feb 28 '24 18:02 SamBugler

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.

mahWae9i avatar Mar 19 '24 09:03 mahWae9i

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.

colebaty avatar Mar 23 '24 19:03 colebaty

if you got MSSQL install issue please follow this :

  • Login to the vm who fail to install mssql (login with vagrant:vagrant local admin)
  • uninstall all mssql programs
  • delete the c:\setup folder
  • delete the C:\Program Files\Microsoft SQL Server folder relaunch the install.

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 :)

Mayfly277 avatar Mar 29 '24 06:03 Mayfly277