Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRm9s-0004rJ-MW for pgsql-bugs@arkaria.postgresql.org; Fri, 24 Apr 2020 00:25:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRm9q-00020X-0Q for pgsql-bugs@arkaria.postgresql.org; Fri, 24 Apr 2020 00:25:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRm47-0005UX-P0 for pgsql-bugs@lists.postgresql.org; Fri, 24 Apr 2020 00:19:36 +0000 Received: from mail-oln040092253052.outbound.protection.outlook.com ([40.92.253.52] helo=APC01-SG2-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRm43-0008TN-Ud for pgsql-bugs@lists.postgresql.org; Fri, 24 Apr 2020 00:19:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FlPNy3YZDyCOWwA4ZYyyxOLyrxZtAlgXBSAHtcixQlhpg5cmkfRcyNJzEg0ZcnEz1a0MM0p4VYW5R1U+/vyLWS8G+yWnPEzlNOaZpBdPveChe4e9qHk7c89KqJIAxetxuwzDjKvuLVa/0ptcsBezVxEjGZi3sZV0JF52iQwscZFscPEAjOQ2WQSUc3dwkHOGosNHGiuUynoTe72BhfugPw9LgLmZNdqqpWhDOpYwKdvoCrLYrRSmvYqT90ZHBpSguOudLzSOJg5PWrfAUKZHZsEpVTI8x04f+bQN0xUC7H724BM38ZzK1YR0Wlx+R9sfqc0BPWrPdnQd3OfU51DYWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=peH0nSeBtxNwLfzgWpf0+WEiDneP8JBWCGSJrPWuk+g=; b=QURklEL/5PAEH+Kj48p986lpaH1vf921aB/1BWHPqhMyU5qw891buCJeZ6RPoWWgKe0Noa2Mv84XV3B/24CFBb5YkKKRf58umamfNXtdauG5qI8R+wUDy9ogypIX1EjO2HDU9tWR420ABwdLr9fnYW2mwwmSGTDdArF8inSAkt1mOWC+VmPUC9uAfPDD9DGoyv+jDbeE4eQl2k+4DNWu0aYpro6meK07EO5phHeIvNv5GutOVkA/3L1S+W4H9MhHbHtQKlPDepcczXmieWtWEG2SLYCGCQuJ95RUJEwoIdemIETwx1yXfQQSJhdcv4XwnVj4OIzwZhUBRIOlMvIZzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=peH0nSeBtxNwLfzgWpf0+WEiDneP8JBWCGSJrPWuk+g=; b=sD2KPdq46+5DuqmWr/0MAOR0jVwinnlW2pcqMCMduYpie2lWGfVjVbFHXUHFIkMRlpvgVaPHA5+c+Un1RSDxenzc8LJ/O+e2iPA3l6eWsK3h1c1ZcewH8DqESl1X8TPl2J0c3d2L/sLKNn1by3avUUGJmUnAEUa3pdlQhvLTItregrnrc3zG3wYyTmnWI+UyyvGbR/6bbULDmIO615VMxJhYbfT9UcQWl3gxC9C1ivGo82YYkbcsneBc9oCBSSIdrL4pT7++5YlnW7huxrZf6XjaNGBasWi6b11FTc3NdNaCnIkwJvXD3HGAc1ftcLpxFPymJUINjtfLYCxhJM9HfQ== Received: from PU1APC01FT025.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebe::53) by PU1APC01HT107.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebe::294) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.15; Fri, 24 Apr 2020 00:19:28 +0000 Received: from SL2P216MB0666.KORP216.PROD.OUTLOOK.COM (10.152.252.54) by PU1APC01FT025.mail.protection.outlook.com (10.152.252.237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.15 via Frontend Transport; Fri, 24 Apr 2020 00:19:27 +0000 Received: from SL2P216MB0666.KORP216.PROD.OUTLOOK.COM ([fe80::85dd:7142:764c:8e04]) by SL2P216MB0666.KORP216.PROD.OUTLOOK.COM ([fe80::85dd:7142:764c:8e04%9]) with mapi id 15.20.2921.032; Fri, 24 Apr 2020 00:19:27 +0000 From: M Fysh To: Sandeep Thakkar , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #16364: ICACLS error when installing under system context "NT AUTHORITY\SYSTEM" ie installing with SCCM Thread-Topic: BUG #16364: ICACLS error when installing under system context "NT AUTHORITY\SYSTEM" ie installing with SCCM Thread-Index: AQHWFvOxXgYY+bUGpke5IXa4I7oyc6iHbWMG Date: Fri, 24 Apr 2020 00:19:27 +0000 Message-ID: References: <16364-88ed41c117f20e13@postgresql.org>, In-Reply-To: Accept-Language: en-AU, en-US Content-Language: en-AU X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:4DF74F0978FAC8A5C1C347501276347A88F21DDD3427E5A7CA921127498638A2;UpperCasedChecksum:37F39E042EC764931C869B1ED9E479124BECD74970A6538248AFA962FC8C0A8E;SizeAsReceived:7142;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [XwjjnZqRyt/Oet+FMw7A+fqCruoN+qhV] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: a8ed2f53-29b5-46c4-1b52-08d7e7e526c0 x-ms-traffictypediagnostic: PU1APC01HT107: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: i0QHa/BsnvvmMhJDki2IsAjqZAhl0V1vHpV4wjuYHrwXw96ovgIitsoVcTxBYI/SCv35PqInfUuoLvSCl/5dMCDzy1wd4kxgiQ4j5b71p3reARr//seyTfUdm4G+UQyURu+i6buLKzuB1xct7SDiDHp823V3VbaQvE2teyGkJF2Slm/J7ORx1g0ncGUZekWPaD/CmXO5sD/W6MaMBiU4ktWYyC4k1Qur+4VVE4z2xRhKLed+KWbTZMuL6VGCgpgp x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:SL2P216MB0666.KORP216.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: ZiKu9GFylvupGo0UuWaoZlvrXuiwi8tu8VcTzyN7jVnWBgoTRjdrZYASGg9oJeK2caUvfxn6ZsdxaBIX9LPzs3gDswStnSZg73+hONjEqk+RQgmpyz5d6jI44EXjkN4/1iTw+4Xeh6gSWIN/n8NKOw== x-ms-exchange-transport-forked: True Content-Type: multipart/alternative; boundary="_000_SL2P216MB0666FD5553AA70BAE3092060F9D00SL2P216MB0666KORP_" MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: a8ed2f53-29b5-46c4-1b52-08d7e7e526c0 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Apr 2020 00:19:27.9345 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PU1APC01HT107 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_SL2P216MB0666FD5553AA70BAE3092060F9D00SL2P216MB0666KORP_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thank you for the quick response. I have tested the fix for V11 and it worked. Thank you Michael ________________________________ From: Sandeep Thakkar Sent: Monday, 20 April 2020 7:11 PM To: m_fysh@hotmail.com ; pgsql-bugs@lists.postgresql.or= g Subject: Re: BUG #16364: ICACLS error when installing under system context = "NT AUTHORITY\SYSTEM" ie installing with SCCM Hi, This is a duplicate of BUG #16341. We have generated a "test" installer with the fix for v11 and uploaded it h= ere. Could you please verify if it fixes the i= ssue? If it does, then we would release an update for all affected versions= . Thank you. On Wed, Apr 15, 2020 at 2:35 PM PG Bug reporting form > wrote: The following bug has been logged on the website: Bug reference: 16364 Logged by: MF Email address: m_fysh@hotmail.com PostgreSQL version: 12.2 Operating system: Windows 10 Description: ICACLS error when installing under system context "NT AUTHORITY\SYSTEM" ie installing with SCCM System context has no user profile, the installer tries to set security permissions to domain\hostname The first call to icacls removes inheritance C:\WINDOWS\System32\icacls "C:\Windows\Temp/postgresql_installer_9283e94fc0= " /inheritance:r The next call adds permissions for domain\hostname$ (this should be "NT AUTHORITY\SYSTEM" or "hostname\Administrators") Executing C:\WINDOWS\System32\icacls "C:\Windows\Temp/postgresql_installer_9283e94fc0" /T /Q /grant "COR\Txxx6767$:(OI)(CI)F" At that point the permissions on the folder have changed but the installer no longer has access to the folder contents So the next step fails Error running C:\WINDOWS\System32\icacls "C:\Windows\Temp/postgresql_installer_9283e94fc0" /T /Q /grant "CORP\TM10336767$:(OI)(CI)F": C:\Windows\Temp/postgresql_installer_9283e94fc0\*: Access is denied. To reproduce the error use the Sysinternals tool Open a cmd windows as admin the run psexec.exe -s -i cmd This will open a new CMD window in System context. install PostgreSQL When installing as just and ADMIN user (with profile) Executing icacls "C:\Users\USER_adm\AppData\Local\Temp/postgresql_installer_57a6af5619" /inheritance:r the user is still the owner of the folder so can still make changes to it. Note you are now adding the current user domain\user in the next call to icacls.exe Executing icacls "C:\Users\USER_adm\AppData\Local\Temp/postgresql_installer_57a6af5619" /T /= Q /grant "COR\USER_adm:(OI)(CI)F" So an Admin User install will work But a System install will not. I tried this will 12.2.2, 12.2.1, 10.12.2 -- Sandeep Thakkar --_000_SL2P216MB0666FD5553AA70BAE3092060F9D00SL2P216MB0666KORP_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Thank you for the quick response.
I have tested the fix for V11 and it worked.

Thank you
Michael


From: Sandeep Thakkar <= ;sandeep.thakkar@enterprisedb.com>
Sent: Monday, 20 April 2020 7:11 PM
To: m_fysh@hotmail.com <m_fysh@hotmail.com>; pgsql-bugs@lists.= postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #16364: ICACLS error when installing under system c= ontext "NT AUTHORITY\SYSTEM" ie installing with SCCM
 
Hi,

This is a duplicate of BUG #16341.

We have generated a "test" installer with the fix for v11 an= d uploaded it here. Could you please verify if it fixes the issue? If it does, then w= e would release an update for all affected versions. Thank you.

On Wed, Apr 15, 2020 at 2:35 PM PG = Bug reporting form <noreply@po= stgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      16364
Logged by:          MF
Email address:      m_fysh@hotmail.com
PostgreSQL version: 12.2
Operating system:   Windows 10
Description:       

ICACLS error when installing under system context "NT AUTHORITY\SYSTEM= "  ie
installing with SCCM

System context has no user profile, the installer tries to set security
permissions to domain\hostname
The first call to icacls removes inheritance
C:\WINDOWS\System32\icacls "C:\Windows\Temp/postgresql_installer_9283e= 94fc0"
/inheritance:r

The next call adds permissions for  domain\hostname$  (this shoul= d be "NT
AUTHORITY\SYSTEM" or "hostname\Administrators")
Executing C:\WINDOWS\System32\icacls
"C:\Windows\Temp/postgresql_installer_9283e94fc0" /T /Q /grant "COR\Txxx6767$:(OI)(CI)F"

At that point the permissions on the folder have changed but the installer<= br> no longer has access to the folder contents
So the next step fails
Error running C:\WINDOWS\System32\icacls
"C:\Windows\Temp/postgresql_installer_9283e94fc0" /T /Q /grant "CORP\TM10336767$:(OI)(CI)F":
C:\Windows\Temp/postgresql_installer_9283e94fc0\*: Access is denied.

To reproduce the error use the Sysinternals tool
Open a cmd windows as admin the run
psexec.exe -s -i cmd
This will open a new CMD window in System context. install PostgreSQL

When installing as just and ADMIN user (with profile)
Executing icacls
"C:\Users\USER_adm\AppData\Local\Temp/postgresql_installer_57a6af5619&= quot;
/inheritance:r
the user is still the owner of the folder so can still make changes to it.<= br>
Note you are now adding the current user  domain\user in the next call= to
icacls.exe
Executing icacls
"C:\Users\USER_adm\AppData\Local\Temp/postgresql_installer_57a6af5619&= quot; /T /Q
/grant "COR\USER_adm:(OI)(CI)F"
So an Admin User install will work
But a System install will not.

I tried this will 12.2.2, 12.2.1, 10.12.2



--
Sandeep Thakkar


--_000_SL2P216MB0666FD5553AA70BAE3092060F9D00SL2P216MB0666KORP_--