diff --git a/cmd/admin-handlers-idp-config.go b/cmd/admin-handlers-idp-config.go index 4d5f14988..6a4b5fb65 100644 --- a/cmd/admin-handlers-idp-config.go +++ b/cmd/admin-handlers-idp-config.go @@ -37,7 +37,7 @@ import ( "github.com/minio/pkg/ldap" ) -func (a adminAPIHandlers) addOrUpdateIDPHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, isUpdate bool) { +func addOrUpdateIDPHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, isUpdate bool) { objectAPI, cred := validateAdminReq(ctx, w, r, iampolicy.ConfigUpdateAdminAction) if objectAPI == nil { return @@ -201,7 +201,7 @@ func (a adminAPIHandlers) AddIdentityProviderCfg(w http.ResponseWriter, r *http. ctx := newContext(r, w, "AddIdentityProviderCfg") defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) - a.addOrUpdateIDPHandler(ctx, w, r, false) + addOrUpdateIDPHandler(ctx, w, r, false) } // UpdateIdentityProviderCfg: updates an existing IDP config for openid/ldap. @@ -213,7 +213,7 @@ func (a adminAPIHandlers) UpdateIdentityProviderCfg(w http.ResponseWriter, r *ht ctx := newContext(r, w, "UpdateIdentityProviderCfg") defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) - a.addOrUpdateIDPHandler(ctx, w, r, true) + addOrUpdateIDPHandler(ctx, w, r, true) } // ListIdentityProviderCfg: diff --git a/cmd/admin-handlers-site-replication.go b/cmd/admin-handlers-site-replication.go index 0712452cc..9cf4ed721 100644 --- a/cmd/admin-handlers-site-replication.go +++ b/cmd/admin-handlers-site-replication.go @@ -549,12 +549,14 @@ func (a adminAPIHandlers) SiteReplicationResyncOp(w http.ResponseWriter, r *http // SiteReplicationDevNull - everything goes to io.Discard // [POST] /minio/admin/v3/site-replication/devnull -func (a *adminAPIHandlers) SiteReplicationDevNull(w http.ResponseWriter, r *http.Request) { +func (a adminAPIHandlers) SiteReplicationDevNull(w http.ResponseWriter, r *http.Request) { + ctx := newContext(r, w, "SiteReplicationDevNull") + defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) + globalSiteNetPerfRX.Connect() defer globalSiteNetPerfRX.Disconnect() connectTime := time.Now() - ctx := newContext(r, w, "SiteReplicationDevNull") for { n, err := io.CopyN(io.Discard, r.Body, 128*humanize.KiByte) atomic.AddUint64(&globalSiteNetPerfRX.RX, uint64(n)) @@ -578,7 +580,10 @@ func (a *adminAPIHandlers) SiteReplicationDevNull(w http.ResponseWriter, r *http // SiteReplicationNetPerf - everything goes to io.Discard // [POST] /minio/admin/v3/site-replication/netperf -func (a *adminAPIHandlers) SiteReplicationNetPerf(w http.ResponseWriter, r *http.Request) { +func (a adminAPIHandlers) SiteReplicationNetPerf(w http.ResponseWriter, r *http.Request) { + ctx := newContext(r, w, "SiteReplicationNetPerf") + defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) + durationStr := r.Form.Get(peerRESTDuration) duration, _ := time.ParseDuration(durationStr) if duration < globalNetPerfMinDuration { diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index c390ef20f..5594c266b 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1242,11 +1242,6 @@ func (a adminAPIHandlers) NetperfHandler(w http.ResponseWriter, r *http.Request) } } -// SpeedtestHandler - Deprecated. See ObjectSpeedTestHandler -func (a adminAPIHandlers) SpeedTestHandler(w http.ResponseWriter, r *http.Request) { - a.ObjectSpeedTestHandler(w, r) -} - // ObjectSpeedTestHandler - reports maximum speed of a cluster by performing PUT and // GET operations on the server, supports auto tuning by default by automatically // increasing concurrency and stopping when we have reached the limits on the @@ -1416,6 +1411,7 @@ func validateObjPerfOptions(ctx context.Context, storageInfo madmin.StorageInfo, // NetSpeedtestHandler - reports maximum network throughput func (a adminAPIHandlers) NetSpeedtestHandler(w http.ResponseWriter, r *http.Request) { ctx := newContext(r, w, "NetSpeedtestHandler") + defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrNotImplemented), r.URL) } @@ -1545,6 +1541,7 @@ func extractTraceOptions(r *http.Request) (opts madmin.ServiceTraceOpts, err err // The handler sends http trace to the connected HTTP client. func (a adminAPIHandlers) TraceHandler(w http.ResponseWriter, r *http.Request) { ctx := newContext(r, w, "HTTPTrace") + defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) // Validate request signature. _, adminAPIErr := checkAdminRequestAuth(ctx, r, iampolicy.TraceAdminAction, "") diff --git a/cmd/admin-router.go b/cmd/admin-router.go index cc2691d90..dda6ee09c 100644 --- a/cmd/admin-router.go +++ b/cmd/admin-router.go @@ -283,7 +283,7 @@ func registerAdminRouter(router *mux.Router, enableConfigOps bool) { Queries("paths", "{paths:.*}").HandlerFunc(gz(httpTraceHdrs(adminAPI.ForceUnlockHandler))) } - adminRouter.Methods(http.MethodPost).Path(adminVersion + "/speedtest").HandlerFunc(httpTraceHdrs(adminAPI.SpeedTestHandler)) + adminRouter.Methods(http.MethodPost).Path(adminVersion + "/speedtest").HandlerFunc(httpTraceHdrs(adminAPI.ObjectSpeedTestHandler)) adminRouter.Methods(http.MethodPost).Path(adminVersion + "/speedtest/object").HandlerFunc(httpTraceHdrs(adminAPI.ObjectSpeedTestHandler)) adminRouter.Methods(http.MethodPost).Path(adminVersion + "/speedtest/drive").HandlerFunc(httpTraceHdrs(adminAPI.DriveSpeedtestHandler)) adminRouter.Methods(http.MethodPost).Path(adminVersion + "/speedtest/net").HandlerFunc(httpTraceHdrs(adminAPI.NetperfHandler))