AB#2306 Public image sharing in Google (#358)

* document how to publicly share images in gcloud
* Write disclamer in debugd
* Add disclamer about debug images to contributing file
* Print debug banner on startup
Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
Fabian Kammel 2022-08-16 15:53:54 +02:00 committed by GitHub
parent abb4fb4f0f
commit 170a8bf5e0
10 changed files with 118 additions and 16 deletions

View file

@ -66,8 +66,8 @@ func deploy(cmd *cobra.Command, fileHandler file.Handler, constellationConfig *c
debugConfig.ConstellationDebugConfig.BootstrapperPath = overrideBootstrapperPath
}
if !state.ImageNameContainsDebug(constellationConfig) {
log.Println("WARN: constellation image does not contain 'debug', are you using a debug image?")
if !constellationConfig.IsImageDebug() {
log.Println("WARN: constellation image does not look like a debug image. Are you using a debug image?")
}
overrideIPs, err := cmd.Flags().GetStringSlice("ips")

View file

@ -2,7 +2,6 @@ package state
import (
"errors"
"strings"
"github.com/edgelesssys/constellation/internal/cloud/cloudtypes"
"github.com/edgelesssys/constellation/internal/config"
@ -77,15 +76,3 @@ func getQEMUInstances(stat state.ConstellationState, _ *config.Config) (controlP
workers = cloudtypes.ScalingGroup{Instances: stat.QEMUWorkers}
return
}
// ImageNameContainsDebug check wether the image name in config contains "debug".
func ImageNameContainsDebug(config *config.Config) bool {
switch {
case config.Provider.GCP != nil:
return strings.Contains(config.Provider.GCP.Image, "debug")
case config.Provider.Azure != nil:
return strings.Contains(config.Provider.Azure.Image, "debug")
default:
return false
}
}

View file

@ -2,6 +2,7 @@ package main
import (
"flag"
"fmt"
"net"
"os"
"sync"
@ -20,6 +21,13 @@ import (
"golang.org/x/net/context"
)
const debugBanner = `
**************************************
THIS A CONSTELLATION DEBUG IMAGE.
DO NOT USE IN PRODUCTION.
**************************************
`
func main() {
wg := &sync.WaitGroup{}
verbosity := flag.Int("v", 0, logger.CmdLineVerbosityDescription)
@ -62,6 +70,8 @@ func main() {
panic(err)
}
writeDebugBanner(log)
wg.Add(1)
go sched.Start(ctx, wg)
wg.Add(1)
@ -69,3 +79,15 @@ func main() {
wg.Wait()
}
func writeDebugBanner(log *logger.Logger) {
tty, err := os.OpenFile("/dev/ttyS0", os.O_WRONLY, os.ModeAppend)
if err != nil {
log.Infof("Unable to open /dev/ttyS0 for printing banner: %v", err)
return
}
defer tty.Close()
if _, err := fmt.Fprint(tty, debugBanner); err != nil {
log.Infof("Unable to print to /dev/ttyS0: %v", err)
}
}