Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit ba90edb

Browse files
committed
Merge pull request #774 from coreos/signpocalypse
*: remove unit signing
2 parents 2401c40 + d28be60 commit ba90edb

25 files changed

Lines changed: 41 additions & 952 deletions

Documentation/configuration.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,6 @@ An Agent will be considered dead if it exceeds this amount of time to communicat
6262

6363
Default: "30s"
6464

65-
#### verify_units
66-
67-
Enable payload signature verification. Payloads without verifiable signatures will not be eligible to run on the local fleet server.
68-
69-
Default: false
70-
71-
#### authorized_keys_file
72-
73-
File containing public SSH keys that should be used to verify payload signatures.
74-
75-
Default: "~/.ssh/authorized_keys"
76-
7765
#### engine_reconcile_interval
7866

7967
Interval at which the engine should reconcile the cluster schedule in etcd.

Documentation/security.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
The default deployment of the preview release of fleet doesn't currently perform any authentication or authorization for submitted units. This means that any client that can access your etcd cluster can potentially run arbitrary code on many of your machines very easily.
66

7-
## Job Signing
8-
9-
Version 0.2.0 of fleet added the ability to add signatures to Jobs to provide authorization and integrity checking to units submitted to the cluster. For more details on how it works and how to use it, see the [Signed Units](signed-units.md) documentation.
10-
117
## Securing the Registry
128

139
You should avoid public access to the registry (i.e etcd) and instead run fleet [from your local laptop](using-the-client.md#get-up-and-running) with the `--tunnel` flag to run commands over an SSH tunnel. You can alias this flag for easier usage: `alias fleetctl=fleetctl --tunnel 10.10.10.10` - or use the environment variable `FLEETCTL_TUNNEL`.

Documentation/signed-units.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

agent/reconcile.go

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/coreos/fleet/machine"
1111
"github.com/coreos/fleet/pkg"
1212
"github.com/coreos/fleet/registry"
13-
"github.com/coreos/fleet/sign"
1413
)
1514

1615
const (
@@ -44,15 +43,14 @@ func (t *task) String() string {
4443
return fmt.Sprintf("{Type: %s, Job: %s, Reason: %q}", t.Type, jName, t.Reason)
4544
}
4645

47-
func NewReconciler(reg registry.Registry, rStream registry.EventStream, verifier *sign.SignatureVerifier) (*AgentReconciler, error) {
48-
ar := AgentReconciler{reg, rStream, verifier}
46+
func NewReconciler(reg registry.Registry, rStream registry.EventStream) (*AgentReconciler, error) {
47+
ar := AgentReconciler{reg, rStream}
4948
return &ar, nil
5049
}
5150

5251
type AgentReconciler struct {
53-
reg registry.Registry
54-
rStream registry.EventStream
55-
verifier *sign.SignatureVerifier
52+
reg registry.Registry
53+
rStream registry.EventStream
5654
}
5755

5856
// Run periodically attempts to reconcile the provided Agent until the stop
@@ -184,9 +182,8 @@ func (ar *AgentReconciler) doTask(a *Agent, t *task) (err error) {
184182
// Agent identified by the provided machine ID should currently be doing.
185183
func (ar *AgentReconciler) desiredAgentState(units []job.Unit, sUnits []job.ScheduledUnit, ms *machine.MachineState) (*AgentState, error) {
186184
as := AgentState{
187-
MState: ms,
188-
Jobs: make(map[string]*job.Job),
189-
verifyFunc: ar.verifyJobSignature,
185+
MState: ms,
186+
Jobs: make(map[string]*job.Job),
190187
}
191188

192189
sUnitMap := make(map[string]*job.ScheduledUnit)
@@ -223,9 +220,8 @@ func (ar *AgentReconciler) currentAgentState(a *Agent) (*AgentState, error) {
223220

224221
ms := a.Machine.State()
225222
as := AgentState{
226-
MState: &ms,
227-
Jobs: jobs,
228-
verifyFunc: ar.verifyJobSignature,
223+
MState: &ms,
224+
Jobs: jobs,
229225
}
230226

231227
return &as, nil
@@ -334,22 +330,3 @@ func (ar *AgentReconciler) calculateTasksForJob(dState, cState *AgentState, jNam
334330

335331
log.Errorf("Unable to determine how to reconcile Job(%s): desiredState=%#v currentState=%#V", jName, dJob, cJob)
336332
}
337-
338-
// verifyJobSignature attempts to verify the integrity of the given Job by checking the
339-
// signature against a SignatureSet stored in the Registry
340-
func (ar *AgentReconciler) verifyJobSignature(j *job.Job) bool {
341-
if ar.verifier == nil {
342-
return true
343-
}
344-
ss, _ := ar.reg.JobSignatureSet(j.Name)
345-
ok, err := ar.verifier.VerifyJob(j, ss)
346-
if err != nil {
347-
log.V(1).Infof("Error verifying signature of Job(%s): %v", j.Name, err)
348-
return false
349-
} else if !ok {
350-
log.V(1).Infof("Job(%s) does not match signature", j.Name)
351-
return false
352-
}
353-
354-
return true
355-
}

agent/reconcile_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func TestCalculateTasksForJob(t *testing.T) {
321321
}
322322

323323
for i, tt := range tests {
324-
ar, err := NewReconciler(registry.NewFakeRegistry(), nil, nil)
324+
ar, err := NewReconciler(registry.NewFakeRegistry(), nil)
325325
if err != nil {
326326
t.Errorf("case %d: unexpected error from NewReconciler: %v", i, err)
327327
continue

agent/state.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ import (
1313
type AgentState struct {
1414
MState *machine.MachineState
1515
Jobs map[string]*job.Job
16-
17-
// This is used to assert that the Agent is able to
18-
// run a given job based on its signature. This feature
19-
// is currently deprecated, so expect this to go away.
20-
verifyFunc func(j *job.Job) bool
2116
}
2217

2318
func NewAgentState(ms *machine.MachineState) *AgentState {
@@ -70,7 +65,6 @@ func globMatches(pattern, target string) bool {
7065
// the Agent's current state. A boolean indicating whether this is the
7166
// case or not is returned. The following criteria is used:
7267
// - Agent must meet the Job's machine target requirement (if any)
73-
// - Job must pass signature verification
7468
// - Agent must have all of the Job's required metadata (if any)
7569
// - Agent must have all required Peers of the Job scheduled locally (if any)
7670
// - Job must not conflict with any other Jobs scheduled to the agent
@@ -79,10 +73,6 @@ func (as *AgentState) AbleToRun(j *job.Job) (bool, string) {
7973
return false, fmt.Sprintf("agent ID %q does not match required %q", as.MState.ID, tgt)
8074
}
8175

82-
if as.verifyFunc != nil && !as.verifyFunc(j) {
83-
return false, "unable to verify signature"
84-
}
85-
8676
metadata := j.RequiredTargetMetadata()
8777
if len(metadata) != 0 {
8878
if !machine.HasMetadata(as.MState, metadata) {

client/api.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ package client
33
import (
44
"github.com/coreos/fleet/machine"
55
"github.com/coreos/fleet/schema"
6-
"github.com/coreos/fleet/sign"
76
)
87

98
type API interface {
10-
CreateSignatureSet(*sign.SignatureSet) error
11-
JobSignatureSet(string) (*sign.SignatureSet, error)
12-
139
Machines() ([]machine.MachineState, error)
1410

1511
Unit(string) (*schema.Unit, error)

fleet.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/coreos/fleet/config"
1717
"github.com/coreos/fleet/registry"
1818
"github.com/coreos/fleet/server"
19-
"github.com/coreos/fleet/sign"
2019
"github.com/coreos/fleet/version"
2120
)
2221

@@ -56,8 +55,8 @@ func main() {
5655
cfgset.String("public_ip", "", "IP address that fleet machine should publish")
5756
cfgset.String("metadata", "", "List of key-value metadata to assign to the fleet machine")
5857
cfgset.String("agent_ttl", agent.DefaultTTL, "TTL in seconds of fleet machine state in etcd")
59-
cfgset.Bool("verify_units", false, "Verify unit file signatures using local SSH identities")
60-
cfgset.String("authorized_keys_file", sign.DefaultAuthorizedKeysFile, "File containing public SSH keys to be used for signature verification")
58+
cfgset.Bool("verify_units", false, "DEPRECATED - This option is ignored")
59+
cfgset.String("authorized_keys_file", "", "DEPRECATED - This option is ignored")
6160

6261
globalconf.Register("", cfgset)
6362
cfg, err := getConfig(cfgset, *cfgPath)
@@ -173,7 +172,10 @@ func getConfig(flagset *flag.FlagSet, userCfgFile string) (*config.Config, error
173172
}
174173

175174
if cfg.VerifyUnits {
176-
log.Warning("WARNING: The signed/verified units feature is DEPRECATED and should not be used. It will be completely removed from fleet and fleetctl.")
175+
log.Error("Config option verify_units is no longer supported - ignoring")
176+
}
177+
if len(cfg.AuthorizedKeysFile) > 0 {
178+
log.Error("Config option authorized_keys_file is no longer supported - ignoring")
177179
}
178180

179181
config.UpdateLoggingFlagsFromConfig(flag.CommandLine, &cfg)

fleetctl/fleetctl.go

Lines changed: 5 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/coreos/fleet/pkg"
2424
"github.com/coreos/fleet/registry"
2525
"github.com/coreos/fleet/schema"
26-
"github.com/coreos/fleet/sign"
2726
"github.com/coreos/fleet/ssh"
2827
"github.com/coreos/fleet/unit"
2928
"github.com/coreos/fleet/version"
@@ -202,7 +201,8 @@ func main() {
202201
}
203202

204203
if sharedFlags.Sign {
205-
fmt.Fprintln(os.Stderr, "WARNING: The signed/verified units feature is DEPRECATED and should not be used. It will be completely removed from fleet and fleetctl.")
204+
fmt.Fprintln(os.Stderr, "WARNING: The signed/verified units feature is DEPRECATED and cannot be used.")
205+
os.Exit(2)
206206
}
207207

208208
if cmd.Name != "help" && cmd.Name != "version" {
@@ -424,59 +424,6 @@ func createUnit(name string, uf *unit.UnitFile) (*schema.Unit, error) {
424424
return &u, nil
425425
}
426426

427-
// signUnit signs the Unit of a Job using the public keys in the local SSH
428-
// agent, and pushes the resulting SignatureSet to the Registry
429-
func signUnit(u *schema.Unit) error {
430-
sc, err := sign.NewSignatureCreatorFromSSHAgent()
431-
if err != nil {
432-
return fmt.Errorf("failed creating SignatureCreator: %v", err)
433-
}
434-
435-
j := job.Job{
436-
Name: u.Name,
437-
Unit: *schema.MapSchemaUnitOptionsToUnitFile(u.Options),
438-
}
439-
ss, err := sc.SignJob(&j)
440-
if err != nil {
441-
return fmt.Errorf("failed signing Job(%s): %v", j.Name, err)
442-
}
443-
444-
err = cAPI.CreateSignatureSet(ss)
445-
if err != nil {
446-
return fmt.Errorf("failed storing Job signature in registry: %v", err)
447-
}
448-
449-
log.V(1).Infof("Signed Job(%s)", j.Name)
450-
return nil
451-
}
452-
453-
// verifyUnit attempts to verify the signature of the provided Unit's unit file using
454-
// the public keys in the local SSH agent
455-
func verifyUnit(u *schema.Unit) error {
456-
sv, err := sign.NewSignatureVerifierFromSSHAgent()
457-
if err != nil {
458-
return fmt.Errorf("failed creating SignatureVerifier: %v", err)
459-
}
460-
461-
ss, err := cAPI.JobSignatureSet(u.Name)
462-
if err != nil {
463-
return fmt.Errorf("failed attempting to retrieve SignatureSet of Job(%s): %v", u.Name, err)
464-
}
465-
j := &job.Job{
466-
Name: u.Name,
467-
Unit: *schema.MapSchemaUnitOptionsToUnitFile(u.Options),
468-
}
469-
verified, err := sv.VerifyJob(j, ss)
470-
if err != nil {
471-
return fmt.Errorf("failed attempting to verify Job(%s): %v", u.Name, err)
472-
} else if !verified {
473-
return fmt.Errorf("unable to verify Job(%s)", u.Name)
474-
}
475-
476-
log.V(1).Infof("Verified signature of Job(%s)", u.Name)
477-
return nil
478-
}
479-
480427
// lazyCreateUnits iterates over a set of unit names and, for each, attempts to
481428
// ensure that a unit by that name exists in the Registry, by checking a number
482429
// of conditions and acting on the first one that succeeds, in order of:
@@ -485,11 +432,9 @@ func verifyUnit(u *schema.Unit) error {
485432
// 3. a corresponding unit template (if applicable) existing in the Registry
486433
// 4. a corresponding unit template (if applicable) existing on disk
487434
// Any error encountered during these steps is returned immediately (i.e.
488-
// subsequent units are not acted on). An error is also returned if none of the
489-
// above conditions match a given unit.
490-
// If signAndVerify is true, the unit will be signed (if it is created), or have
491-
// its signature verified if it already exists in the Registry.
492-
func lazyCreateUnits(args []string, signAndVerify bool) error {
435+
// subsequent Jobs are not acted on). An error is also returned if none of the
436+
// above conditions match a given Job.
437+
func lazyCreateUnits(args []string) error {
493438
for _, arg := range args {
494439
// TODO(jonboulle): this loop is getting too unwieldy; factor it out
495440

@@ -503,11 +448,6 @@ func lazyCreateUnits(args []string, signAndVerify bool) error {
503448
if u != nil {
504449
log.V(1).Infof("Found Unit(%s) in Registry, no need to recreate it", name)
505450
warnOnDifferentLocalUnit(arg, u)
506-
if signAndVerify {
507-
if err := verifyUnit(u); err != nil {
508-
return err
509-
}
510-
}
511451
continue
512452
}
513453

@@ -521,11 +461,6 @@ func lazyCreateUnits(args []string, signAndVerify bool) error {
521461
if err != nil {
522462
return err
523463
}
524-
if signAndVerify {
525-
if err := signUnit(u); err != nil {
526-
return err
527-
}
528-
}
529464
continue
530465
}
531466

@@ -564,11 +499,6 @@ func lazyCreateUnits(args []string, signAndVerify bool) error {
564499
if err != nil {
565500
return err
566501
}
567-
if signAndVerify {
568-
if err := signUnit(u); err != nil {
569-
return err
570-
}
571-
}
572502
}
573503
return nil
574504
}

fleetctl/load.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ var (
1111
cmdLoadUnits = &Command{
1212
Name: "load",
1313
Summary: "Schedule one or more units in the cluster, first submitting them if necessary.",
14-
Usage: "[--sign] [--no-block|--block-attempts=N] UNIT...",
14+
Usage: "[--no-block|--block-attempts=N] UNIT...",
1515
Run: runLoadUnits,
1616
}
1717
)
1818

1919
func init() {
20-
cmdLoadUnits.Flags.BoolVar(&sharedFlags.Sign, "sign", false, "Sign unit file signatures and verify submitted units using local SSH identities.")
21-
cmdLoadUnits.Flags.IntVar(&sharedFlags.BlockAttempts, "block-attempts", 0, "Wait until the units are loaded, performing up to N attempts before giving up. A value of 0 indicates no limit.")
22-
cmdLoadUnits.Flags.BoolVar(&sharedFlags.NoBlock, "no-block", false, "Do not wait until the units have been loaded before exiting.")
20+
cmdLoadUnits.Flags.BoolVar(&sharedFlags.Sign, "sign", false, "DEPRECATED - this option cannot be used")
21+
cmdLoadUnits.Flags.IntVar(&sharedFlags.BlockAttempts, "block-attempts", 0, "Wait until the jobs are loaded, performing up to N attempts before giving up. A value of 0 indicates no limit.")
22+
cmdLoadUnits.Flags.BoolVar(&sharedFlags.NoBlock, "no-block", false, "Do not wait until the jobs have been loaded before exiting.")
2323
}
2424

2525
func runLoadUnits(args []string) (exit int) {
26-
if err := lazyCreateUnits(args, sharedFlags.Sign); err != nil {
26+
if err := lazyCreateUnits(args); err != nil {
2727
fmt.Fprintf(os.Stderr, "%v\n", err)
2828
return 1
2929
}

0 commit comments

Comments
 (0)