cobbr / Covenant

Covenant is a collaborative .NET C2 framework for red teamers.
https://cobbr.io/Covenant.html
GNU General Public License v3.0
4.17k stars 768 forks source link

Docker cannot start #219

Closed rgzn-aiyun closed 3 years ago

rgzn-aiyun commented 4 years ago

Error: git submodules have not been initialized Covenant's submodules can be cloned with: git clone --recurse-submodules https://github.com/cobbr/Covenant Or initialized after cloning with: git submodule update --init --recursive

frenkel commented 4 years ago

Are you using SELinux? For me it helps to temporarily disable it by running setenforce 0.

rgzn-aiyun commented 4 years ago

Are you using SELinux? For me it helps to temporarily disable it by running setenforce 0.

SELINUX is closed, not for this reason

m0n0rchid commented 4 years ago

I am also having this issue:

$ docker version
Docker version 19.03.12-ce, build 48a66213fe
$ uname -a
Linux local.lab 5.8.1-arch1-1 #1 SMP PREEMPT Wed, 12 Aug 2020 18:50:43 +0000 x86_64 GNU/Linux
cobbr commented 4 years ago

@rgzn-aiyun Did you clone the repo recursively? git clone --recurse-submodules https://github.com/cobbr/Covenant

wesinator commented 4 years ago

dupe of #161 @cobbr yes, I'm also experiencing this even after cloning the repo with submodules and following the docker setup instructions

cobbr commented 4 years ago

@rgzn-aiyun @wesinator or @m0n0rchid Can you show me the exact Docker commands you are running? I'm not able to reproduce this.

And also share the output of ls -la Data/ReferenceSourceLibraries/ and ls -la Data/ReferenceSourceLibraries/SharpSploit

wesinator commented 4 years ago

Ubuntu 18.04.5 Docker version 19.03.12, build 48a66213fe

