certify icon indicating copy to clipboard operation
certify copied to clipboard

[v5] Deployment task: Deploy to Apache / Export Certificate doesn't appear to write the destination file(s)

Open JLJTGR opened this issue 6 years ago • 5 comments

Version: 5.0.2.0

Given the log:

2020-04-28 15:11:37.691 -04:00 [INF] Task [Deploy to Apache KEY/CERT] :: Task is enabled and primary request was successful.
2020-04-28 15:11:37.691 -04:00 [INF] Deploy to Apache:: exporting PEM format certificate file
2020-04-28 15:11:37.764 -04:00 [INF] Deploy to Apache:: exporting PEM format key file

No files are created at the specified destination. (C:\ProgramData\Certify\assets\exports\etc...)

Procmon log excerpts:

3:11:37.6914148 PM	CertifySSLManager.Service.exe	9028	WriteFile	C:\ProgramData\Certify\logs\log_9018ff16-6a5f-4b13-b7b4-1f5c84cc0de3_.txt	SUCCESS	Offset: -1, Length: 125
3:11:37.6916629 PM	CertifySSLManager.Service.exe	9028	WriteFile	C:\ProgramData\Certify\logs\log_9018ff16-6a5f-4b13-b7b4-1f5c84cc0de3_.txt	SUCCESS	Offset: -1, Length: 126
3:11:37.6917589 PM	CertifySSLManager.Service.exe	9028	WriteFile	C:\ProgramData\Certify\logs\log_9018ff16-6a5f-4b13-b7b4-1f5c84cc0de3_.txt	SUCCESS	Offset: -1, Length: 95
3:11:37.6920451 PM	CertifySSLManager.Service.exe	9028	ReadFile	C:\ProgramData\Certify\assets\xxxx.xxxxxx.com\20200727_ce6a1a9d.pfx	SUCCESS	Offset: 0, Length: 4,610, Priority: Normal
3:11:37.6936680 PM	CertifySSLManager.Service.exe	9028	WriteFile	C:\Windows\Temp\Tmp9261.tmp	SUCCESS	Offset: 0, Length: 4,610, Priority: Normal
3:11:37.7208338 PM	CertifySSLManager.Service.exe	9028	SetDispositionInformationEx	C:\Windows\Temp\Tmp9261.tmp	SUCCESS	Flags: FILE_DISPOSITION_DELETE, FILE_DISPOSITION_POSIX_SEMANTICS, FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK
3:11:37.7226673 PM	CertifySSLManager.Service.exe	9028	WriteFile	C:\Windows\Temp\Tmp9281.tmp	SUCCESS	Offset: 0, Length: 4,610, Priority: Normal
3:11:37.7310558 PM	CertifySSLManager.Service.exe	9028	SetDispositionInformationEx	C:\Windows\Temp\Tmp9281.tmp	SUCCESS	Flags: FILE_DISPOSITION_DELETE, FILE_DISPOSITION_POSIX_SEMANTICS, FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK
3:11:37.7649405 PM	CertifySSLManager.Service.exe	9028	WriteFile	C:\ProgramData\Certify\logs\log_9018ff16-6a5f-4b13-b7b4-1f5c84cc0de3_.txt	SUCCESS	Offset: -1, Length: 87
3:11:37.7652839 PM	CertifySSLManager.Service.exe	9028	ReadFile	C:\ProgramData\Certify\assets\xxxx.xxxxxx.com\20200727_ce6a1a9d.pfx	SUCCESS	Offset: 0, Length: 4,610, Priority: Normal
3:11:37.7668180 PM	CertifySSLManager.Service.exe	9028	WriteFile	C:\Windows\Temp\Tmp92B1.tmp	SUCCESS	Offset: 0, Length: 4,610, Priority: Normal
3:11:37.7744727 PM	CertifySSLManager.Service.exe	9028	SetDispositionInformationEx	C:\Windows\Temp\Tmp92B1.tmp	SUCCESS	Flags: FILE_DISPOSITION_DELETE, FILE_DISPOSITION_POSIX_SEMANTICS, FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK
3:11:37.7762331 PM	CertifySSLManager.Service.exe	9028	WriteFile	C:\Windows\Temp\Tmp92B2.tmp	SUCCESS	Offset: 0, Length: 4,610, Priority: Normal
3:11:37.7833496 PM	CertifySSLManager.Service.exe	9028	SetDispositionInformationEx	C:\Windows\Temp\Tmp92B2.tmp	SUCCESS	Flags: FILE_DISPOSITION_DELETE, FILE_DISPOSITION_POSIX_SEMANTICS, FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK

The service seems to copy the PFX to the temp folder a couple times each... but doesn't write out any files of different length than the PFX. The related deployment task "Export Certificate" seems to not fair any better for "PEM - Private Key" or "PEM - Full Certificate Chain" modes.

JLJTGR avatar Apr 28 '20 19:04 JLJTGR

Thanks, I'll check it out. The intent is that you would write out the files directly to an Apache installation, replacing the cert you already have, but this export should obviously work.

Does the 'export' folder exist already?

webprofusion-chrisc avatar Apr 28 '20 23:04 webprofusion-chrisc

The export folder is where the current cer/key files are that I previously used OpenSSL to extract from the PFX. Apache's vhosts config points to them directly. I also use the folder for hMailServer's cert pair that I tried the key/chain export with.

Procmon doesn't show the service process trying to open the folder or files within. Usually there would be a CreateFile entry with a result of NAME NOT FOUND if the folder didn't exist.

JLJTGR avatar Apr 28 '20 23:04 JLJTGR

Thanks, there's a couple of issues here:

  • you have to specify the whole path to each file, not just a folder
  • if your Task 'Target Type' is set to 'Local (run as a current service user)' its incorrectly skipping the file copy

webprofusion-chrisc avatar Apr 29 '20 02:04 webprofusion-chrisc

Hmm, yes... It works properly if I use "Local (as specific user)".

JLJTGR avatar Apr 29 '20 04:04 JLJTGR

Fixed in next release. Will now run as local service as intended (by default) and will also error if path supplied is a folder.

webprofusion-chrisc avatar Apr 29 '20 06:04 webprofusion-chrisc