diff --git a/auto/gui.files.go b/auto/gui.files.go index 242b80fc9..ae76e06ce 100644 --- a/auto/gui.files.go +++ b/auto/gui.files.go @@ -27,7 +27,7 @@ func Assets() map[string][]byte { bs, _ = ioutil.ReadAll(gr) assets["angular/angular.min.js"] = bs - bs, _ = base64.StdEncoding.DecodeString("H4sIAAAJbogA/+x9e3PbRpL4//oUY/78C0mbgqQk69qzouQc2d7TxrFdlpW9KkV7BRJDEhEIMHhI5tr67tfdMwDmCUKPze1VHSuxSMxMT09PT7+mZ7C3x46z9SaPF8uSjY7H7Ov9g2/ZX8PLbMp+zPIFC9MIaqRlHk+rMssLNio4Z+WSs+N3bz9+OPnx7OO7D6dsHid8HOwAuBdJwghcwXJe8PyKRwE7KzjL5tAsLliRVfmMs1kWcQY/F9kVz1MesekGOmM/n3zcLcpNwhFWEs94WmB3YclmUDrlbJ5VgFKcEg5vTo5fvT19Rd0HOzt7T34rkjgt2TTPrqHv56zMKz6BvtIyTite/14nVYH/i9/syR60XCTZNEzY4+dsHiYFVArTRZWEufyNlXaGFXwpgBazcni4s3MV5qzYpDMYVrpgR3WLYJVFVcJHw6ZsOGHnw3VYzMJknfPZsgzKPEyLJCz58GJ8SICqPJmGAP6IDYFuBL9pH8AA5vFiNK/gQZylbPR4WZbr93l2FUc8n7DHDbz62Zh93mHw0SoGEZ+HVVIWwacin/8HD+HZ23BFnf7n7vHph9e7H7NLnkLnW9oeZ9llzOu2WkvR1EIoANqdlmEZz17DZBVvMux8JJDEDxBmHn96zoYJkHEP/9kdTprSopqL0uC3IkuH9PwGKIf/63Qq8yxJAPLw1RVPy+MyT4D6CuGKWbaG2aWxNUSih0ESFiW1gjGlVZIIKuDkYMnJS3i8L8dHU1/NZrwoXqfwvO0gCsuwhosfYOO/LXnKThtGwekNc1gf10ugBPFxksHzNSCO5TCIlAtosD7iVAW1zrMFtC+oleRyBhWLDGZiDfSeZ/kKV15Z5WnBQljP+7Bk43RGHamgljT9BVuGBawrwHAOK2IJC/E6LpcEX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8BgQz3mWB2WSL6KZclgRoyG/YHqNyySka7W6bD5UH/F2G5Hdg++sIZUOppCzssAMjKZfsFZUrA1qGRce11PTxNjUDY16IN5rreVrbrC6CHfnLIwzHk7Xd0KP7GQ/fptxiHImAD4odRyGO/FYTR/D/rYShlvZmSYUIyyR9gJOCob9H1O7p02nWTtXuzFwX8WREMgfo+lR/2kzYscWAZj5K9/gKopgHZFU31az0wh9C6PTUO9Lx7oTZ4mZcOOu+aArxr8r6FgneE3MpICF8lpZIgVfrtCfPM9iKCF4waJYqqtIJlGKU5tKS3zP7CQup1YJLQAzmaSIihhX6b8bCSjidYmOgmiCJ0Wtx5M4zV1waK/ReH5bvdkVKfjfAAAA//8BAAD//yRfyM7OhwAA") gr, _ = gzip.NewReader(bytes.NewBuffer(bs)) bs, _ = ioutil.ReadAll(gr) assets["app.js"] = bs diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index d95bd64d4..a3a47b3ac 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -52,33 +52,28 @@ func init() { } func startGUI(cfg config.GUIConfiguration, assetDir string, m *model.Model) error { - var listener net.Listener var err error - if cfg.UseTLS { - cert, err := loadCert(confDir, "https-") - if err != nil { - l.Infoln("Loading HTTPS certificate:", err) - l.Infoln("Creating new HTTPS certificate") - newCertificate(confDir, "https-") - cert, err = loadCert(confDir, "https-") - } - if err != nil { - return err - } - tlsCfg := &tls.Config{ - Certificates: []tls.Certificate{cert}, - ServerName: "syncthing", - } - listener, err = tls.Listen("tcp", cfg.Address, tlsCfg) - if err != nil { - return err - } - } else { - listener, err = net.Listen("tcp", cfg.Address) - if err != nil { - return err - } + + cert, err := loadCert(confDir, "https-") + if err != nil { + l.Infoln("Loading HTTPS certificate:", err) + l.Infoln("Creating new HTTPS certificate") + newCertificate(confDir, "https-") + cert, err = loadCert(confDir, "https-") } + if err != nil { + return err + } + tlsCfg := &tls.Config{ + Certificates: []tls.Certificate{cert}, + ServerName: "syncthing", + } + + rawListener, err := net.Listen("tcp", cfg.Address) + if err != nil { + return err + } + listener := &DowngradingListener{rawListener, tlsCfg} // The GET handlers getRestMux := http.NewServeMux() @@ -140,6 +135,11 @@ func startGUI(cfg config.GUIConfiguration, assetDir string, m *model.Model) erro handler = basicAuthAndSessionMiddleware(cfg, handler) } + // Redirect to HTTPS if we are supposed to + if cfg.UseTLS { + handler = redirectToHTTPSMiddleware(handler) + } + go http.Serve(listener, handler) return nil } @@ -157,6 +157,23 @@ func getPostHandler(get, post http.Handler) http.Handler { }) } +func redirectToHTTPSMiddleware(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Add a generous access-control-allow-origin header since we may be + // redirecting REST requests over protocols + w.Header().Add("Access-Control-Allow-Origin", "*") + + if r.TLS == nil { + // Redirect HTTP requests to HTTPS + r.URL.Host = r.Host + r.URL.Scheme = "https" + http.Redirect(w, r, r.URL.String(), http.StatusFound) + } else { + h.ServeHTTP(w, r) + } + }) +} + func noCacheMiddleware(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "no-cache") diff --git a/cmd/syncthing/tls.go b/cmd/syncthing/tls.go index e46e8079e..7a4150669 100644 --- a/cmd/syncthing/tls.go +++ b/cmd/syncthing/tls.go @@ -5,6 +5,7 @@ package main import ( + "bufio" "crypto/rand" "crypto/rsa" "crypto/sha256" @@ -13,8 +14,10 @@ import ( "crypto/x509/pkix" "encoding/binary" "encoding/pem" + "io" "math/big" mr "math/rand" + "net" "os" "path/filepath" "time" @@ -73,3 +76,40 @@ func newCertificate(dir string, prefix string) { pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)}) keyOut.Close() } + +type DowngradingListener struct { + net.Listener + TLSConfig *tls.Config +} + +type WrappedConnection struct { + io.Reader + net.Conn +} + +func (l *DowngradingListener) Accept() (net.Conn, error) { + conn, err := l.Listener.Accept() + if err != nil { + return nil, err + } + + br := bufio.NewReader(conn) + bs, err := br.Peek(1) + if err != nil { + conn.Close() + return nil, err + } + + wrapper := &WrappedConnection{br, conn} + + // 0x16 is the first byte of a TLS handshake + if bs[0] == 0x16 { + return tls.Server(wrapper, l.TLSConfig), nil + } + + return wrapper, nil +} + +func (c *WrappedConnection) Read(b []byte) (n int, err error) { + return c.Reader.Read(b) +} diff --git a/gui/app.js b/gui/app.js index 4c7e0717c..9fa0b871d 100644 --- a/gui/app.js +++ b/gui/app.js @@ -153,13 +153,17 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca return; } - console.log('UIOnline'); - $scope.init(); - online = true; - restarting = false; - $('#networkError').modal('hide'); - $('#restarting').modal('hide'); - $('#shutdown').modal('hide'); + if (restarting){ + document.location.reload(true); + } else { + console.log('UIOnline'); + $scope.init(); + online = true; + restarting = false; + $('#networkError').modal('hide'); + $('#restarting').modal('hide'); + $('#shutdown').modal('hide'); + } }); $scope.$on('UIOffline', function (event, arg) { @@ -585,7 +589,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca setTimeout(function(){ window.location.protocol = protocol; - }, 1000); + }, 2500); $scope.protocolChanged = false; }