본 게시물은 개인적인 의견으로 작성되었으니 절대적인 정보가 아닐 수 있습니다. 참고만 하시고 궁금한 사항이 있으시면 연락주세요.

티스토리 뷰

 

 

대부분의 MMC 창의 정보는 레지스트리에서 많이 가져오게 된다.

SQL Server 구성관리자의 정보들도 WMI Provider를 통하여 해당 정보를 레지스트리에서 가져온다.

이런 경우에 권한이 없을 경우에는 어떤 일이 발생할까?

 

아래 KB를 보듯이 서비스의 일부 항목들이 안보일 수 있다.

Some or all SQL Server 2005 services are not listed in SQL Server Configuration Manager, or you receive a "No SQL Server 2005 components were found" error message when you perform operations in SQL Server 2005 Surface Area Configuration

https://support.microsoft.com/ko-kr/kb/941823

 

[장애증상]

<정상화면>

<장애화면>

일부 서비스목록이 보이지 않게 되는 현상, SQL 서비스는 정상 동작하고 있지만 구성관리자에서 서비스목록만 안보이는 현상이다.

 

[분석내용]

MMC 창에서 해당 정보는 WMI 쿼리는 해서 가져오며, WMI Provider가 동작하여 레지스트리의 값을 가져오게 된다.

 

WMI Provider를 사용하는지는 어떻게 찾았나?

해당 서비스목록을 새로고침하는 순간 메시지를 볼 수 있다. "Requesting data from WMI provider…" 이렇게 표기된다.

 

아래 게시물에서도 확인이 가능하다.

Configure WMI to Show Server Status in SQL Server Tools

https://technet.microsoft.com/en-us/library/ms188690.aspx

This topic describes how to configure WMI to show the server status in SQL Server tools in SQL Server 2016. When connecting to servers, both the Registered Servers and Object Explorer components of SQL Server Management Studio, as well as SQL Server Configuration Manager, use Windows Management Instrumentation (WMI) to obtain the status of the SQL Server (MSSQLSERVER) and SQL Server Agent (MSSQLSERVER) services. To display the status of the service, the user must have rights to remotely access the WMI object. The server must have WMI installed to configure this permission.

 

WMI Provider는 뭘까?

[참고문서]

http://www.neuber.com/taskmanager/process/wmiprvse.exe.html

To avoid stopping all the services when a provider fails, providers are loaded into a separate host process named Wmiprvse.exe. Multiple instances of Wmiprvse.exe can run at the same time under different accounts: LocalSystem, NetworkService or LocalService. The WMI core WinMgmt.exe is loaded into the shared Local Service host named Svchost.exe.

 

Windows Management Instrumentation 서비스가 시작되며 해당 svchost.exe 로 실행되는 서비스이며 해당 프로세스가 로드 되면서 [Wmiprvse.exe] 프로세스를 같이 수행하게 된다.

 

결과적으로 Wmiprvse.exe 프로세스가 SQL Server 구성 관리자 실행이 되면 해당 정보를 가져오는 프로세스이다.

Wmiprvse.exe 이 놈이 [Sqlmgmprovider.dll] 을 로드하게 되며, 구성관리자의 정보를 레지스트리에서 가져오게 된다.

 

어떤 권한으로 정보를 가져올까?

Wmiprvse.exe 프로세스는 Network Service 계정의 권한으로 레지스트리의 값을 가져오게 된다.

[참고]

https://support.microsoft.com/en-us/kb/941823

The Wmiprvse.exe process in which the Sqlmgmprovider.dll file is loaded runs under the security context of the NETWORK SERVICE account. In the Wmiprvse.exe process, a thread executes the code in the Sqlmgmprovider.dll file. When you run these tools, this thread in the Wmiprvse.exe process impersonates the security context of the user who is running these tools.

 

결론으로 SQL Server 구성관리자에서 WMI Provider는 Network Service 권한을 가지고 레지스트리의 값들을 가져와서 서비스 목록 및 정보를 보여준다는 말이다.

 

그럼 장애 현상이 왜 발생할까?

레지스트리의 읽기 권한의 문제인 것이다. 아래와 같이 해당 SQL 정보의 폴더의 권한에서 Users 라는 그룹 계정이 빠지면 장애 현상이 똑같이 재현이

된다.

 

그럼 Users 그룹계정과 Network Service 계정과의 상관관계가 있는가!! 에서 의문이 생긴다.

 

찾아보자.

아래 참고문서에 보면 Network Service는 Users 그룹에 할당이 되어 있다고 정의 되어 있다.

[참고문서]

NetworkService Account

https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms684272(v=vs.85).aspx

The NetworkService account has the following privileges:

- Any privileges assigned to users and authenticated users

 

그래서 레지스트리의 Users 그룹을 추가하면 WMI 가 접근이 가능하게 된다.

레지스트리의 Permmision에서 Users그룹 대신에 Network Service를 추가해도 정상적으로 정보가 보이게 된다.

 

결론이다.

SQL Server 구성관리자의 서비스 정보들은 WMI Provider 를 호출할 때 Network Service 권한을 가지고 레지스트리의 정보를 가져와서 뿌려준다.

이게 결론이다. 알고 나면 참 쉽다.

찾기가 어려울 뿐이다.

 

더 찾아볼까?

ProcessMonitor 툴로 가볍게 찾을 수 있다.

아래와 같이 필터를 추가한다.

해당 레지스트리의 하위값을 접근정보를 가져오는 조건이다.


해당 조건을 걸고 SQL 구성관리자의 서비스 목록을 새로고침 해보자.

위에서 언급한 내용을 증명할 수 있는 부분이다. 이제 믿겠는가 ????

 


댓글
최근에 올라온 글
최근에 달린 댓글
글 보관함
Total
Today
Yesterday