make more insecure options configurable and change insecure defaults from true to false

This commit is contained in:
Willy Kloucek
2021-11-10 15:45:55 +01:00
parent 0ec64fe99f
commit 69cc11dbe6
21 changed files with 106 additions and 68 deletions
+6 -1
View File
@@ -49,6 +49,11 @@ type Tracing struct {
Service string
}
// Reva defines all available REVA configuration.
type Reva struct {
Address string
}
// TokenManager is the config for using the reva token manager
type TokenManager struct {
JWTSecret string
@@ -71,7 +76,7 @@ type Config struct {
TokenManager TokenManager
Service Service
AccountBackend string
RevaAddress string
Reva Reva
StorageUsersDriver string
MachineAuthAPIKey string
IdentityManagement IdentityManagement
+2 -2
View File
@@ -184,10 +184,10 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.RevaAddress, "127.0.0.1:9142"),
Value: flags.OverrideDefaultString(cfg.Reva.Address, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.RevaAddress,
Destination: &cfg.Reva.Address,
},
&cli.StringFlag{
Name: "machine-auth-api-key",
+3 -3
View File
@@ -4,6 +4,7 @@ import (
"net/http"
"time"
"github.com/cs3org/reva/pkg/rgrpc/todo/pool"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/go-chi/chi/v5"
@@ -19,7 +20,6 @@ import (
ocsm "github.com/owncloud/ocis/ocs/pkg/middleware"
"github.com/owncloud/ocis/ocs/pkg/service/v0/data"
"github.com/owncloud/ocis/ocs/pkg/service/v0/response"
"github.com/owncloud/ocis/proxy/pkg/cs3"
"github.com/owncloud/ocis/proxy/pkg/user/backend"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
)
@@ -161,9 +161,9 @@ func (o Ocs) getAccountService() accounts.AccountsService {
}
func (o Ocs) getCS3Backend() backend.UserBackend {
revaClient, err := cs3.GetGatewayServiceClient(o.config.RevaAddress)
revaClient, err := pool.GetGatewayServiceClient(o.config.Reva.Address) //TODO: insecure defaults to true, https://github.com/cs3org/reva/issues/2216
if err != nil {
o.logger.Fatal().Msgf("could not get reva client at address %s", o.config.RevaAddress)
o.logger.Fatal().Msgf("could not get reva client at address %s", o.config.Reva.Address)
}
return backend.NewCS3UserBackend(nil, revaClient, o.config.MachineAuthAPIKey, o.logger)
}
+2 -2
View File
@@ -375,7 +375,7 @@ func (o Ocs) DeleteUser(w http.ResponseWriter, r *http.Request) {
return
}
if o.config.RevaAddress != "" && o.config.StorageUsersDriver != "owncloud" {
if o.config.Reva.Address != "" && o.config.StorageUsersDriver != "owncloud" {
t, err := o.mintTokenForUser(r.Context(), account)
if err != nil {
mustNotFail(render.Render(w, r, response.ErrRender(data.MetaServerError.StatusCode, errors.Wrap(err, "error minting token").Error())))
@@ -384,7 +384,7 @@ func (o Ocs) DeleteUser(w http.ResponseWriter, r *http.Request) {
ctx := metadata.AppendToOutgoingContext(r.Context(), revactx.TokenHeader, t)
gwc, err := pool.GetGatewayServiceClient(o.config.RevaAddress)
gwc, err := pool.GetGatewayServiceClient(o.config.Reva.Address) //TODO: insecure defaults to true, https://github.com/cs3org/reva/issues/2216
if err != nil {
o.logger.Error().Err(err).Msg("error securing a connection to Reva gateway")
}