Browse Source

Merge pull request #459 from galal-hussein/check_time

Check if server time before 1/1/1970
pull/498/head
Darren Shepherd 6 years ago committed by GitHub
parent
commit
a999cd43aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      pkg/cli/server/server.go

14
pkg/cli/server/server.go

@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"strings"
"time"
systemd "github.com/coreos/go-systemd/daemon"
"github.com/docker/docker/pkg/reexec"
@ -67,6 +68,10 @@ func run(app *cli.Context, cfg *cmds.Server) error {
return runWithLogging(app, cfg)
}
if err := checkUnixTimestamp(); err != nil {
return err
}
setupLogging(app)
if !cfg.DisableAgent && os.Getuid() != 0 && !cfg.Rootless {
@ -180,3 +185,12 @@ func knownIPs(ips []string) []string {
}
return ips
}
func checkUnixTimestamp() error {
timeNow := time.Now()
// check if time before 01/01/1980
if timeNow.Before(time.Unix(315532800, 0)) {
return fmt.Errorf("server time isn't set properly: %v", timeNow)
}
return nil
}

Loading…
Cancel
Save