Updated deployment with username and password settings.

index.html template now also uses the configured password.
This commit is contained in:
Erik Brakkee 2024-07-26 21:11:40 +02:00
parent f5ebb6c37b
commit 4d660a6805
4 changed files with 18 additions and 6 deletions

View File

@ -81,11 +81,15 @@ func main() {
username, ok := os.LookupEnv("CONVERGE_USERNAME")
if ok {
userPassword.Username = username
} else {
os.Setenv("CONVERGE_USERNAME", userPassword.Username)
}
password, ok := os.LookupEnv("CONVERGE_PASSWORD")
if ok {
userPassword.Password = password
} else {
os.Setenv("CONVERGE_PASSWORD", userPassword.Password)
}
log.Printf("Using username '%s' and password '%s'", userPassword.Username, userPassword.Password)

View File

@ -59,6 +59,7 @@ func (handler FileHandlerFilter) ServeHTTP(w http.ResponseWriter, r *http.Reques
// let the filehandler generate the rror
handler.fileHandler.ServeHTTP(w, r)
}
filters["username"], _ = os.LookupEnv("CONVERGE_USERNAME")
err = tmpl.Execute(w, filters)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)

View File

@ -21,5 +21,11 @@ spec:
name: converge
ports:
- containerPort: 8000
env:
- name: CONVERGE_USERNAME
value: converge
- name: CONVERGE_PASSWORD
# change this password in your final deployment
value: "abc123"

View File

@ -117,8 +117,8 @@
</p>
<pre>
ssh -oServerAliveInterval=10 -oProxyCommand="wsproxy ws{{.secure}}://{{.host}}/client/ID" abc@localhost
sftp -oServerAliveInterval=10 -oProxyCommand="wsproxy ws{{.secure}}://{{.host}}/client/ID" abc@localhost
ssh -oServerAliveInterval=10 -oProxyCommand="wsproxy ws{{.secure}}://{{.host}}/client/ID" {{ .username }}@localhost
sftp -oServerAliveInterval=10 -oProxyCommand="wsproxy ws{{.secure}}://{{.host}}/client/ID" {{ .username }}@localhost
</pre>
<h2>Local clients: using SSH with a local TCP forwarding proxy</h2>
@ -142,15 +142,16 @@
</p>
<pre>
ssh -oServerAliveInterval=10 -p 10000 abc@localhost
sftp -oServerAliveInterval=10 -oPort=10000 abc@localhost
ssh -oServerAliveInterval=10 -p 10000 {{ .username }}@localhost
sftp -oServerAliveInterval=10 -oPort=10000 {{ .username }}@localhost
</pre>
<h2>Authentication</h2>
<p>
The <code>abc</code> user above is defined by the Converge server and
communicated to the agent when the agent is started.
The <code>{{ .username }}</code> user above the Converge server and
communicated to the agent when the agent is started. This is the
username that must be used when setting up an ssh connection.
Another way to authenticate is through an .authorized_keys file in the
same directory as where the agent is started.