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

Fixes OpenAPI generation #140

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions agentprotocol/NewForwardCtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package agentprotocol
import (
"io"

log "go.containerssh.io/libcontainerssh/log"
log "go.containerssh.io/libcontainerssh/log"
)

func NewForwardCtx(fromBackend io.Reader, toBackend io.Writer, logger log.Logger) *ForwardCtx {
return &ForwardCtx{
fromBackend: fromBackend,
toBackend: toBackend,
logger: logger,
toBackend: toBackend,
logger: logger,
}
}
}
26 changes: 13 additions & 13 deletions agentprotocol/Protocol.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package agentprotocol

const (
CONNECTION_TYPE_X11 = iota
CONNECTION_TYPE_PORT_FORWARD = iota
CONNECTION_TYPE_PORT_DIAL = iota
CONNECTION_TYPE_X11 = iota
CONNECTION_TYPE_PORT_FORWARD = iota
CONNECTION_TYPE_PORT_DIAL = iota
CONNECTION_TYPE_SOCKET_FORWARD = iota
CONNECTION_TYPE_SOCKET_DIAL = iota
CONNECTION_TYPE_SOCKET_DIAL = iota
)

const (
PROTOCOL_TCP string = "tcp"
PROTOCOL_TCP string = "tcp"
PROTOCOL_UNIX string = "unix"
)

Expand All @@ -24,10 +24,10 @@ const (
)

type SetupPacket struct {
ConnectionType uint32
BindHost string
BindPort uint32
Protocol string
ConnectionType uint32
BindHost string
BindPort uint32
Protocol string

Screen string
SingleConnection bool
Expand All @@ -36,16 +36,16 @@ type SetupPacket struct {
}

type NewConnectionPayload struct {
Protocol string
Protocol string

ConnectedAddress string
ConnectedPort uint32
OriginatorAddress string
OriginatorPort uint32
}

type Packet struct {
Type int
Type int
ConnectionId uint64
Payload []byte
Payload []byte
}
4 changes: 2 additions & 2 deletions agentprotocol/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"sync"
"time"

log "go.containerssh.io/libcontainerssh/log"
message "go.containerssh.io/libcontainerssh/message"
"github.com/fxamacker/cbor/v2"
log "go.containerssh.io/libcontainerssh/log"
message "go.containerssh.io/libcontainerssh/message"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions agentprotocol/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"io"
"testing"

proto "go.containerssh.io/libcontainerssh/agentprotocol"
proto "go.containerssh.io/libcontainerssh/agentprotocol"

log "go.containerssh.io/libcontainerssh/log"
log "go.containerssh.io/libcontainerssh/log"
)

// region Tests
Expand Down
2 changes: 1 addition & 1 deletion auditlog/codec/Decoder.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package codec

import (
internalCodec "go.containerssh.io/libcontainerssh/internal/auditlog/codec"
internalCodec "go.containerssh.io/libcontainerssh/internal/auditlog/codec"
)

// Decoder is a module that is resonsible for decoding a binary testdata stream into audit log messages.
Expand Down
2 changes: 1 addition & 1 deletion auditlog/message/channelrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (p PayloadChannelRequestPty) Equals(other Payload) bool {
}

type PayloadChannelRequestX11 struct {
RequestID uint64 `json:"requestId" yaml:"requestId"`
RequestID uint64 `json:"requestId" yaml:"requestId"`

SingleConnection bool `json:"singleConnection" yaml:"singleConnection"`
AuthProtocol string `json:"authProtocol" yaml:"authProtocol"`
Expand Down
2 changes: 1 addition & 1 deletion auditlog/message/globalrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ func (p PayloadGlobalRequestDecodeFailed) Equals(other Payload) bool {
return false
}
return p.RequestID == p2.RequestID && p.RequestType == p2.RequestType && p.Reason == p2.Reason
}
}
8 changes: 4 additions & 4 deletions auditlog/storage/factory.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package storage

import (
"go.containerssh.io/libcontainerssh/config"
"go.containerssh.io/libcontainerssh/internal/auditlog"
"go.containerssh.io/libcontainerssh/log"
"go.containerssh.io/libcontainerssh/message"
"go.containerssh.io/libcontainerssh/config"
"go.containerssh.io/libcontainerssh/internal/auditlog"
"go.containerssh.io/libcontainerssh/log"
"go.containerssh.io/libcontainerssh/message"
)

