Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed Installation at postgres 2/3 with Ghostwrite v4.0.7 and Docker Desktop 4.27.1 #388

Open
mendacus opened this issue Feb 3, 2024 · 5 comments
Assignees

Comments

@mendacus
Copy link

mendacus commented Feb 3, 2024

Describe the bug
Following the quickstart guide, I run into an error at postgres 2/3 while installing Ghostwriter.

To Reproduce
Steps to reproduce the behavior:

  1. System information of my machine.
OS Name:                   Microsoft Windows 10 Enterprise Evaluation
OS Version:                10.0.19045 N/A Build 19045
  1. Download and install the newest version of Docker Desktop https://docs.docker.com/desktop/install/windows-install/
  2. Either git clone the Ghostwriter repository, or download the source from "Releases" for v4.0.7.
  3. Navigate to the directory, and follow Ghostwriter quickstart of:
./ghostwriter-cli install

Expected Behavior
An expectation of Ghostwriter to be installed. From the quickstart guide, it seemed straightforward.

Screenshots

image

Server Specs:

  1. Docker Version Information
Client:
 Cloud integration: v1.0.35+desktop.10
 Version:           25.0.2
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        29cf629
 Built:             Thu Feb  1 00:24:09 2024
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.27.1 (136059)
 Engine:
  Version:          25.0.2
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       fce6e0c
  Built:            Thu Feb  1 00:23:17 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  1. Docker Compose Version
Docker Compose version v2.24.3-desktop.1

Additional context
I ran through the documentation for the quickstart install, it seems all of my versions are in-line for Docker. Please let me know if additional information is needed to resolve this. Will be more than obliged. Thanks in advance!

@mendacus mendacus added the bug Something isn't working label Feb 3, 2024
@chrismaddalena
Copy link
Collaborator

Hey @mendacus, Docker encountered an error during the build when it couldn't find a file it needed. Make sure you are running the install command in the Ghostwriter directory.

You should be able to run this command in your current directory and see this file list:

$ ls ./compose/production/postgres/maintenance
_sourced backup   backups  restore

@chrismaddalena chrismaddalena removed the bug Something isn't working label Feb 6, 2024
@mendacus
Copy link
Author

mendacus commented Feb 7, 2024

Hi @chrismaddalena,

Apologies for the delayed response. I have confirmed that I am running from the expected directory in accordance to your command.

PS D:\redteam\tools\Ghostwriter-4.0.7> ls ./compose/production/postgres/maintenance


    Directory: D:\redteam\tools\Ghostwriter-4.0.7\compose\production\postgres\maintenance


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          2/7/2024   1:44 PM                _sourced
-a----          2/7/2024   1:44 PM            818 backup
-a----          2/7/2024   1:44 PM            392 backups
-a----          2/7/2024   1:44 PM           1828 restore

Immediately after this, I attempt the install.

PS D:\redteam\tools\Ghostwriter-4.0.7> .\ghostwriter-cli.exe install
[+] Checking the status of Docker and the Compose plugin...
[+] Starting production environment installation
[*] Generating new `ghostwriter.crt` and `ghostwriter.key` files
[!] Found existing certificate files, so new ones will not be generated...
[*] Rename or delete ssl/ghostwriter.key and ssl/ghostwriter.key if you want to replace these keys[*] Skipping DH params because D:\redteam\tools\Ghostwriter-4.0.7\ssl\dhparam.pem already exists
2024/02/07 13:54:56 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed
2024/02/07 13:54:56 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed
#0 building with "default" instance using docker driver

#1 [redis internal] load build definition from Dockerfile
#1 transferring dockerfile: 57B 0.0s done
#1 DONE 0.0s

#2 [postgres internal] load build definition from Dockerfile
#2 transferring dockerfile: 275B done
#2 DONE 0.0s

#3 [postgres internal] load metadata for docker.io/library/postgres:11.12
#3 DONE 0.4s

#4 [redis internal] load metadata for docker.io/library/redis:6-alpine
#4 DONE 0.4s

#5 [postgres internal] load .dockerignore
#5 transferring context: 566B done
#5 DONE 0.0s

