Documentation ¶
Index ¶
- Constants
- Variables
- type Agent
- func (a *Agent) AddExercisesToEnv(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
- func (a *Agent) AddExercisesToLab(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
- func (a *Agent) CloseEnvironment(ctx context.Context, req *proto.CloseEnvRequest) (*proto.StatusResponse, error)
- func (a *Agent) CloseLab(ctx context.Context, req *proto.CloseLabRequest) (*proto.StatusResponse, error)
- func (a *Agent) CreateEnvironment(ctx context.Context, req *proto.CreatEnvRequest) (*proto.StatusResponse, error)
- func (a *Agent) CreateLabForEnv(ctx context.Context, req *proto.CreateLabRequest) (*proto.StatusResponse, error)
- func (a *Agent) CreateVpnConfForLab(ctx context.Context, req *proto.CreateVpnConfRequest) (*proto.CreateVpnConfResponse, error)
- func (a *Agent) GetHostsInLab(ctx context.Context, req *proto.GetHostsRequest) (*proto.GetHostsResponse, error)
- func (a *Agent) GetLab(ctx context.Context, req *proto.GetLabRequest) (*proto.GetLabResponse, error)
- func (a *Agent) ListEnvironments(ctx context.Context, req *proto.Empty) (*proto.ListEnvResponse, error)
- func (a *Agent) MonitorStream(stream proto.Agent_MonitorStreamServer) error
- func (d *Agent) NewGRPCServer(opts ...grpc.ServerOption) *grpc.Server
- func (a *Agent) Ping(ctx context.Context, req *proto.PingRequest) (*proto.PingResponse, error)
- func (a *Agent) ResetExerciseInLab(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
- func (a *Agent) ResetLab(ctx context.Context, req *proto.ResetLabRequest) (*proto.StatusResponse, error)
- func (a *Agent) ResetVmInLab(ctx context.Context, req *proto.VmRequest) (*proto.StatusResponse, error)
- func (a *Agent) RunGuacProxy() error
- func (a *Agent) StartExerciseInLab(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
- func (a *Agent) StopExerciseInLab(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
- type Authenticator
- type Config
- type IPPool
- type ProxyResponse
- type ServiceConfig
- type VPNconf
Constants ¶
const (
AUTH_KEY = "au"
)
const DEFAULT_AUTH = "dev-auth-key"
const DEFAULT_SIGN = "dev-sign-key"
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { State *state.State pb.UnimplementedAgentServer EnvPool *env.EnvPool `json:"envpool,omitempty"` // contains filtered or unexported fields }
func (*Agent) AddExercisesToEnv ¶ added in v0.1.0
func (a *Agent) AddExercisesToEnv(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
Adds exercises to a beginner environment It appends the new exercise configs to the existing lab config within the environment. This is used for future labs that may start up. Then it adds the exercises to the existing running labs under this environment.
func (*Agent) AddExercisesToLab ¶ added in v0.1.0
func (a *Agent) AddExercisesToLab(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
GRPc endpoint that adds exercises to an already running lab. It requires the lab tag, and an array of exercise tags. It starts by creating the containers needed for the exercise, then it refreshes the DNS and starts the containers afterwards. It utilizes a mutex lock to make sure that if anyone tries to run the same GRPc call twice without the first being finished, the second one will wait
func (*Agent) CloseEnvironment ¶ added in v0.1.0
func (a *Agent) CloseEnvironment(ctx context.Context, req *proto.CloseEnvRequest) (*proto.StatusResponse, error)
Closes environment and attached containers/vms, and removes the environment from the event pool
func (*Agent) CloseLab ¶ added in v0.1.0
func (a *Agent) CloseLab(ctx context.Context, req *proto.CloseLabRequest) (*proto.StatusResponse, error)
Shuts down and removes all frontends and containers related to specific lab. Then removes it from the environment's lab map.
func (*Agent) CreateEnvironment ¶ added in v0.1.0
func (a *Agent) CreateEnvironment(ctx context.Context, req *proto.CreatEnvRequest) (*proto.StatusResponse, error)
Creates a new lab environment. Should be called by the daemon when a new event is being created. Environments can be advanced or beginner environments. Advanced environments is geared towards regular CTFs where as beginner environments can be used for beginner events where the user would just need to press the connect button and a lab would be ready with all challenges running.
func (*Agent) CreateLabForEnv ¶ added in v0.1.0
func (a *Agent) CreateLabForEnv(ctx context.Context, req *proto.CreateLabRequest) (*proto.StatusResponse, error)
func (*Agent) CreateVpnConfForLab ¶ added in v0.1.0
func (a *Agent) CreateVpnConfForLab(ctx context.Context, req *proto.CreateVpnConfRequest) (*proto.CreateVpnConfResponse, error)
func (*Agent) GetHostsInLab ¶ added in v0.1.0
func (a *Agent) GetHostsInLab(ctx context.Context, req *proto.GetHostsRequest) (*proto.GetHostsResponse, error)
func (*Agent) GetLab ¶ added in v0.1.0
func (a *Agent) GetLab(ctx context.Context, req *proto.GetLabRequest) (*proto.GetLabResponse, error)
func (*Agent) ListEnvironments ¶ added in v1.0.0
func (a *Agent) ListEnvironments(ctx context.Context, req *proto.Empty) (*proto.ListEnvResponse, error)
Lists currently running, starting and closing environments.
func (*Agent) MonitorStream ¶ added in v0.1.0
func (a *Agent) MonitorStream(stream proto.Agent_MonitorStreamServer) error
Monitoring stream will respond to Pings from the server with cpu, memory and any new labs that may have come since last request
func (*Agent) NewGRPCServer ¶
func (d *Agent) NewGRPCServer(opts ...grpc.ServerOption) *grpc.Server
func (*Agent) Ping ¶ added in v0.1.0
func (a *Agent) Ping(ctx context.Context, req *proto.PingRequest) (*proto.PingResponse, error)
TODO Heartbeat, resource monitoring and log monitoring Used for the daemon to check the connection to the agent when initially connecting
func (*Agent) ResetExerciseInLab ¶ added in v0.1.0
func (a *Agent) ResetExerciseInLab(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
Recreates and starts an exercise in a specific lab in case it should be having problems of any sorts.
func (*Agent) ResetLab ¶ added in v1.0.0
func (a *Agent) ResetLab(ctx context.Context, req *proto.ResetLabRequest) (*proto.StatusResponse, error)
Reset lab resets DHCP, DNS, exercises and frontends in lab
func (*Agent) ResetVmInLab ¶ added in v0.1.0
func (*Agent) RunGuacProxy ¶ added in v0.1.0
Sets up the gin framework, and uses the cors middleware to allow from all origins. It the runs the proxy on a port specified in the agent config
func (*Agent) StartExerciseInLab ¶ added in v0.1.0
func (a *Agent) StartExerciseInLab(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
Starts a suspended/stopped exercise in a specific lab
func (*Agent) StopExerciseInLab ¶ added in v0.1.0
func (a *Agent) StopExerciseInLab(ctx context.Context, req *proto.ExerciseRequest) (*proto.StatusResponse, error)
Stops a running exercise for a specific lab
type Authenticator ¶
func NewAuthenticator ¶
func NewAuthenticator(Skey, AKey string) Authenticator
type Config ¶
type Config struct { Host string `yaml:"host"` GrpcPort uint `yaml:"grpcPort"` ProxyPort uint `yaml:"proxyPort"` ListeningIp string `yaml:"listening-ip,omitempty"` AuthKey string `yaml:"auth-key"` SignKey string `yaml:"sign-key"` MaxWorkers int `yaml:"max-workers"` FileTransferRoot string `yaml:"file-transfer-root"` OvaDir string `yaml:"ova-dir"` StatePath string `yaml:"state-path"` VPNService VPNconf `yaml:"vpn-service"` DockerRepositories []dockerclient.AuthConfiguration `yaml:"docker-repositories"` }
func NewConfigFromFile ¶
TODO check vpn service conf
type ProxyResponse ¶ added in v0.1.0
type ProxyResponse struct {
Message string `json:"status,omitempty"`
}