Giter VIP home page Giter VIP logo

airavata-custos's Introduction

Apache Airavata Custos Security

License GitHub closed pull requests Build Status

Science gateways represent potential targets for cybersecurity threats to users, scientific research, and scientific resources. Custos is a software framework that provides common security operations for science gateways, including user identity and access management, gateway tenant profile management, resource secrets management, and groups and sharing management. The goals of the Custos project are to provide these services to a wide range of science gateway frameworks, providing the community with an open-source, transparent, and reviewed code base for common security operations; and to operate trustworthy security services for the science gateway community using this software base. To accomplish these goals, we implement Custos using a scalable microservice architecture that can provide highly available, fault-tolerant operations. Custos exposes these services through a language-independent Application Programming Interface that encapsulates science gateway usage scenarios.

Following diagram illustrate the architecture of the Custos Software.

Custos_Diagram

To find out more, please check out the Custos website.

Quickstart

Installation Instructions

Setup Custos for local development

Prerequisites

  • Java 17

  • Docker installed on local environment

  • Maven 3.6.x

Clone the repository

  git clone -b develop https://github.com/apache/airavata-custos.git
  

Build source code

Following command builds the Custos source code and create two docker images of custos_core_server and custos_integration_server

  cd airavata-custos
  mvn clean install

Run Custos on docker

Following command starts Custos main services and its depend services. All services are listed below and you should be able to access them locally if all services are correctly started.

   cd custos-utilities/ide-integration/src/main/containers
   docker-compose up

Bootstrapping Custos Super Tenant

If all services were successfully ran. Custos bootstrap service needs to be run to create a Super tenant to launch Custos Portal

 cd custos-utilities/custos-bootstrap-service/
 mvn spring-boot:run

The above command should create the super tenant and it outputs super tenant credentials. Copy those credentials to configure Custos Portal.

Note: Make sure to clean up old databases for fresh start.

Install Custos Portal Locally

Follow the following link to access portal deployment instructions

Custos Portal

You have to configure following properties in the .env file

CUSTOS_CLIENT_ID="SUPERT TENANT ID CREATED FROM ABOVE STEP"
CUSTOS_CLIENT_SEC="SUPERT TENANT CREDENTIAL CREATED FROM ABOVE STEP"
CUSTOS_API_URL="http://localhost:10000"
CUSTOS_SUPER_CLIENT_ID="SUPERT TENANT ID CREATED FROM ABOVE STEP"
UNDER_MAINTENANCE=False

Custos Integration With External Applications

Custos can be integrated with external applications using Custos REST Endpoints, Python SDK, or Java SDK.

Integrate Using Java SDK

In order to perform this operation you need to have a already activated tenant in either Custos Managed Services or Your own deployment. Following instructions are given for locally deployed custos setup which can be extended to any deployment,

####Initializing Custos Java SDK

  • Add maven dependency to your project
   <groupId>org.apache.custos</groupId>
   <artifactId>custos-java-sdk</artifactId>
   <version>1.1-SNAPSHOT</version>
</dependency>
  • Initialize Custos Client Provider in your application
 CustosClientProvider custosClientProvider = new CustosClientProvider.Builder().setServerHost("localhost")
                    .setServerPort(7000)
                    .setClientId(CUSTOS CLIENT ID) // client Id generated from above step or any active tenant id
                    .setClientSec(CUSTOS CLIENT SECRET)  
                    .usePlainText(true) // Don't use this in production setup
                    .build();

Once above step is done, you can use custos available methods for authentication and authorization purposes

  • Sample client code to register and enable a User
 UserManagementClient userManagementClient =  custosClientProvider.getUserManagementClient();
 userManagementClient.registerUser("jhon","Smith","testpassword","smith@1",
                    "[email protected]",false);
 userManagementClient.enableUser("jhon");
 OperationStatus status =  userManagementClient.isUserEnabled("Jhon");

Deploy Custos on remote server

Follow the Ansible based deployed instructions. see documentation here

Questions or need help?

Please create a github issue or subscribe to custos mailing list [email protected] and send us an email.

Publications

@inproceedings{10.1145/3311790.3396635,
author = {Ranawaka, Isuru and Marru, Suresh and Graham, Juleen and Bisht, Aarushi and Basney, Jim and Fleury, Terry and Gaynor, Jeff and Wannipurage, Dimuthu and Christie, Marcus and Mahmoud, Alexandru and Afgan, Enis and Pierce, Marlon},
title = {Custos: Security Middleware for Science Gateways},
year = {2020},
isbn = {9781450366892},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3311790.3396635},
doi = {10.1145/3311790.3396635},
booktitle = {Practice and Experience in Advanced Research Computing},
pages = {278–284},
numpages = {7},
location = {Portland, OR, USA},
series = {PEARC '20}
}
@inproceedings{10.1145/3491418.3535177,
author = {Ranawaka, Isuru and Goonasekara, Nuwan and Afgan, Enis and Basney, Jim and Marru, Suresh and Pierce, Marlon},
title = {Custos Secrets: A Service for Managing User-Provided Resource Credential Secrets for Science Gateways},
year = {2022},
isbn = {9781450391610},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3491418.3535177},
doi = {10.1145/3491418.3535177},
booktitle = {Practice and Experience in Advanced Research Computing},
articleno = {40},
numpages = {4},
location = {Boston, MA, USA},
series = {PEARC '22}
}

Acknowledgment

We are thankfull to National Science Foundation(NSF) for funding this project.

