Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACLs: Remove server usage #8126

Merged
merged 5 commits into from
Sep 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ACLs: Remove server usage
  • Loading branch information
N-o-Z committed Sep 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit a3408c5c726b9ce34fc2a89c687eb5dbcc478539
52 changes: 0 additions & 52 deletions .github/workflows/esti.yaml
Original file line number Diff line number Diff line change
@@ -1337,58 +1337,6 @@ jobs:
})
}

run-system-aws-s3-acl-server:
name: Run latest lakeFS app on AWS S3 + ACL Server
needs: [ deploy-image, login-to-amazon-ecr ]
runs-on: ubuntu-22.04
env:
TAG: ${{ needs.deploy-image.outputs.tag }}
REPO: ${{ needs.login-to-amazon-ecr.outputs.registry }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Check-out code
uses: actions/checkout@v4

- name: Generate uniquifying value
id: unique
run: echo "value=$RANDOM" >> $GITHUB_OUTPUT

- name: Test lakeFS with S3 tests
uses: ./.github/actions/bootstrap-test-lakefs
with:
compose-file: esti/ops/docker-compose-acl.yaml
compose-flags: "--quiet-pull --exit-code-from=esti"
env:
LAKEFS_BLOCKSTORE_TYPE: s3
LAKEFS_BLOCKSTORE_S3_CREDENTIALS_ACCESS_KEY_ID: ${{ secrets.ESTI_AWS_ACCESS_KEY_ID }}
LAKEFS_BLOCKSTORE_S3_CREDENTIALS_SECRET_ACCESS_KEY: ${{ secrets.ESTI_AWS_SECRET_ACCESS_KEY }}
LAKEFS_DATABASE_TYPE: postgres
DOCKER_REG: ${{ needs.login-to-amazon-ecr.outputs.registry }}
ESTI_BLOCKSTORE_TYPE: s3
ESTI_STORAGE_NAMESPACE: s3://esti-system-testing/${{ github.run_number }}/${{ steps.unique.outputs.value }}
ESTI_AWS_ACCESS_KEY_ID: ${{ secrets.ESTI_AWS_ACCESS_KEY_ID }}
ESTI_AWS_SECRET_ACCESS_KEY: ${{ secrets.ESTI_AWS_SECRET_ACCESS_KEY }}
ESTI_VERSION: ${{ needs.deploy-image.outputs.tag }}

- name: Check files in S3 bucket
run: |
FILES_COUNT=`aws s3 ls s3://esti-system-testing/${{ github.run_number }}/${{ steps.unique.outputs.value }} --recursive | wc -l`
[ $FILES_COUNT -gt 5 ]

- name: lakeFS Logs on s3 failure
if: ${{ failure() }}
continue-on-error: true
run: docker compose -f esti/ops/docker-compose-acl.yaml logs --tail=1000 lakefs

- name: Export DB
if: ${{ always() }}
working-directory: esti/ops
run: |
if docker compose ps -q postgres; then
docker compose exec -T postgres pg_dumpall --username=lakefs | gzip | aws s3 cp - s3://esti-system-testing/${{ github.run_number }}/${{ steps.unique.outputs.value }}/dump.gz
fi

run-system-aws-s3-basic-auth:
name: Run latest lakeFS app on AWS S3 + Basic Auth
needs: [deploy-image, login-to-amazon-ecr]
2 changes: 1 addition & 1 deletion api/swagger.yml
Original file line number Diff line number Diff line change
@@ -888,7 +888,7 @@ components:
RBAC will remain enabled on GUI if "external". That only works
with an external auth service.
type: string
enum: [simplified, external]
enum: [none, simplified, external]
login_url:
description: primary URL to use for login.
type: string
5 changes: 3 additions & 2 deletions clients/java-legacy/api/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clients/java-legacy/docs/LoginConfig.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions clients/java/api/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clients/java/docs/LoginConfig.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clients/python-legacy/lakefs_client/model/login_config.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions clients/python/lakefs_sdk/models/login_config.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/python/test/test_login_config.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/python/test/test_setup_state.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion clients/rust/src/models/login_config.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion cmd/lakectl/cmd/auth.go
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import (
var authCmd = &cobra.Command{
Use: "auth [sub-command]",
Short: "Manage authentication and authorization",
Long: "manage authentication and authorization including users, groups and ACLs",
Long: `Manage authentication and authorization including users, groups and ACLs
This functionality is supported with an external auth service only.`,
}

func addPaginationFlags(cmd *cobra.Command) {
40 changes: 16 additions & 24 deletions cmd/lakefs/cmd/run.go
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ import (
"github.com/go-co-op/gocron"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/treeverse/lakefs/contrib/auth/acl"
"github.com/treeverse/lakefs/pkg/actions"
"github.com/treeverse/lakefs/pkg/api"
"github.com/treeverse/lakefs/pkg/auth"
@@ -104,34 +103,27 @@ Please run "lakefs superuser -h" and follow the instructions on how to migrate a
logger.WithError(err).Fatal("basic auth migration failed")
}
}

return auth.NewMonitoredAuthServiceAndInviter(apiService)
}
if cfg.IsAuthTypeAPI() {
apiService, err := auth.NewAPIAuthService(
cfg.Auth.API.Endpoint,
cfg.Auth.API.Token.SecureValue(),
cfg.Auth.AuthenticationAPI.ExternalPrincipalsEnabled,
secretStore,
authparams.ServiceCache(cfg.Auth.Cache),
logger.WithField("service", "auth_api"),
)
if err != nil {
logger.WithError(err).Fatal("failed to create authentication service")
}
if !cfg.Auth.API.SkipHealthCheck {
if err := apiService.CheckHealth(ctx, logger, cfg.Auth.API.HealthCheckTimeout); err != nil {
logger.WithError(err).Fatal("Auth API health check failed")
}
}
return auth.NewMonitoredAuthServiceAndInviter(apiService)
}
authService := acl.NewAuthService(
kvStore,

// Not Basic - using auth server
apiService, err := auth.NewAPIAuthService(
cfg.Auth.API.Endpoint,
cfg.Auth.API.Token.SecureValue(),
cfg.Auth.AuthenticationAPI.ExternalPrincipalsEnabled,
secretStore,
authparams.ServiceCache(cfg.Auth.Cache),
logger.WithField("service", "auth_api"),
)
return auth.NewMonitoredAuthService(authService)
if err != nil {
logger.WithError(err).Fatal("failed to create authentication service")
}
if !cfg.Auth.API.SkipHealthCheck {
if err := apiService.CheckHealth(ctx, logger, cfg.Auth.API.HealthCheckTimeout); err != nil {
logger.WithError(err).Fatal("Auth API health check failed")
}
}
return auth.NewMonitoredAuthServiceAndInviter(apiService)
}

var runCmd = &cobra.Command{
18 changes: 6 additions & 12 deletions cmd/lakefs/cmd/setup.go
Original file line number Diff line number Diff line change
@@ -6,11 +6,8 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/treeverse/lakefs/contrib/auth/acl"
"github.com/treeverse/lakefs/pkg/auth"
"github.com/treeverse/lakefs/pkg/auth/crypt"
"github.com/treeverse/lakefs/pkg/auth/model"
authparams "github.com/treeverse/lakefs/pkg/auth/params"
"github.com/treeverse/lakefs/pkg/auth/setup"
"github.com/treeverse/lakefs/pkg/config"
"github.com/treeverse/lakefs/pkg/kv"
@@ -63,24 +60,21 @@ var setupCmd = &cobra.Command{
os.Exit(1)
}

var (
authService auth.Service
metadataManager auth.MetadataManager
)
var authService auth.Service
kvStore, err := kv.Open(ctx, kvParams)
if err != nil {
fmt.Printf("Failed to connect to DB: %s", err)
os.Exit(1)
}
defer kvStore.Close()
logger := logging.ContextUnavailable()
authService = acl.NewAuthService(kvStore, crypt.NewSecretStore([]byte(cfg.Auth.Encrypt.SecretKey)), authparams.ServiceCache(cfg.Auth.Cache))
metadataManager = auth.NewKVMetadataManager(version.Version, cfg.Installation.FixedID, cfg.Database.Type, kvStore)

logger := logging.FromContext(ctx)
authMetadataManage := auth.NewKVMetadataManager(version.Version, cfg.Installation.FixedID, cfg.Database.Type, kvStore)
authService = NewAuthService(ctx, cfg, logger, kvStore, authMetadataManage)
cloudMetadataProvider := stats.BuildMetadataProvider(logger, cfg)
metadata := stats.NewMetadata(ctx, logger, cfg.Blockstore.Type, metadataManager, cloudMetadataProvider)
metadata := stats.NewMetadata(ctx, logger, cfg.Blockstore.Type, authMetadataManage, cloudMetadataProvider)

credentials, err := setupLakeFS(ctx, cfg, metadataManager, authService, userName, accessKeyID, secretAccessKey)
credentials, err := setupLakeFS(ctx, cfg, authMetadataManage, authService, userName, accessKeyID, secretAccessKey)
if err != nil {
fmt.Printf("Setup failed: %s\n", err)
os.Exit(1)
4 changes: 1 addition & 3 deletions cmd/lakefs/cmd/superuser.go
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ import (
"time"

"github.com/spf13/cobra"
"github.com/treeverse/lakefs/contrib/auth/acl"
"github.com/treeverse/lakefs/pkg/auth"
"github.com/treeverse/lakefs/pkg/auth/crypt"
"github.com/treeverse/lakefs/pkg/auth/model"
@@ -87,9 +86,8 @@ If the wrong user or credentials were chosen it is possible to delete the user a
fmt.Printf("Failed to initialize auth service: %s\n", err)
os.Exit(1)
}
// TODO (niro): This needs to be removed
default:
authService = acl.NewAuthService(kvStore, secretStore, authparams.ServiceCache(cfg.Auth.Cache))
logger.Fatal("invalid auth mode for superuser command")
}

authMetadataManager := auth.NewKVMetadataManager(version.Version, cfg.Installation.FixedID, cfg.Database.Type, kvStore)
28 changes: 0 additions & 28 deletions contrib/auth/acl/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion contrib/auth/acl/controller.go
Original file line number Diff line number Diff line change
@@ -293,7 +293,6 @@ func (c *Controller) UpdatePolicy(w http.ResponseWriter, r *http.Request, body a
writeResponse(w, http.StatusOK, response)
}

// ClaimTokenId - TODO (niro): Should be implemented?
func (c *Controller) ClaimTokenId(w http.ResponseWriter, _ *http.Request, _ apigen.ClaimTokenIdJSONRequestBody) {
writeError(w, http.StatusNotImplemented, "Not implemented")
}
2 changes: 1 addition & 1 deletion docs/assets/js/swagger.yml
Original file line number Diff line number Diff line change
@@ -888,7 +888,7 @@ components:
RBAC will remain enabled on GUI if "external". That only works
with an external auth service.
type: string
enum: [simplified, external]
enum: [none, simplified, external]
login_url:
description: primary URL to use for login.
type: string
3 changes: 2 additions & 1 deletion docs/reference/cli.md
Original file line number Diff line number Diff line change
@@ -480,7 +480,8 @@ Manage authentication and authorization
#### Synopsis
{:.no_toc}

manage authentication and authorization including users, groups and ACLs
Manage authentication and authorization including users, groups and ACLs
This functionality is supported with an external auth service only.

#### Options
{:.no_toc}
Loading
Loading