diff --git a/core/core_test.go b/core/core_test.go index 02332c7..8ea90f3 100644 --- a/core/core_test.go +++ b/core/core_test.go @@ -7,9 +7,9 @@ package core import ( "bytes" "encoding/json" - "os" "github.com/cloudflare/redoctober/keycache" "github.com/cloudflare/redoctober/passvault" + "os" "testing" ) diff --git a/index.html b/index.html deleted file mode 100644 index 2acb68c..0000000 --- a/index.html +++ /dev/null @@ -1,413 +0,0 @@ - - - - Red October - Two Man Rule File Encryption & Decryption - - - - - - - - - - - -
-

Red October Management

- -
-
-

Create vault/admin

-
- - -
- - -
-
- - -
- -
- -
- -

User summary

- -
- - -
- - -
-
- - -
- -
- -
-

Current Delegations

-
    - -

    All Users

    -
      -
      -
      - -
      -

      Delegate

      - -
      - - -
      -
      - - -
      -
      - - -
      -
      -
      -
      - - -
      -
      - - -
      -
      - -
      -
      -
      - -
      - -
      -
      -

      Change password

      - -
      - - -
      -
      - - -
      -
      - - -
      -
      -
      - - -
      - -
      -
      - -
      -

      Modify User

      - -
      - - -
      -
      - - -
      -
      - - -
      -
      -
      -
      - - -
      -
      - - -
      -
      - -
      -
      -
      -
      -
      -
      -

      Encrypt data

      - -
      - - -
      -
      - - -
      -
      - - -
      -
      -
      -
      - - -
      -
      - - -
      -
      -
      - - -
      - -
      -
      -
      -

      Decrypt data

      - -
      - - -
      -
      - - -
      -
      - - -
      -
      -
      - - -
      - -
      -
      -
      -
      - - - - - - diff --git a/redoctober.go b/redoctober.go index 0f49bf3..0a6c0f8 100644 --- a/redoctober.go +++ b/redoctober.go @@ -5,6 +5,7 @@ package main import ( + "bytes" "crypto/rand" "crypto/tls" "crypto/x509" @@ -18,6 +19,7 @@ import ( "net/http" "os" "runtime" + "time" ) // List of URLs to register and their related functions @@ -128,15 +130,17 @@ func NewServer(process chan userRequest, staticPath, addr, certPath, keyPath, ca } // queue up web frontend - if staticPath != "" { - mux.HandleFunc("/index", func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, staticPath) - }) - } + mux.HandleFunc("/index", handleIndexHtml) + mux.HandleFunc("/", handleIndexHtml) return &srv, &lstnr, nil } +func handleIndexHtml(w http.ResponseWriter, r *http.Request) { + body := bytes.NewReader(indexHtml) + http.ServeContent(w, r, "index.html", time.Now(), body) +} + const usage = `Usage: redoctober -static -vaultpath -addr -cert -key [-ca ] @@ -152,7 +156,7 @@ func main() { os.Exit(2) } - var staticPath = flag.String("static", "/tmp/index.html", "Path to the the static entry") + var staticPath = flag.String("static", "", "Path to the the static entry (deprecated)") var vaultPath = flag.String("vaultpath", "diskrecord.json", "Path to the the disk vault") var addr = flag.String("addr", "localhost:8080", "Server and port separated by :") var certPath = flag.String("cert", "", "Path of TLS certificate in PEM format") @@ -206,3 +210,418 @@ func main() { } s.Serve(*l) } + +var indexHtml = []byte(` + + + Red October - Two Man Rule File Encryption & Decryption + + + + + + + + + + + +
      +

      Red October Management

      + +
      +
      +

      Create vault/admin

      +
      + + +
      + + +
      +
      + + +
      + +
      + +
      + +

      User summary

      + +
      + + +
      + + +
      +
      + + +
      + +
      + +
      +

      Current Delegations

      +
        + +

        All Users

        +
          +
          +
          + +
          +

          Delegate

          + +
          + + +
          +
          + + +
          +
          + + +
          +
          +
          +
          + + +
          +
          + + +
          +
          + +
          +
          +
          + +
          + +
          +
          +

          Change password

          + +
          + + +
          +
          + + +
          +
          + + +
          +
          +
          + + +
          + +
          +
          + +
          +

          Modify User

          + +
          + + +
          +
          + + +
          +
          + + +
          +
          +
          +
          + + +
          +
          + + +
          +
          + +
          +
          +
          +
          +
          +
          +

          Encrypt data

          + +
          + + +
          +
          + + +
          +
          + + +
          +
          +
          +
          + + +
          +
          + + +
          +
          +
          + + +
          + +
          +
          +
          +

          Decrypt data

          + +
          + + +
          +
          + + +
          +
          + + +
          +
          +
          + + +
          + +
          +
          +
          +
          + +
          +

          Red October. CloudFlare

          +
          + + + + +`)