Skip to content
Snippets Groups Projects
Commit 24b0519f authored by Florent Gluck's avatar Florent Gluck
Browse files

WIP: nexus server with new route for CA

parent 338424b0
Branches
No related tags found
No related merge requests found
......@@ -61,6 +61,7 @@ type Config struct {
VMsDir string
TemplatesDir string
CertsDir string
SpiceCert string // Public CA certificate required by spice client
}
var log = logger.GetInstance()
......@@ -113,6 +114,7 @@ func GetInstance() *Config {
config.VMsDir = filepath.Join(dataDir, "/vms")
config.TemplatesDir = filepath.Join(dataDir, "/templates")
config.CertsDir = certsDir
config.SpiceCert = filepath.Join(certsDir, "/ca-cert.pem")
// // Deletes temp directory and its content.
// if err := os.RemoveAll(config.Core.TmpDir); err != nil {
......
......@@ -93,6 +93,7 @@ func (router *Router) Start(port int) {
vmsGroup.GET("/editaccess", router.vms.GetModifiableVMAccessVMs)
vmsGroup.GET("/exportdir", router.vms.GetDirExportableVMs)
vmsGroup.GET("/importfiles", router.vms.GetFilesImportableVMs)
vmsGroup.GET("/cert", router.vms.GetSpiceCertificate)
vmsGroup.POST("", router.vms.CreateVM)
vmsGroup.DELETE("/:id", router.vms.DeleteVM)
......
......@@ -35,6 +35,12 @@ func NewRouterVMs() *RouterVMs {
return &RouterVMs{users: users.GetUsersInstance(), vms: vms.GetVMsInstance()}
}
// Returns the public CA certificate required by the spice remote viewer.
// curl -X GET https://localhost:1077/vms/cert
func (r *RouterVMs) GetSpiceCertificate(c echo.Context) error {
return c.File(conf.SpiceCert)
}
// Returns VMs that can be listed.
// Requires to be the VM's owner, or either capability:
// User cap: CAP_VM_LIST_ANY: returns all VMs.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment