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

Use COZY_ADMIN_PASSPHRASE for every commands #4232

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ passphrase if needed.
if !bytes.Equal(pass1, pass2) {
return fmt.Errorf("Passphrase missmatch")
}
if len(pass1) == 0 {
return fmt.Errorf("Empty password is forbidden")
}

passphrase = pass1
}
Expand Down
5 changes: 4 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ func newClient(domain string, scopes ...string) *client.Client {
}

func newAdminClient() *client.AdminClient {
pass := []byte(os.Getenv("COZY_ADMIN_PASSWORD"))
pass := []byte(os.Getenv("COZY_ADMIN_PASSPHRASE"))
if len(pass) == 0 {
pass = []byte(os.Getenv("COZY_ADMIN_PASSWORD"))
}
if !build.IsDevRelease() {
if len(pass) == 0 {
var err error
Expand Down
2 changes: 1 addition & 1 deletion debian/uninstall-onboarding.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
export COZY_ADMIN_PASSWORD="$(cat /etc/cozy/.cozy-admin-passphrase)"
export COZY_ADMIN_PASSPHRASE="$(cat /etc/cozy/.cozy-admin-passphrase)"

function app_installed {
DOMAIN="${1}"
Expand Down
4 changes: 2 additions & 2 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ generate this file, you can use the `cozy-stack config passwd [filepath]`
command. This command will ask you for a passphrase and will create the
`cozy-admin-passphrase` at the specified path.

You can use the `COZY_ADMIN_PASSWORD` env variable if you do not want to type
the passphrase each time you call `cozy-stack`.
You can use the `COZY_ADMIN_PASSPHRASE` (or `COZY_ADMIN_PASSWORD`) env variable
if you do not want to type the passphrase each time you call `cozy-stack`.

### Example

Expand Down
Loading