We are thankfull to Trusted CI (https://www.trustedci.org/) for conducting the First Principles Vulnerability Assesment(FPVA) (https://dl.acm.org/doi/10.1145/1866835.1866852) for this software and providing the above architecture diagram and security improvements.

airavata-custos's People

Contributors

aarushiibisht avatar abhinav7sinha avatar bhaktinarvekar avatar bkrshubham95 avatar dimuthuupe avatar hasithajayasundara avatar isururanawaka avatar lahirujayathilake avatar machristie avatar smarru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

airavata-custos's Issues

Error while generating Generating Distribution Archives

I am Implementing the first step of Generating Distribution Archives ,

python3 -m pip install --user --upgrade setuptools wheel

I am facing the following error in the following step of installing latest setup tool and wheel versions.

ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

Able to implement the step only after removing ( --user )

Give access to client and realm level logs

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

We need access for client and realm level logs. We are mainly looking for audit logs related to user and agent management functions.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the feature request here.

Configure web origins to support CORs in Keycloak

Description

This client domain should be configured in Keycloak clients to accept CORs.
NOTE: # ( Describe the problem you're encountering. )

Steps to Reproduce

Expected Behaviour

Print client-side warning "The request has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”
NOTE: # ( Tell us what you did and what you expected to happen and what you instead saw. )

Your Environment

  • Custos branch or release version used:
  • Operating system and version:

Additional Context

Provide Custos details and navigation in the README

Write project metadata and detailed documentation in the readme with clear directions for reporting issues, documentation, installation, usage, samples.

In addition, provide details on project governance, contributing and license information.

Incorrect path for get certificate credentials

Get certificate path should be corrected as,

String vaultPath = Constants.VAULT_RESOURCE_SECRETS_PATH + tenantId + "/" + secret.getOwnerId() +
                "/" + Constants.CERTIFICATES + "/" + secret.getId();

Support separated tenant level logging

There should be a way to enable tenant-level logging for each tenant in separated log files.

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is.

Describe the solution you'd like

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the feature request here.

Implement Airavata Sharing Service

Move Airavata Sharing Service (https://github.com/apache/airavata/tree/master/modules/sharing-registry/sharing-registry-server) into Custos
[NOTE]: # ( ^^ Provide a general summary of the request in the title above. ^^ )

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is.

Describe the solution you'd like

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the feature request here.

How to test Agent Management Client

I have a few queries regarding the agent management client:

1. What is an agent?
2. In the agent management client samples, a username and password is used to get a token. Can we obtain some username and password for running our test cases

def register_and_enable():
    agent = {
        "id": "agent-asdasda-ebnmvf",
        "realm_roles": [],
        "attributes": [{
            "key": "agent_cluster_id",
            "values": ["123123131"]
        }]
    }
    id_res = id_client.token(token, username="isjarana", password="Custos1234", grant_type="password")
    response = client.register_and_enable_agent(id_res['access_token'], agent)
    print(response)

register_and_enable()

What credentials can we use for running a similar code in test case?

Support for custom logo on Custos/Keycloak login screen

In cases where a Custos client is not using idphint support (#40) to bypass the Custos/Keycloak login screen, it's nice to be able to customize the login screen with a project logo and other theming. Currently the Custos team can manually configure the Keycloak theme for a tenant, but otherwise I think the logo/theme is not customizable via the Custos tenant management service.

Some possible options for this feature:

  1. The tenant management client API includes a logo_uri parameter that could be used for specifying a logo for the tenant. This is a simple option that wouldn't require a lot of CSS customization, I think.
  2. The tenant management interface could provide a selection of predefined themes to choose from.
  3. The tenant management interface could support upload of CSS/etc. for full theme customization. In my opinion, this option is probably overkill.

How to create a child tenant as the super tenant

I'm not sure if this is a possibility. But, when I'm logged in as a super tenant, is there any way I could create a child tenant below a specified admin tenant.

for admin tenant creation, no authorization header, and for child tenant creations, the authorization header is base64 encoded clientId:secret of the admin tenant. But, when I'm logged in as the super tenant, I technically do not know the secret of admin tenants even though I can retrieve them through a rest API call. I wonder if I really should do that.

I would say if I could pass the parent client id, it could be a better approach while the authorization and tenant type identification could be done through an access token.

Add "display_name" in tenant institution cache methods

Is your feature request related to a problem? Please describe.

Yes. We need to retrieve institution name from the institution cache get response.

Describe the solution you'd like

Can you please add "display_name" for each institution?
Something similar to following

{"institutions": [
  {
   "entity_id": "http://adfs.asu.edu.om/adfs/services/trust",
    "display_name": "A'SHARQIYAH UNIVERSITY"
  }
]}

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the feature request here.

Implement certificate manager using Custos

  • Develop a Cert Renewer Task that will connect to Let’s Encrypt APIs and create certificates, update certificates
  • Created certificates and keys are stored in Custos
  • Client application should be able to fetch certificates from Custos

Custom login page themes for user realms/applications

Is your feature request related to a problem? Please describe.

We want the ability to customize the look and feel of the Keycloak/Custos login page for our realms and applications. While this is possible with Keycloak, it is not possible yet with Custos.

Describe the solution you'd like

Expose the Keycloak theming features through Custos APIs.

Describe alternatives you've considered

N/A.

Additional context

Our app (HTRC Analytics Gateway) is designed to always redirect to an IDP for authentication and now we need to support local accounts (for users who don't have institutional accounts). Our plan is to redirect to Custos for local account authentication and we would like to customize the look and feel of the login page.

Migrate Airavata Credential Store into Custos

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Implement token-based credential retrieval for users.
Implement SSH key generation and retrieval

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the feature request here.

The hierarchy of tenants

Hi @isururanawaka

Is it correct to say there are only three levels for tenants as below

(1) super-tenant
(2) admin-tenant
(3) client-tenant

As of now, I can see that tenants who are in level (3) are not authorized to tenant endpoints. But, for end-users, the logo, tenant name (required), etc. are may be needed to show on the front-end application. Are there separate endpoints authorized and available? Also, those should be able to provide the tenant information by taking the client id (maybe as a parameter or through the token) since that's all the keys available in the frontend unless tenant ids also kept in the frontend config files.

Tenants who are in level (2) are authorized to tenant endpoints. (eg: create and manage tenants)

I doubt the existence and what's going on in the level (1). Are there any use-cases from that for the end-users?

@dinukadesilva

How to retrieve clientId and secret of a tenant after creation

In the new UX designs, the client id and the secret are required to show even later in the system which means not just right after the creation. So, is there an endpoint to retrieve them separately or can those also be merged to the tenant objects?

POST https://custos.scigap.org/apiserver/tenant-management/v1.0.0/oauth2/tenant
{
"client_id": "custos-ax354lwrwacyt5hahhiv-10001504",
"client_secret": "ULjC6OKPk37rQ1FW4Bk1aitA9COVV3KNfL1Qd63o",
"is_activated": true,
"client_id_issued_at": 1618550500000,
"client_secret_expires_at": 0,
"registration_client_uri": "https://custos.scigap.org:32036/tenant-management/v1.0.0/oauth2/tenant?client_id=custos-ax354lwrwacyt5hahhiv-10001504",
"token_endpoint_auth_method": "client_secret_basic",
"msg": "Credentials are activated"
}

CILogon clients scopes are not updated

Description

Steps to Reproduce

Update client scopes and updates are not reflected on CILogon client
NOTE: # ( Include details description or commands to reproduce. )

Expected Behaviour

Your Environment

  • Custos branch or release version used:
  • Operating system and version:

Additional Context

Error while calling update tenant API request

Description

Getting error while executing the following code in update tenant.

"Error occurred at updateTenant INTERNAL: Error occurred during updateTenantjava.lang.RuntimeException: Error creating Realm in Keycloak Server, reason: HTTP 404 Not Found"

client_id = "custos-msc8yfonps763adtp8za-10000425"
response = client.update_tenant(token, client_id,
                                        "Custos Portal",
                                        "[email protected]", "Isuru", "Ranawaka", "[email protected]", "isjarana",
                                        "Custos1234",
                                        self.contacts, self.redirect_uris, "https://custos.scigap.org/",
                                        "openid profile email org.cilogon.userinfo", "domain.org",
                                        "https://custos.scigap.org/", "Custos Portal")

Steps to Reproduce

  1. Create a new admin tenant
    2, Execute get the tenant to verify that the tenant exists
  2. Update the tenant with new data using the client ID returned in create_admin_tenant.
  3. Update tenant API call will throw an error.

Enable manage user accounts via admin console

we have a requirement to access user accounts via admin console. Currently it's possible via keycloak admin console. since you don't recommend to use keycloak interface, we are wondering whether this feature will be available via custos dashboard?

Error while using delete_tenant python API

Description

Getting a "Client ID should not be null" error while trying to delete a client. Even though I just created the client using create_admin_client API
def test_delete_tenant(tenant): response = client.delete_tenant(token, tenant.client_id) print(response)

Steps to Reproduce

def test_delete_tenant(tenant):
    response = client.delete_tenant(token, "custos-al6tf9r1aggetx6nrt1p-10000519")

Error Message

rpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INVALID_ARGUMENT
details = "Error occurred at deleteTenant UNKNOWN: Error while validating method deleteClient Client Id should not be null"
debug_error_string = "{"created":"@1592589585.887821071","description":"Error received from peer ipv4:149.165.168.38:31499","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Error occurred at deleteTenant UNKNOWN: Error while validating method deleteClient Client Id should not be null","grpc_status":3}"

Expected message

message DeleteTenantRequest {
string client_id = 1;
int64 tenant_id = 2;
Credentials credentials = 3;
org.apache.custos.tenant.profile.service.Tenant body = 4;
}

What is the difference between the tenant_id and the client_id?? In the response. after "create_admin_tenant" API is called only the client_id is returned.

Portal admin user should not be able to add empty Permissions

Description

Restrict adding empty permission types.
NOTE: # ( Describe the problem you're encountering. )

Steps to Reproduce

  1. Admin user logs in
  2. Clicks on 'Add Permission Type'
  3. Clicks add without adding text.
  4. Error thrown
  5. vue.runtime.esm.js:1888 Error: Request failed with status code 500
    at t.exports (createError.js:16)
    at t.exports (settle.js:17)
    at XMLHttpRequest.f.onreadystatechange (xhr.js:69)
  6. TO the portal user no error message is displayed, appears to be processing the bad request.
    NOTE: # ( Include details description or commands to reproduce. )

Expected Behaviour

Your Environment

https://demo.gateway.custos.scigap.org/
Screen Shot 2020-10-05 at 9 52 09 PM

  • Custos branch or release version used:
  • Operating system and version:

Additional Context

Provide an API method to get CILogon whitelisted institutions

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

Currently we keep CILogon IDP list locally. We expect to get this list from Custos in future.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the feature request here.

Create API method to get all users

Is your feature request related to a problem? Please describe.

Yes. We need to get all users for stat purpose.

Describe the solution you'd like

API method to get all users

Describe alternatives you've considered

No alternative

Additional context

Support client level roles for agents

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

Currently Custos agent API only supports realm level roles for agents. It would be great if we can add client level roles to agents too. Since in HTRC we mainly work with client level roles.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the feature request here.

Develop a Custos operator using K8 operator pattern

  • Examine existing helm charts
  • Figure out the best strategy to develop Custos operators to deploy those microservices (Helm operator might help)
  • Operators should be able to deploy Custos microservice, do rollouts ..etc
  • Come up with Custom resource types for Custos in Kubernetes

Remove dependency to non-maven central repos

The dependencies to non-maven central repositories should be removed before production, especially removing dependency to milestone repos:

  • spring-milestones
  • [] bintray-lognet-maven

Cleanup credential store and custos client folders

In the develop branch root folder, there is a custos-clients folder in the root directory, is that required or legacy? If any of these are required can they be merged with custos-java-sdk folder?

In the develop branch root folder there is a credential-store directory, is that a legacy one, can it be removed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.