aau-network-security / haaukins

A Highly Accessible and Automated Virtualization Platform for Security Education
https://general.haaukins.com
Apache License 2.0
184 stars 39 forks source link

Installation howto or cluttered log output for install #267

Closed kidmose closed 4 years ago

kidmose commented 5 years ago

Trying to install the project in golang docker container, and otherwise sticking to the readme, I get a somewhat cluttered transcript. If things were good and healthy, I would not expect a bunch of messages about missing packages.

Can any of you guys quickly tell if this is something I'm doing wrong (Then we might need to fix the README) or should we perhaps fix the underlying issue/suppress expected warnings?

egk@egk-ThinkPad-T450s:~/git-reps/haaukins$ docker run -it --rm golang:1.7 /bin/bash -c 'git clone https://github.com/aau-network-security/haaukins.git && cd haaukins && go get ./...'
Cloning into 'haaukins'...
remote: Enumerating objects: 131, done.
remote: Counting objects: 100% (131/131), done.
remote: Compressing objects: 100% (102/102), done.
remote: Total 5194 (delta 56), reused 60 (delta 21), pack-reused 5063
Receiving objects: 100% (5194/5194), 4.20 MiB | 3.14 MiB/s, done.
Resolving deltas: 100% (2983/2983), done.
Checking connectivity... done.
package math/bits: unrecognized import path "math/bits" (import path does not begin with hostname)
package github.com/go-acme/lego/v3/acme: cannot find package "github.com/go-acme/lego/v3/acme" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/acme (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/acme (from $GOPATH)
package github.com/go-acme/lego/v3/certcrypto: cannot find package "github.com/go-acme/lego/v3/certcrypto" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/certcrypto (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/certcrypto (from $GOPATH)
package github.com/go-acme/lego/v3/certificate: cannot find package "github.com/go-acme/lego/v3/certificate" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/certificate (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/certificate (from $GOPATH)
package github.com/go-acme/lego/v3/challenge: cannot find package "github.com/go-acme/lego/v3/challenge" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/challenge (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/challenge (from $GOPATH)
package github.com/go-acme/lego/v3/challenge/http01: cannot find package "github.com/go-acme/lego/v3/challenge/http01" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/challenge/http01 (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/challenge/http01 (from $GOPATH)
package github.com/go-acme/lego/v3/challenge/tlsalpn01: cannot find package "github.com/go-acme/lego/v3/challenge/tlsalpn01" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/challenge/tlsalpn01 (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/challenge/tlsalpn01 (from $GOPATH)
package github.com/go-acme/lego/v3/lego: cannot find package "github.com/go-acme/lego/v3/lego" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/lego (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/lego (from $GOPATH)
package github.com/go-acme/lego/v3/registration: cannot find package "github.com/go-acme/lego/v3/registration" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/registration (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/registration (from $GOPATH)
package github.com/go-acme/lego/v3/challenge/dns01: cannot find package "github.com/go-acme/lego/v3/challenge/dns01" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/challenge/dns01 (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/challenge/dns01 (from $GOPATH)
package github.com/go-acme/lego/v3/log: cannot find package "github.com/go-acme/lego/v3/log" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/log (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/log (from $GOPATH)
package github.com/go-acme/lego/v3/platform/config/env: cannot find package "github.com/go-acme/lego/v3/platform/config/env" in any of:
    /usr/local/go/src/github.com/go-acme/lego/v3/platform/config/env (from $GOROOT)
    /go/src/github.com/go-acme/lego/v3/platform/config/env (from $GOPATH)
mrtrkmn commented 5 years ago

Dockerfile resolves the issue, if the following commands inserted into Dockerfile in haaukins directory in your local computer, then pre-configured image can be built.

In Haaukins directory on the local computer;

docker build -t haaukinsdev:latest .

Example Dockerfile

FROM golang:1.11
WORKDIR /go/src/github.com/aau-network-security/haaukins
COPY . .
RUN go get -d -v ./...

Afterwards, image can be accessible.

kidmose commented 5 years ago

Thanks :) I'm not (currently) looking into dockerizing - my goal is to have a clean, reproducible install, which i easily get with docker.

This raises a few more specific questions;

  1. Is it important to pick 1.11 over 1.7? Then we should fix the readme.
  2. What is the motivation and impact of changing workdir? This is not in the readme?
  3. What files are COPYed in? I guess this is equivalent to git clone ..?
  4. Is it really not necessary to install packages? (-d) Then the readme has to be updated in this regard to.
mrtrkmn commented 5 years ago
  1. It is crucial to pick 1.13 if we will keep using certmagic, since it is updated 14 hours ago, and it requires at least go version 1.13. *(This will be updated on readme file as well ) (To run it properly.)
  2. Regarding to workdir, actually there is no information of running haaukins within golang docker container, hence it is not on readme yet.
  3. Yeah COPY , we might say that it is equivalent to git clone ... however, when cloning a go project the directory where clone will take place should be in proper place.(meaning that GOPATH should have access to that resources)(I think, it is not necessarily correct when the project has go modules )
  4. No it is not necessary, however readme does not cover the requirements to run project golang docker container.
kidmose commented 5 years ago

To clarify; In this context, docker is not the issue, nor a goal. I just use docker as an easy way to get a clean environment, where I know stuff is not accidentally working because of a library I installed previously for something completely unrelated (or other hidden side effects..). This helps ensuring that our installation instructions are reproducible. Instead of docker, you can for instance format your machine and do a fresh install of the latest ubuntu, or reset your Mac to factory defaults before testing the install instructions. This is just very painful and time consuming ;) Docker gives me this in one line and in seconds.

So it seems that we have the following fixes to do:

  1. Correct golang version in README
  2. Extend readme to make it clear how to ensure that haaukins is on $GOPATH, also taking into consideration what the implications of go modules are.
  3. Remove -d from README, as it serves no purpose?
  4. Clarify if it is feasible to automate testing of README instructions, and if so, implement this.
mrtrkmn commented 5 years ago
  1. It is required (version update) because of changes on dependent library that Haaukins use. So, it will be updated.
  2. Will be extended.
  3. There is already no -d on readme, or am I missing something ?
  4. Yeah, I will look at that.
kidmose commented 4 years ago

Regarding 3: You're right, it's fixed :) (or was never there? :/)

mrtrkmn commented 4 years ago

@kidmose, I think, this issue has been resolved with new version(since go-modules is integrated) when you have time could you test out following command (?) as you mentioned above, according to feedback from you, I will close the issue.

docker run -it --rm golang:1.13 /bin/bash -c 'git clone https://github.com/aau-network-security/haaukins.git && cd haaukins && go get ./...'

OR

docker run -it --rm golang:1.13 /bin/bash -c 'git clone https://github.com/aau-network-security/haaukins.git && cd haaukins && go test -v ./...'

kidmose commented 4 years ago

Great - thanks :)