-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathroutes.go
More file actions
111 lines (102 loc) · 2.57 KB
/
routes.go
File metadata and controls
111 lines (102 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package pkg
import (
"github.com/Masterminds/cookoo"
"github.com/deis/builder/pkg/env"
"github.com/deis/builder/pkg/git"
"github.com/deis/builder/pkg/sshd"
)
// routes builds the Cookoo registry.
//
// Esssentially this is a list of all of the things that Builder can do, broken
// down into a step-by-step list.
func routes(reg *cookoo.Registry) {
// The "boot" route starts up the builder as a daemon process. Along the
// way, it starts and configures multiple services, including sshd.
reg.AddRoute(cookoo.Route{
Name: "boot",
Help: "Boot the builder",
Does: []cookoo.Task{
// SSHD: Create and configure host keys.
cookoo.Cmd{
Name: "installSshHostKeys",
Fn: sshd.GenSSHKeys,
},
cookoo.Cmd{
Name: sshd.HostKeys,
Fn: sshd.ParseHostKeys,
},
cookoo.Cmd{
Name: sshd.ServerConfig,
Fn: sshd.Configure,
},
// If there's an EXTERNAL_PORT, we publish info to etcd.
cookoo.Cmd{
Name: "externalport",
Fn: env.Get,
Using: []cookoo.Param{
{Name: "EXTERNAL_PORT", DefaultValue: ""},
},
},
// DAEMON: Finally, we wait around for a signal, and then cleanup.
cookoo.Cmd{
Name: "listen",
Fn: KillOnExit,
Using: []cookoo.Param{
{Name: "sshd", From: "cxt:sshdstart"},
},
},
},
})
// This provides a very basic SSH ping.
// Called by the sshd.Server
reg.AddRoute(cookoo.Route{
Name: "sshPing",
Help: "Handles an ssh exec ping.",
Does: []cookoo.Task{
cookoo.Cmd{
Name: "ping",
Fn: sshd.Ping,
Using: []cookoo.Param{
{Name: "request", From: "cxt:request"},
{Name: "channel", From: "cxt:channel"},
},
},
},
})
reg.AddRoute(cookoo.Route{
Name: "pubkeyAuth",
Does: []cookoo.Task{
// Auth against the keys
cookoo.Cmd{
Name: "authN",
Fn: sshd.AuthKey,
Using: []cookoo.Param{
{Name: "metadata", From: "cxt:metadata"},
{Name: "key", From: "cxt:key"},
{Name: "repoName", From: "cxt:repository"},
},
},
},
})
// This proxies a client session into a git receive.
//
// Called by the sshd.Server
reg.AddRoute(cookoo.Route{
Name: "sshGitReceive",
Help: "Handle a git receive over an SSH connection.",
Does: []cookoo.Task{
cookoo.Cmd{
Name: "receive",
Fn: git.Receive,
Using: []cookoo.Param{
{Name: "request", From: "cxt:request"},
{Name: "channel", From: "cxt:channel"},
{Name: "operation", From: "cxt:operation"},
{Name: "repoName", From: "cxt:repository"},
{Name: "permissions", From: "cxt:authN"},
{Name: "userinfo", From: "cxt:userinfo"},
},
},
},
})
}