A secure credential storage system built with Flask and PostgreSQL, featuring role-based access control (RBAC) and Azure integration.
- Secure credential storage with encryption
- Role-based access control (RBAC)
- Azure AD OAuth authentication
- Azure Key Vault integration for secure key management
- Credential sharing capabilities
- User and role management
- Docker and Kubernetes deployment support
- Python 3.11+
- PostgreSQL
- Docker and Docker Compose
- Azure subscription with:
- Azure AD application registration
- Azure Key Vault
- Azure Container Registry (for deployment)
- Clone the repository:
git clone https://github.com/yourusername/securevault.git
cd securevault- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
Create a
.envfile with the following variables:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/securevault
SECRET_KEY=your-secret-key
AZURE_KEY_VAULT_URL=https://your-keyvault.vault.azure.net/
AZURE_TENANT_ID=your-tenant-id
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
- Initialize the database:
flask db init
flask db migrate
flask db upgrade- Run the development server:
flask run- Build and start the containers:
docker-compose up --build- Initialize the database:
docker-compose exec web flask db init
docker-compose exec web flask db migrate
docker-compose exec web flask db upgrade- Build and push the Docker image:
docker build -t yourregistry.azurecr.io/securevault:latest .
docker push yourregistry.azurecr.io/securevault:latest- Deploy to Azure Kubernetes Service (AKS):
kubectl apply -f k8s/- All credentials are encrypted using Fernet symmetric encryption
- Encryption keys are stored in Azure Key Vault
- Role-based access control for user management
- Azure AD OAuth authentication
- Secure credential sharing with access control
- Password hashing using Werkzeug's security functions
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Copy
k8s/secrets.yaml.exampletok8s/secrets.yaml - Generate base64 encoded values for your secrets:
# Example for database URL
echo -n "postgresql://user:password@localhost:5432/securevault" | base64
# Example for secret key
echo -n "your-secret-key" | base64- Replace the placeholder values in
k8s/secrets.yamlwith your encoded secrets
- Create a Kubernetes secret in your cluster:
kubectl create secret generic securevault-secrets \
--from-literal=database-url='your-database-url' \
--from-literal=secret-key='your-secret-key' \
--from-literal=azure-keyvault-url='your-keyvault-url' \
--from-literal=azure-tenant-id='your-tenant-id' \
--from-literal=azure-client-id='your-client-id' \
--from-literal=azure-client-secret='your-client-secret'- Verify the secret was created:
kubectl get secret securevault-secrets -o yaml- Never commit
k8s/secrets.yamlto version control - Use different secrets for development and production
- Rotate secrets regularly
- Use Azure Key Vault for production secrets management
- Consider using a secrets management solution like HashiCorp Vault or Azure Key Vault