$ git clone --recurse-submodules https://github.com/cobbr/Covenant.git covenant
Cloning into 'covenant'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 5950 (delta 5), reused 9 (delta 4), pack-reused 5934
Receiving objects: 100% (5950/5950), 32.25 MiB | 1.06 MiB/s, done.
Resolving deltas: 100% (3716/3716), done.
Submodule 'Covenant/Data/ReferenceSourceLibraries/Rubeus' (https://github.com/GhostPack/Rubeus) registered for path 'Covenant/Data/ReferenceSourceLibraries/Rubeus'
Submodule 'Covenant/Data/ReferenceSourceLibraries/Seatbelt' (https://github.com/GhostPack/Seatbelt) registered for path 'Covenant/Data/ReferenceSourceLibraries/Seatbelt'
Submodule 'Covenant/Data/ReferenceSourceLibraries/SharpDPAPI' (https://github.com/GhostPack/SharpDPAPI) registered for path 'Covenant/Data/ReferenceSourceLibraries/SharpDPAPI'
Submodule 'Covenant/Data/ReferenceSourceLibraries/SharpDump' (https://github.com/GhostPack/SharpDump) registered for path 'Covenant/Data/ReferenceSourceLibraries/SharpDump'
Submodule 'Covenant/Data/ReferenceSourceLibraries/SharpSC' (https://github.com/djhohnstein/SharpSC) registered for path 'Covenant/Data/ReferenceSourceLibraries/SharpSC'
Submodule 'Covenant/Data/ReferenceSourceLibraries/SharpSploit' (https://github.com/cobbr/SharpSploit) registered for path 'Covenant/Data/ReferenceSourceLibraries/SharpSploit'
Submodule 'Covenant/Data/ReferenceSourceLibraries/SharpUp' (https://github.com/GhostPack/SharpUp) registered for path 'Covenant/Data/ReferenceSourceLibraries/SharpUp'
Submodule 'Covenant/Data/ReferenceSourceLibraries/SharpWMI' (https://github.com/GhostPack/SharpWMI) registered for path 'Covenant/Data/ReferenceSourceLibraries/SharpWMI'
Cloning into '/home/osboxes/Documents/covenant/Covenant/Data/ReferenceSourceLibraries/Rubeus'...
remote: Enumerating objects: 43, done.        
remote: Counting objects: 100% (43/43), done.        
remote: Compressing objects: 100% (36/36), done.        
remote: Total 916 (delta 21), reused 15 (delta 7), pack-reused 873        
Receiving objects: 100% (916/916), 445.02 KiB | 1.57 MiB/s, done.
Resolving deltas: 100% (676/676), done.
Cloning into '/home/osboxes/Documents/covenant/Covenant/Data/ReferenceSourceLibraries/Seatbelt'...
remote: Enumerating objects: 61, done.        
remote: Counting objects: 100% (61/61), done.        
remote: Compressing objects: 100% (43/43), done.        
remote: Total 514 (delta 28), reused 36 (delta 18), pack-reused 453        
Receiving objects: 100% (514/514), 793.28 KiB | 1.32 MiB/s, done.
Resolving deltas: 100% (271/271), done.
Cloning into '/home/osboxes/Documents/covenant/Covenant/Data/ReferenceSourceLibraries/SharpDPAPI'...
remote: Enumerating objects: 175, done.        
remote: Counting objects: 100% (175/175), done.        
remote: Compressing objects: 100% (109/109), done.        
remote: Total 451 (delta 117), reused 115 (delta 65), pack-reused 276        
Receiving objects: 100% (451/451), 1.32 MiB | 1.25 MiB/s, done.
Resolving deltas: 100% (227/227), done.
Cloning into '/home/osboxes/Documents/covenant/Covenant/Data/ReferenceSourceLibraries/SharpDump'...
remote: Enumerating objects: 22, done.        
remote: Total 22 (delta 0), reused 0 (delta 0), pack-reused 22        
Cloning into '/home/osboxes/Documents/covenant/Covenant/Data/ReferenceSourceLibraries/SharpSC'...
remote: Enumerating objects: 19, done.        
remote: Counting objects: 100% (19/19), done.        
remote: Compressing objects: 100% (11/11), done.        
remote: Total 19 (delta 7), reused 19 (delta 7), pack-reused 0        
Cloning into '/home/osboxes/Documents/covenant/Covenant/Data/ReferenceSourceLibraries/SharpSploit'...
remote: Enumerating objects: 39, done.        
remote: Counting objects: 100% (39/39), done.        
remote: Compressing objects: 100% (27/27), done.        
remote: Total 1320 (delta 15), reused 26 (delta 12), pack-reused 1281        
Receiving objects: 100% (1320/1320), 14.38 MiB | 1.16 MiB/s, done.
Resolving deltas: 100% (843/843), done.
Cloning into '/home/osboxes/Documents/covenant/Covenant/Data/ReferenceSourceLibraries/SharpUp'...
remote: Enumerating objects: 57, done.        
remote: Total 57 (delta 0), reused 0 (delta 0), pack-reused 57        
Cloning into '/home/osboxes/Documents/covenant/Covenant/Data/ReferenceSourceLibraries/SharpWMI'...
remote: Enumerating objects: 54, done.        
remote: Counting objects: 100% (54/54), done.        
remote: Compressing objects: 100% (29/29), done.        
remote: Total 78 (delta 24), reused 50 (delta 23), pack-reused 24        
Submodule path 'Covenant/Data/ReferenceSourceLibraries/Rubeus': checked out '1e9fe7c3c2d0458f8200f248079485f3527f314f'
Submodule path 'Covenant/Data/ReferenceSourceLibraries/Seatbelt': checked out '907f5d702e8ffef1b6b05fc1ea88440ec4ae9170'
Submodule path 'Covenant/Data/ReferenceSourceLibraries/SharpDPAPI': checked out 'ea8abe46f2cf9bd40c2c81b998676256eca705ee'
Submodule path 'Covenant/Data/ReferenceSourceLibraries/SharpDump': checked out '41cfcf9b1abed2da79a93c201cbd38fbbe31684c'
Submodule path 'Covenant/Data/ReferenceSourceLibraries/SharpSC': checked out 'adbbc7fb8be7087c18a1701ca6e906ad5e141f27'
Submodule path 'Covenant/Data/ReferenceSourceLibraries/SharpSploit': checked out '4bf3d2aa44d73b674867a1d28cc90a3bd54f100f'
Submodule path 'Covenant/Data/ReferenceSourceLibraries/SharpUp': checked out '0b3f09fd2d6f91251e62ad3702ad309f8ed5c6df'
Submodule path 'Covenant/Data/ReferenceSourceLibraries/SharpWMI': checked out 'f01fda9c32e75f8b10238c032c3424c6ad733d0f'
osboxes@osboxes:~/Documents$ cd covenant/
osboxes@osboxes:~/Documents/covenant$ cd Covenant/
osboxes@osboxes:~/Documents/covenant/Covenant$ sudo docker build -t covenant .
[sudo] password for osboxes: 
Sending build context to Docker daemon  88.16MB
Step 1/10 : FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
3.1: Pulling from dotnet/core/sdk
d6ff36c9ec48: Pull complete 
c958d65b3090: Pull complete 
edaf0a6b092f: Pull complete 
80931cf68816: Pull complete 
7b9b87089c2a: Pull complete 
4f2c2524f197: Pull complete 
b7b0f8dc0c5c: Pull complete 
Digest: sha256:4805a0ec2e1acae2be9554679acca0ec368aaf50cabdd028c0aa3cb8ff34a751
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/sdk:3.1
 ---> 9ab567a29502
Step 2/10 : WORKDIR /app
 ---> Running in b53954b1866a
Removing intermediate container b53954b1866a
 ---> ce5c21ebf586
Step 3/10 : COPY . ./
 ---> 23e10f2d07bd
Step 4/10 : RUN dotnet publish -c Release -o out
 ---> Running in cd42613bc0c5
Microsoft (R) Build Engine version 16.7.0-preview-20360-03+188921e2f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...

  Restored /app/Covenant.csproj (in 48.12 sec).
  Covenant -> /app/bin/Release/netcoreapp3.1/Covenant.dll
  Covenant -> /app/bin/Release/netcoreapp3.1/Covenant.Views.dll
  Covenant -> /app/out/
Removing intermediate container cd42613bc0c5
 ---> fd58fa8736a0
Step 5/10 : FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS runtime
 ---> 9ab567a29502
Step 6/10 : WORKDIR /app
 ---> Using cache
 ---> ce5c21ebf586
Step 7/10 : COPY --from=build /app/out .
 ---> 06bb6dcd2f40
Step 8/10 : COPY ./Data ./Data
 ---> cff92512c988
Step 9/10 : EXPOSE 7443 80 443
 ---> Running in 55d6266c0f18
Removing intermediate container 55d6266c0f18
 ---> 5ca864b735fd
Step 10/10 : ENTRYPOINT ["dotnet", "Covenant.dll"]
 ---> Running in bbd5cf54e98d
Removing intermediate container bbd5cf54e98d
 ---> 9c7fcb542f62
Successfully built 9c7fcb542f62
Successfully tagged covenant:latest

run that errors:

sudo docker run -it -p 7443:7443 -p 80:80 -p 443:443 --name covenant -v /home/osboxes/covenant/Covenant/Data:/app/Data covenant 
$ ls -la Data/ReferenceSourceLibraries/ Data/ReferenceSourceLibraries/SharpSploit/
Data/ReferenceSourceLibraries/:
total 40
drwxr-xr-x 10 osboxes osboxes 4096 Aug 20 17:21 .
drwxr-xr-x 13 osboxes osboxes 4096 Aug 20 17:21 ..
drwxr-xr-x  3 osboxes osboxes 4096 Aug 20 17:22 Rubeus
drwxr-xr-x  4 osboxes osboxes 4096 Aug 20 17:22 Seatbelt
drwxr-xr-x  4 osboxes osboxes 4096 Aug 20 17:22 SharpDPAPI
drwxr-xr-x  3 osboxes osboxes 4096 Aug 20 17:22 SharpDump
drwxr-xr-x  3 osboxes osboxes 4096 Aug 20 17:22 SharpSC
drwxr-xr-x  4 osboxes osboxes 4096 Aug 20 17:22 SharpSploit
drwxr-xr-x  3 osboxes osboxes 4096 Aug 20 17:22 SharpUp
drwxr-xr-x  3 osboxes osboxes 4096 Aug 20 17:22 SharpWMI

Data/ReferenceSourceLibraries/SharpSploit/:
total 48
drwxr-xr-x  4 osboxes osboxes 4096 Aug 20 17:22 .
drwxr-xr-x 10 osboxes osboxes 4096 Aug 20 17:21 ..
-rw-r--r--  1 osboxes osboxes 3942 Aug 20 17:22 CHANGELOG.md
-rw-r--r--  1 osboxes osboxes   84 Aug 20 17:22 .git
-rw-r--r--  1 osboxes osboxes 2518 Aug 20 17:22 .gitattributes
-rw-r--r--  1 osboxes osboxes 4318 Aug 20 17:22 .gitignore
-rw-r--r--  1 osboxes osboxes 1466 Aug 20 17:22 LICENSE
-rw-r--r--  1 osboxes osboxes 3959 Aug 20 17:22 README.md
drwxr-xr-x 15 osboxes osboxes 4096 Aug 20 17:22 SharpSploit
-rw-r--r--  1 osboxes osboxes 2280 Aug 20 17:22 SharpSploit.sln
drwxr-xr-x  3 osboxes osboxes 4096 Aug 20 17:22 SharpSploit.Tests
cobbr commented 4 years ago

Hey @wesinator , it looks like your problem might be an incorrect -v parameter, pointing to a non-existent Data folder. Looks like it should be home/osboxes/Documents/covenant/Covenant/Data

wesinator commented 4 years ago

Hey @wesinator , it looks like your problem might be an incorrect -v parameter, pointing to a non-existent Data folder. Looks like it should be home/osboxes/Documents/covenant/Covenant/Data

Hey Ryan, that is the absolute path to my covenant dir I was following the docker command instructions in https://github.com/cobbr/Covenant/wiki/Installation-And-Startup#option-2---docker

I think this is an issue where the submodules are not properly initialized in the docker VM itself. I tried adding a RUN git submodule --init ... cmd in the Dockerfile several places, that didn't fix it and prevented the docker build from working.

cobbr commented 4 years ago

Hey @wesinator , I would take a closer look at what you posted. In your example you do: sudo docker run -it -p 7443:7443 -p 80:80 -p 443:443 --name covenant -v /home/osboxes/covenant/Covenant/Data:/app/Data covenant, using /home/osboxes/covenant/Covenant/Data as your Data directory. But your data directory should have been /home/osboxes/Documents/covenant/Covenant/Data, which would have been the correct value.

wesinator commented 4 years ago

Hey @wesinator , I would take a closer look at what you posted. In your example you do: sudo docker run -it -p 7443:7443 -p 80:80 -p 443:443 --name covenant -v /home/osboxes/covenant/Covenant/Data:/app/Data covenant, using /home/osboxes/covenant/Covenant/Data as your Data directory. But your data directory should have been /home/osboxes/Documents/covenant/Covenant/Data, which would have been the correct value.

oof, thanks Ryan I didn't see that. You're right, it's working now. Sorry for the confusion

cobbr commented 3 years ago

Glad you were able to get it working!