Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Takoudjou
slapos
Commits
e2bd5191
Commit
e2bd5191
authored
Nov 21, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new stack sshd to simplify deployment of sshd server on every instance
parent
428b69b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
202 additions
and
0 deletions
+202
-0
stack/sshd/bash_profile.in
stack/sshd/bash_profile.in
+41
-0
stack/sshd/buildout.cfg
stack/sshd/buildout.cfg
+30
-0
stack/sshd/instance-sshd.cfg.jinja2
stack/sshd/instance-sshd.cfg.jinja2
+131
-0
No files found.
stack/sshd/bash_profile.in
0 → 100644
View file @
e2bd5191
# Beware, this file is automatically processed by slapgrid
# Do not modify it, your changes will be lost
# If you want to load your custom bash configuration, please use a .bashrc file
cd {{ workdir }}
export PATH={{- path }}
export PS1="$ "
if [ -f "$HOME/.bashrc" ] ; then
source $HOME/.bashrc
fi
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# enable color support
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
fi
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
echo "Welcome to SlapOS slaprunner shell"
echo
# TODO: how to run slapos ?
#echo "You can use the following slapos CLI commands:"
#echo "slapos node software"
#echo "slapos node instance"
#echo "slapos request"
#echo ""
# XXX for now we can use:
#echo ~/bin/supervisorctl -c ~/etc/supervisorctl.conf
#echo ~/bin/supervisorctl -c ~/srv/runner/instance/etc/supervisorctl.conf
stack/sshd/buildout.cfg
0 → 100644
View file @
e2bd5191
[buildout]
extends =
../../component/openssh/buildout.cfg
../../component/bash/buildout.cfg
../../component/vim/buildout.cfg
../../component/curl/buildout.cfg
parts =
template-instance-sshd
[template-instance-sshd]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance-sshd.cfg.jinja2
rendered = ${buildout:directory}/template-sshd.cfg
md5sum = d7a96ec018b78688d74b395058273f20
context =
raw bash_executable_location ${bash:location}/bin/bash
raw curl_location ${curl:location}
raw openssh_location ${openssh:location}
raw template_bash_profile ${template-bash-profile:location}/${template-bash-profile:filename}
raw vim_location ${vim:location}
[template-bash-profile]
recipe = hexagonit.recipe.download
ignore-existing = true
download-only = true
url = ${:_profile_base_location_}/${:filename}
filename = bash_profile.in
mode = 0644
\ No newline at end of file
stack/sshd/instance-sshd.cfg.jinja2
0 → 100644
View file @
e2bd5191
[buildout]
parts =
instance-sshd
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
[directory]
recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
bin = ${buildout:directory}/bin
srv = ${buildout:directory}/srv
var = ${buildout:directory}/var
run = ${:var}/run
log = ${:var}/log
scripts = ${:etc}/run
services = ${:etc}/service
promises = ${:etc}/promise
ssh = ${:etc}/ssh/
sshkeys = ${:srv}/sshkeys
authorized-key-dir = ${buildout:directory}/.ssh
# Deploy openssh-server
[instance-sshd-port]
recipe = slapos.cookbook:free_port
minimum = 22222
maximum = 22231
ip = ${slap-configuration:ipv6-random}
[instance-sshd-config]
recipe = slapos.recipe.template:jinja2
rendered = ${directory:etc}/instance-sshd.conf
path_pid = ${directory:run}/instance-sshd.pid
host_key = ${directory:ssh}/instance_server_key.rsa
template = inline:
PidFile ${:path_pid}
Port ${instance-sshd-port:port}
ListenAddress ${slap-configuration:ipv6-random}
Protocol 2
UsePrivilegeSeparation no
HostKey ${:host_key}
PasswordAuthentication no
PubkeyAuthentication yes
AuthorizedKeysFile ${buildout:directory}/.ssh/authorized_keys
ForceCommand if [ -z "$SSH_ORIGINAL_COMMAND" ]; then {{ bash_executable_location }} -l; else eval "$SSH_ORIGINAL_COMMAND"; fi
Subsystem sftp {{ openssh_location }}/libexec/sftp-server
[instance-sshd-raw-server]
recipe = slapos.cookbook:wrapper
host = ${slap-configuration:ipv6-random}
rsa-keyfile = ${instance-sshd-config:host_key}
home = ${directory:ssh}
command-line = {{ openssh_location }}/sbin/sshd -D -e -f ${instance-sshd-config:rendered}
wrapper-path = ${directory:bin}/instance_raw_sshd
[instance-sshd-server]
recipe = collective.recipe.template
log = ${directory:log}/instance-sshd.log
input = inline:#!/bin/sh
exec ${instance-sshd-raw-server:wrapper-path} >> ${:log} 2>&1
output = ${directory:bin}/instance_raw_sshd_log
mode = 700
[instance-sshd-graceful]
recipe = slapos.cookbook:wrapper
command-line = ${directory:bin}/killpidfromfile ${instance-sshd-config:path_pid} SIGHUP
wrapper-path = ${directory:scripts}/instance-sshd-graceful
[instance-sshkeys-directory]
recipe = slapos.cookbook:mkdirectory
requests = ${directory:sshkeys}/instance-requests/
keys = ${directory:sshkeys}/instance-keys/
[instance-sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = ${instance-sshkeys-directory:requests}
keys-directory = ${instance-sshkeys-directory:keys}
wrapper = ${directory:services}/sshkeys_authority
keygen-binary = {{ openssh_location }}/bin/ssh-keygen
[instance-sshd]
<= instance-sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = sshd
type = rsa
executable = ${instance-sshd-server:output}
public-key = ${instance-sshd-raw-server:rsa-keyfile}.pub
private-key = ${instance-sshd-raw-server:rsa-keyfile}
wrapper = ${directory:services}/instance-sshd
depend-list =
${instance-sshd-graceful:wrapper-path}
${instance-sshkeys-authority:wrapper}
${instance-sshd-promise:path}
${bash-profile:rendered}
# ${instance-sshd-add-authorized-key:home}
# Authorized key will not be added here
ssh-command = ssh ${user-info:pw-name}@${slap-configuration:ipv6-random} -p ${instance-sshd-port:port}
authorized-key-file = ${directory:authorized-key-dir}/authorized_keys
[instance-sshd-add-authorized-key]
recipe = slapos.cookbook:dropbear.add_authorized_key
home = ${buildout:directory}
key = ${slap-parameter:user-authorized-key}
[instance-sshd-promise]
recipe = slapos.cookbook:check_port_listening
path = ${directory:promises}/instance-sshd
hostname = ${slap-configuration:ipv6-random}
port = ${instance-sshd-port:port}
[user-info]
recipe = slapos.cookbook:userinfo
[bash-profile]
recipe = slapos.recipe.template:jinja2
template = {{ template_bash_profile }}
rendered = ${buildout:directory}/.bash_profile
context =
raw path $PATH:{{ vim_location }}/bin:{{ curl_location }}/bin
key workdir buildout:directory
[slap-parameter]
user-authorized-key =
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment