-
Notifications
You must be signed in to change notification settings - Fork 10
add option to disable ssh port forwarding #29
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,7 +54,68 @@ let | |||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| portForwarding = | ||||||||||||||
| portForwardingStorage = | ||||||||||||||
|
hertrste marked this conversation as resolved.
|
||||||||||||||
| { config, lib, ... }: | ||||||||||||||
| with lib; | ||||||||||||||
| let | ||||||||||||||
| cfg = config.openstack-testing; | ||||||||||||||
| in | ||||||||||||||
| { | ||||||||||||||
| options.openstack-testing = { | ||||||||||||||
|
hertrste marked this conversation as resolved.
|
||||||||||||||
| enable = mkEnableOption "Enable port forwarding." // { | ||||||||||||||
| default = true; | ||||||||||||||
| }; | ||||||||||||||
| sshHostPort = mkOption { | ||||||||||||||
| default = 2122; | ||||||||||||||
| type = types.port; | ||||||||||||||
| description = '' | ||||||||||||||
| Host port to make the ssh server available. | ||||||||||||||
| ''; | ||||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
| config = mkIf cfg.enable { | ||||||||||||||
| virtualisation.forwardPorts = [ | ||||||||||||||
| { | ||||||||||||||
| from = "host"; | ||||||||||||||
| host.port = cfg.sshHostPort; | ||||||||||||||
| guest.port = 22; | ||||||||||||||
| } | ||||||||||||||
| ]; | ||||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| portForwardingCompute = | ||||||||||||||
| { config, lib, ... }: | ||||||||||||||
| with lib; | ||||||||||||||
| let | ||||||||||||||
| cfg = config.openstack-testing; | ||||||||||||||
| in | ||||||||||||||
| { | ||||||||||||||
| options.openstack-testing = { | ||||||||||||||
| enable = mkEnableOption "Enable port forwarding." // { | ||||||||||||||
| # If multiple nodes are used, a separate port must be assigned to each node; otherwise, collisions will occur. | ||||||||||||||
| # We disable ssh port forwarding for compute nodes as default. | ||||||||||||||
| default = false; | ||||||||||||||
| }; | ||||||||||||||
| sshHostPort = mkOption { | ||||||||||||||
| type = types.port; | ||||||||||||||
| description = '' | ||||||||||||||
| Host port to make the ssh server available. | ||||||||||||||
| ''; | ||||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
| config = mkIf cfg.enable { | ||||||||||||||
| virtualisation.forwardPorts = [ | ||||||||||||||
| { | ||||||||||||||
| from = "host"; | ||||||||||||||
| host.port = cfg.sshHostPort; | ||||||||||||||
| guest.port = 22; | ||||||||||||||
| } | ||||||||||||||
| ]; | ||||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| portForwardingController = | ||||||||||||||
| { config, lib, ... }: | ||||||||||||||
| with lib; | ||||||||||||||
| let | ||||||||||||||
|
|
@@ -92,6 +153,13 @@ let | |||||||||||||
| the configuration of the dashboard. | ||||||||||||||
| ''; | ||||||||||||||
| }; | ||||||||||||||
| sshHostPort = mkOption { | ||||||||||||||
| default = 2022; | ||||||||||||||
| type = types.port; | ||||||||||||||
| description = '' | ||||||||||||||
| Host port to make the ssh server available. | ||||||||||||||
| ''; | ||||||||||||||
| }; | ||||||||||||||
|
hertrste marked this conversation as resolved.
|
||||||||||||||
| }; | ||||||||||||||
| config = mkIf cfg.enable { | ||||||||||||||
| virtualisation.forwardPorts = [ | ||||||||||||||
|
|
@@ -110,6 +178,11 @@ let | |||||||||||||
| host.port = cfg.vncProxyHostPort; | ||||||||||||||
| guest.port = 6080; | ||||||||||||||
| } | ||||||||||||||
| { | ||||||||||||||
| from = "host"; | ||||||||||||||
| host.port = cfg.sshHostPort; | ||||||||||||||
| guest.port = 22; | ||||||||||||||
| } | ||||||||||||||
| ]; | ||||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
|
|
@@ -129,9 +202,13 @@ in | |||||||||||||
| { | ||||||||||||||
| imports = [ | ||||||||||||||
| common | ||||||||||||||
| portForwarding | ||||||||||||||
| portForwardingController | ||||||||||||||
| ]; | ||||||||||||||
|
|
||||||||||||||
| # this is an example how to enable / disable all port forwardings or change port numbers | ||||||||||||||
| # openstack-testing.enable = true; | ||||||||||||||
| # openstack-testing.sshHostPort = 1122; | ||||||||||||||
|
|
||||||||||||||
| virtualisation = { | ||||||||||||||
| cores = 4; | ||||||||||||||
| memorySize = 6144; | ||||||||||||||
|
|
@@ -144,14 +221,6 @@ in | |||||||||||||
| vlan = 2; | ||||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
| # enable ssh access | ||||||||||||||
| forwardPorts = [ | ||||||||||||||
| { | ||||||||||||||
| from = "host"; | ||||||||||||||
| host.port = 1122; | ||||||||||||||
| guest.port = 22; | ||||||||||||||
| } | ||||||||||||||
| ]; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| systemd.services.openstack-create-vm = { | ||||||||||||||
|
|
@@ -232,7 +301,14 @@ in | |||||||||||||
| testCompute = | ||||||||||||||
| { ... }: | ||||||||||||||
| { | ||||||||||||||
| imports = [ common ]; | ||||||||||||||
| imports = [ | ||||||||||||||
| common | ||||||||||||||
| portForwardingCompute | ||||||||||||||
| ]; | ||||||||||||||
|
|
||||||||||||||
| # this is an example how to enable / disable all port forwardings or change port numbers | ||||||||||||||
| # openstack-testing.enable = true; # enable / disable all port forwardings | ||||||||||||||
| # openstack-testing.sshHostPort = 3022; | ||||||||||||||
|
|
||||||||||||||
| virtualisation = { | ||||||||||||||
| memorySize = 4096; | ||||||||||||||
|
|
@@ -271,14 +347,20 @@ in | |||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| testStorage = | ||||||||||||||
| { ... }: | ||||||||||||||
| { | ||||||||||||||
|
|
||||||||||||||
| imports = [ common ]; | ||||||||||||||
| imports = [ | ||||||||||||||
| common | ||||||||||||||
| portForwardingStorage | ||||||||||||||
| ]; | ||||||||||||||
|
|
||||||||||||||
| # this is an example how to enable / disable all port forwardings or change port numbers | ||||||||||||||
| # openstack-testing.enable = true; # enable / disable all port forwardings | ||||||||||||||
| # openstack-testing.sshHostPort = 2022; | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+361
to
364
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a non-conflicting SSH port in the storage example. Line 363 uses Suggested edit- # openstack-testing.sshHostPort = 2022;
+ # openstack-testing.sshHostPort = 2122;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| virtualisation = { | ||||||||||||||
| memorySize = 4096; | ||||||||||||||
|
|
@@ -296,14 +378,6 @@ in | |||||||||||||
| vlan = 2; | ||||||||||||||
| }; | ||||||||||||||
| }; | ||||||||||||||
| # enable ssh access | ||||||||||||||
| forwardPorts = [ | ||||||||||||||
| { | ||||||||||||||
| from = "host"; | ||||||||||||||
| host.port = 2022; | ||||||||||||||
| guest.port = 22; | ||||||||||||||
| } | ||||||||||||||
| ]; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| systemd.network = { | ||||||||||||||
|
|
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.