Skip to content

Commit

Permalink
config: make sftp could be configured dynamically
Browse files Browse the repository at this point in the history
    - add `harvester.install.enableSftp` to config `sftp` dynamically

Signed-off-by: Vicente Cheng <[email protected]>
  • Loading branch information
Vicente-Cheng committed Dec 8, 2023
1 parent 35f62da commit 4c75112
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ type Install struct {
TTY string `json:"tty,omitempty"`
ForceGPT bool `json:"forceGpt,omitempty"`
Role string `json:"role,omitempty"`
EnableSFTP bool `json:"enableSftp,omitempty"`

// Following options are not cOS installer flag
ForceMBR bool `json:"forceMbr,omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions pkg/config/cos.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ func ConvertToCOS(config *HarvesterConfig) (*yipSchema.YipConfig, error) {
},
}

// Add SFTP related config to after install stage
if config.Install.EnableSFTP {
config.OS.AfterInstallChrootCommands = append(config.OS.AfterInstallChrootCommands, "mkdir -p /etc/ssh/sshd_config.d")
config.OS.AfterInstallChrootCommands = append(config.OS.AfterInstallChrootCommands, "echo 'Subsystem sftp /usr/lib/ssh/sftp-server' > /etc/ssh/sshd_config.d/sftp.conf")
}

// Add after-install-chroot stage
if len(config.OS.AfterInstallChrootCommands) > 0 {
afterInstallChroot := yipSchema.Stage{}
Expand Down

0 comments on commit 4c75112

Please sign in to comment.