-
Notifications
You must be signed in to change notification settings - Fork 196
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
[Feature Request]: Authentication persistence in a containerized environment. #201
Comments
Hello, One possible solution is to set CARBONE_EE_WORKDIR variable to /data (for example) and configure only one persistent storage for /data. Does this solve this problem? |
Thanks, looks like it will solve all issues, somehow I missed the CARBONE_EE_WORKDIR option. |
Btw, the
P.S. The JWT token I generated programmatically using the provided key works fine. |
Oh. In the meantime, you can generate the token from /data : cd /data |
Hello, We now recommand to manage key outside Carbone. This is new documentation extract from https://carbone.io : Carbone key generationWhen running Carbone for the first time, if no keys are present, Carbone automatically generate a key pair (key.pem and key.pub) in /app/config/. To simplify migration and architecture issues, we strongly recommend that you generate your own keys and make them available to Carbone. To do this, you must first generate a private key with the following command: openssl ecparam -genkey -name secp521r1 -noout -out key.pem Then the corresponding public key : openssl ec -in key.pem -pubout -out key.pub Launching Carbone with your keyAs with license provisioning, we recommend using a docker secret to map the public key to the container's config directory. Here's an example using docker compose (file docker-compose.yml) :
Generating JWT tokens for API useCarbone uses standard ES512 JWT tokens. You must then generate a token and sign it with your private key. The JWT token must contain the following information. {
"alg" : "ES512",
"typ" : "JWT"
} Payload {
"iss" : "carbone-user",
"aud" : "carbone-ee",
"exp" : xxxxx // timestamp en sec
} Numerous solutions exist, but we suggest you use https://github.com/smallstep/cli After installation, you just need to run the following command to generate one JWT token : current_time=$(date +%s)
expiration_time=$(($current_time + 864000)) # Ten days from now for ex
step crypto jwt sign --alg ES512 --iss=carbone-user --subtle --aud=carbone-ee --exp=$expiration_time --key=key.pem Et voilà ! |
Problem to solve
On a containerized environment running the carbone-ee container, neither the generated token
/carbone-ee-linux generate-token
nor the signing keys are stored in persistent storage and are lost each time the container is restarted. This brings a lot of problems because of the overhead of tracking container restarts and managing authentication keys.Proposed solution
Please add the ability to configure a signing key or JWT token via environment variables that can be easily passed to the running container.
Describe alternatives you've considered
Another alternative is to mount some directory to the persistent volume, but it will bring the number of required persistent storage volumes to 3 (in addition to
app/render
andapp/template
), which is too high, because on some environments (for example Azure AKS) the node VMs have a limited number of attachable disks. If a node has only 4 disk slots and one is already taken by the OS, there are only 3 slots left for all the pods to attach a persistent volume, and if all of them are used by Carbone, it's too luxurious. That's the real case I solved today.The text was updated successfully, but these errors were encountered: