cmd/hello: remove hello.ipn.dev (#19567)
Fixes #19566 Signed-off-by: Noel O'Brien <noel@tailscale.com>
This commit is contained in:
+2
-23
@@ -9,7 +9,6 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"flag"
|
"flag"
|
||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
@@ -76,22 +75,7 @@ func main() {
|
|||||||
hs := &http.Server{
|
hs := &http.Server{
|
||||||
Addr: *httpsAddr,
|
Addr: *httpsAddr,
|
||||||
TLSConfig: &tls.Config{
|
TLSConfig: &tls.Config{
|
||||||
GetCertificate: func(hi *tls.ClientHelloInfo) (*tls.Certificate, error) {
|
GetCertificate: localClient.GetCertificate,
|
||||||
switch hi.ServerName {
|
|
||||||
case "hello.ts.net":
|
|
||||||
return localClient.GetCertificate(hi)
|
|
||||||
case "hello.ipn.dev":
|
|
||||||
c, err := tls.LoadX509KeyPair(
|
|
||||||
"/etc/hello/hello.ipn.dev.crt",
|
|
||||||
"/etc/hello/hello.ipn.dev.key",
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &c, nil
|
|
||||||
}
|
|
||||||
return nil, errors.New("invalid SNI name")
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
IdleTimeout: 30 * time.Second,
|
IdleTimeout: 30 * time.Second,
|
||||||
ReadHeaderTimeout: 20 * time.Second,
|
ReadHeaderTimeout: 20 * time.Second,
|
||||||
@@ -155,8 +139,7 @@ func tailscaleIP(who *apitype.WhoIsResponse) string {
|
|||||||
func root(w http.ResponseWriter, r *http.Request) {
|
func root(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.TLS == nil && *httpsAddr != "" {
|
if r.TLS == nil && *httpsAddr != "" {
|
||||||
host := r.Host
|
host := r.Host
|
||||||
if strings.Contains(r.Host, "100.101.102.103") ||
|
if strings.Contains(r.Host, "100.101.102.103") {
|
||||||
strings.Contains(r.Host, "hello.ipn.dev") {
|
|
||||||
host = "hello.ts.net"
|
host = "hello.ts.net"
|
||||||
}
|
}
|
||||||
http.Redirect(w, r, "https://"+host, http.StatusFound)
|
http.Redirect(w, r, "https://"+host, http.StatusFound)
|
||||||
@@ -166,10 +149,6 @@ func root(w http.ResponseWriter, r *http.Request) {
|
|||||||
http.Redirect(w, r, "/", http.StatusFound)
|
http.Redirect(w, r, "/", http.StatusFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if r.TLS != nil && *httpsAddr != "" && strings.Contains(r.Host, "hello.ipn.dev") {
|
|
||||||
http.Redirect(w, r, "https://hello.ts.net", http.StatusFound)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
tmpl, err := getTmpl()
|
tmpl, err := getTmpl()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.Header().Set("Content-Type", "text/plain")
|
w.Header().Set("Content-Type", "text/plain")
|
||||||
|
|||||||
Reference in New Issue
Block a user