#6 [redis internal] load .dockerignore
#6 transferring context: 566B 0.0s done
#6 DONE 0.0s

#7 [postgres internal] load build context
#7 transferring context: 2B done
#7 DONE 0.0s

#8 [postgres 2/3] COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
#8 ERROR: failed to calculate checksum of ref 01df219c-e8b7-4266-9f84-f3df7ee1cb74::vbsilh6mc254wua44sa8gewcn: failed to walk /var/lib/docker/tmp/buildkit-mount3631553763/compose/production/postgres: lstat /var/lib/docker/tmp/buildkit-mount3631553763/compose/production/postgres: no such file or directory

#9 [postgres 1/3] FROM docker.io/library/postgres:11.12@sha256:13e23e5f97a42286c5703691e2fbad0806970bd13121fe7c28f32349ee0cf917
#9 resolve docker.io/library/postgres:11.12@sha256:13e23e5f97a42286c5703691e2fbad0806970bd13121fe7c28f32349ee0cf917 0.0s done
#9 sha256:13e23e5f97a42286c5703691e2fbad0806970bd13121fe7c28f32349ee0cf917 1.22kB / 1.22kB done
#9 sha256:ced2df470c455d54414cd5b1cac46980781b5172e6f2abcc172510aa931477c1 3.04kB / 3.04kB done
#9 sha256:48dea8832b955ddc5373f087a538213a07df9b9fb558c6218ecaa0b20aac1e98 10.35kB / 10.35kB done
#9 CANCELED

#10 [redis 1/1] FROM docker.io/library/redis:6-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
#10 resolve docker.io/library/redis:6-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5 0.0s done
#10 sha256:cd67e73ee8d945f3974e2054b0fe6b309a721bf13dbc1e4891afd5007d279f0c 2.24kB / 2.24kB done
failed to solve: failed to compute cache key: failed to calculate checksum of ref 01df219c-e8b7-4266-9f84-f3df7ee1cb74::vbsilh6mc254wua44sa8gewcn: failed to walk /var/lib/docker/tmp/buildkit-mount3631553763/compose/production/postgres: lstat /var/lib/docker/tmp/buildkit-mount3631553763/compose/production/postgres: no such file or directory
#10 sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5 7.23kB / 7.23kB done
#10 sha256:b6c412dc298714b5c26feca1330d8f743b48caf0b1feeadfd554d7d446f985a5 8.39kB / 8.39kB done
#10 CANCELED
------
 > [postgres 2/3] COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance:
------
[-] Error from `docker`: exit status 17
2024/02/07 13:54:57 Error trying to build with production.yml: exit status 17

I also attempted to navigate to the Ghostwriter/ghostwriter directory for the install to make sure I accounted for my proposed self-introduced error. This resulted in the same issue.

Please let me know if I am overlooking something, I very well could be. But based from your response, I think I followed your instructions.

@chrismaddalena
Copy link
Collaborator

Thanks for checking that. The files are there so Docker should be able to find them. What permissions are on those files and the other contents under the Ghostwriter-4.0.7 directory?

If you try building the containers with a console opened under with admin privileges does it work?

@Eneru
Copy link

Eneru commented Mar 6, 2024

Hello,

I have the same issue as him.
I managed to solve it by modifying 2 files :

  • production.yaml (postgres part, changing the context path in the build)
build:
      context: ./compose/production/postgres
      dockerfile: ./Dockerfile
  • ./compose/production/postgres/Dockerfile (adapting the maintenance path from production.yaml's context)
COPY maintenance /usr/local/bin/maintenance

I am not enough an expert on Docker (especially on Windows), so it would be hard for me to explain it why it worked in this way and not the other.

@chrismaddalena
Copy link
Collaborator

Thanks for the comment. The context: . should set the build context for Docker Compose to the current working directory (e.g., C:\\Some\Directory\Ghostwriter\). Then Compose looks for the necessary files starting from that context. Maybe the working context behaves a little differently on Windows. I'll have to setup a Windows system to test that with different versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants