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

add config ssh jump server #1522

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

SimoneDutto
Copy link
Contributor

Description

In this PR we add configuration for SSH jump server.
Such as:

  • port
  • hostkey
  • max concurrent connection: for this one we don't have an implementation yet, because it is not a default option in the gliderlab ssh server implementation

Fly by move the types to a separate file to improve readability.

Engineering checklist

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

Test instructions

@SimoneDutto SimoneDutto requested a review from a team as a code owner January 14, 2025 08:46
Copy link
Contributor

@kian99 kian99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we'll have a follow up where we add the ability for the user to pass in these config options

c.Assert(err, qt.IsNil)
hostKey := pem.EncodeToMemory(
&pem.Block{
Type: "RSA PRIVATE KEY",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no constant for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've looked around and it's always a string, no types.

even in the godoc of this field:
Type string // The type, taken from the preamble (i.e. "RSA PRIVATE KEY").

internal/ssh/ssh.go Outdated Show resolved Hide resolved
internal/ssh/types.go Outdated Show resolved Hide resolved
@@ -209,5 +209,18 @@ func start(ctx context.Context, s *service.Service) error {
})
s.Go(httpsrv.ListenAndServe)
zapctx.Info(ctx, "Successfully started JIMM server")

// // this is to show the integration, we will uncommented it once the ssh implementation is ready.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would not add this in this PR as it might require a bit of discussion: do we start the jump server in main.go or in cmd/jimmsrv/service/service.go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it was just to show how that would have worked, we can do it in another time.

internal/ssh/types.go Outdated Show resolved Hide resolved
@SimoneDutto
Copy link
Contributor Author

I assume we'll have a follow up where we add the ability for the user to pass in these config options

yep, i will open a PR for the k8s charm as well

@SimoneDutto SimoneDutto force-pushed the JUJU-7350/add-config-ssh branch from 7e98e4f to 48be1cb Compare January 14, 2025 09:24
Copy link
Collaborator

@alesstimec alesstimec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally lgtm, but i would suggest keeping type definitions in the same file as method implementations.

internal/ssh/types.go Outdated Show resolved Hide resolved
internal/ssh/types.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@alesstimec alesstimec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if you make the resolver a field on the Config type

type Config struct {
Port string
HostKey []byte
MaxConcurrentConnections string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why isn't the resolver field on the Config struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the resolver is not a config but a service needed to operate the ssh server. I would leave it as a separate argument.

Don't you agree?

@SimoneDutto SimoneDutto merged commit 6f1ac86 into canonical:v3 Jan 14, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

3 participants