func New(cfg config.AuditLogConfig, logger log.Logger) (Storage, error) {
Expand Down
2 changes: 1 addition & 1 deletion auditlog/storage/storage.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package storage

import (
"go.containerssh.io/libcontainerssh/internal/auditlog/storage"
"go.containerssh.io/libcontainerssh/internal/auditlog/storage"
)

type Storage interface {
Expand Down
22 changes: 19 additions & 3 deletions auth/protocol.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package auth

import (
"go.containerssh.io/libcontainerssh/metadata"
"go.containerssh.io/libcontainerssh/metadata"
)

// PasswordAuthRequest is an authentication request for password authentication.
//
// swagger:model PasswordAuthRequest
type PasswordAuthRequest struct {
// swagger:allOf
metadata.ConnectionAuthPendingMetadata `json:",inline"`

// Password the user provided for authentication.
//
// required: true
// in: body
// swagger:strfmt Base64
Password string `json:"passwordBase64"`
}
Expand All @@ -21,8 +23,11 @@ type PasswordAuthRequest struct {
//
// swagger:model PublicKeyAuthRequest
type PublicKeyAuthRequest struct {
// swagger:allOf
metadata.ConnectionAuthPendingMetadata `json:",inline"`

// in: body
// required: true
PublicKey `json:",inline"`
}

Expand All @@ -32,14 +37,24 @@ type PublicKeyAuthRequest struct {
//
// swagger:model AuthorizationRequest
type AuthorizationRequest struct {
// swagger:allOf
metadata.ConnectionAuthenticatedMetadata `json:",inline"`
}

// ResponseBody is a response to authentication requests.
//
// swagger:model AuthResponseBody
type ResponseBody struct {
metadata.ConnectionAuthenticatedMetadata `json:",inline"`
metadata.DynamicMetadata `json:",inline"`

// AuthenticatedUsername contains the username that was actually verified. This may differ from LoginUsername when,
// for example OAuth2 or Kerberos authentication is used. This field is empty until the authentication phase is
// completed.
//
// required: false
// in: body
// example: systemusername
AuthenticatedUsername string `json:"authenticatedUsername,omitempty"`

// Success indicates if the authentication was successful.
//
Expand All @@ -55,5 +70,6 @@ type Response struct {
// The response body
//
// in: body
ResponseBody
// required: true
Body ResponseBody
}
1 change: 1 addition & 0 deletions auth/pubkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ type PublicKey struct {
// PublicKey is the key in the authorized key format.
//
// required: true
// example: ssh-rsa ...
PublicKey string `json:"publicKey"`
}
14 changes: 7 additions & 7 deletions auth/webhook/client.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package webhook

import (
auth2 "go.containerssh.io/libcontainerssh/auth"
"go.containerssh.io/libcontainerssh/config"
"go.containerssh.io/libcontainerssh/internal/auth"
"go.containerssh.io/libcontainerssh/internal/geoip/dummy"
"go.containerssh.io/libcontainerssh/internal/metrics"
"go.containerssh.io/libcontainerssh/log"
"go.containerssh.io/libcontainerssh/metadata"
auth2 "go.containerssh.io/libcontainerssh/auth"
"go.containerssh.io/libcontainerssh/config"
"go.containerssh.io/libcontainerssh/internal/auth"
"go.containerssh.io/libcontainerssh/internal/geoip/dummy"
"go.containerssh.io/libcontainerssh/internal/metrics"
"go.containerssh.io/libcontainerssh/log"
"go.containerssh.io/libcontainerssh/metadata"
)

type Client interface {
Expand Down
2 changes: 1 addition & 1 deletion auth/webhook/handler.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package webhook

import (
"go.containerssh.io/libcontainerssh/internal/auth"
"go.containerssh.io/libcontainerssh/internal/auth"
)

// AuthRequestHandler describes the methods an authentication server has to implement in order to be usable with the
Expand Down
4 changes: 2 additions & 2 deletions auth/webhook/handler_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package webhook
import (
"net/http"

"go.containerssh.io/libcontainerssh/internal/auth"
"go.containerssh.io/libcontainerssh/log"
"go.containerssh.io/libcontainerssh/internal/auth"
"go.containerssh.io/libcontainerssh/log"
)

// NewHandler creates a HTTP handler that forwards calls to the provided h config request handler.
Expand Down
8 changes: 4 additions & 4 deletions auth/webhook/server.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package webhook

import (
"go.containerssh.io/libcontainerssh/config"
"go.containerssh.io/libcontainerssh/http"
"go.containerssh.io/libcontainerssh/internal/auth"
"go.containerssh.io/libcontainerssh/log"
"go.containerssh.io/libcontainerssh/config"
"go.containerssh.io/libcontainerssh/http"
"go.containerssh.io/libcontainerssh/internal/auth"
"go.containerssh.io/libcontainerssh/log"
)

// NewServer returns a complete HTTP server that responds to the authentication requests.
Expand Down
12 changes: 6 additions & 6 deletions auth/webhook/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"os"
"time"

auth2 "go.containerssh.io/libcontainerssh/auth"
"go.containerssh.io/libcontainerssh/auth/webhook"
"go.containerssh.io/libcontainerssh/config"
"go.containerssh.io/libcontainerssh/log"
"go.containerssh.io/libcontainerssh/metadata"
"go.containerssh.io/libcontainerssh/service"
auth2 "go.containerssh.io/libcontainerssh/auth"
"go.containerssh.io/libcontainerssh/auth/webhook"
"go.containerssh.io/libcontainerssh/config"
"go.containerssh.io/libcontainerssh/log"
"go.containerssh.io/libcontainerssh/metadata"
"go.containerssh.io/libcontainerssh/service"
)

// myAuthReqHandler is your handler for authentication requests.
Expand Down
2 changes: 1 addition & 1 deletion cmd/containerssh-auditlog-decoder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"log"
"os"

"go.containerssh.io/libcontainerssh/auditlog/codec"
"go.containerssh.io/libcontainerssh/auditlog/codec"
)

func main() {
Expand Down
Loading