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

core: add ability to configure banner template #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mohammed90
Copy link
Collaborator

@mohammed90 mohammed90 commented Jun 29, 2024

The attempt with gomplate didn't work as planned at no fault of gomplate. Embedding the connection metadata while using gomplate requires parsing the template at every call for the RenderingCallback, which is called for every connection. I couldn't figure a way to make the connection metadata a datasource for gomplate. Using bare text/template with sprig functions is powerful enough for all intents and purposes.

Example config:

{
	"apps": {
		"ssh": {
			"grace_period": "2s",
			"servers": {
				"srv0": {
					"address": "tcp/0.0.0.0:22",
					"pty": {
						"pty": "allow"
					},
					"configs": [
						{
							"config": {
								"loader": "provided",
								"banner": {
									"engine": "template",
									"body": "Hello {{ .User }} - {{ now }}\nServer Version is: {{ .ServerVersion | toString }}\n"
								},
								"authentication": {
									"public_key": {
										"providers": {
											"os": {}
										}
									}
								}
							}
						}
					],
					"actors": [
						{
							"act": {
								"action": "shell"
							}
						}
					]
				}
			}
		}
	}
}

Closes #13

@mohammed90 mohammed90 added the enhancement New feature or request label Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create banner module
1 participant