helm-charts
helm-charts copied to clipboard
initial admin/password to random secret
be good to be able to set the initial admin user and password (not password??). The core product does not seem to do this - do you know if his is possible.
Your chart could then be extended to enable a secrets file t generate and hold the pasword/username
I assume you are talking about sftpgo, right?
If so, it's already possible to load initial data, including admin users.
In values, you need to set:
env:
SFTPGO_LOADDATA_FROM: "/etc/sftpgo/loaddata/data.json"
SFTPGO_LOADDATA_MODE: "0"
volumes:
- name: load-data
secret:
secretName: "${load_data}"
volumeMounts:
- name: load-data
mountPath: /etc/sftpgo/loaddata
Then you need to create a configmap/secret that you can mount as a file with the following (or similar) content:
{
"users": [
// LIST OF INITIAL USERS
],
"folders": [],
"admins": [
{
"id": 1,
"status": 1,
"username": "admin",
"password": "BCRYP_HASH",
"email": "",
"permissions": [
"*"
],
"filters": {}
}
],
"version": 8
}
Read the official configuration for more.
@sagikazarmark I just set
config:
data_provider:
create_default_admin: true
in values.ymal can I got a default admin user?
@sagikazarmark I tried your solution, and I don't understand why I still can't connect.
In logs I see my new admin is set:
{"level":"debug","time":"2021-10-19T21:29:31.511","sender":"httpd","message":"adding new admin: {ID:1 Status:1 Username:issif Password:[**redacted**] Email: Permissions:[*] Filters:{AllowList:[]} Description: AdditionalInfo:}, dump file: \"/etc/sftpgo/loaddata/data.json\", error: <nil>"}
But I get an invalid credentials
, whatever I enter (I used bcrypt hash for password).
In logs I have:
{"level":"warn","time":"2021-10-19T21:50:08.591","sender":"dataprovider_sqlite","message":"error authenticating user \"issif\": not found: sql: no rows in result set"}
{"level":"debug","time":"2021-10-19T21:50:08.591","sender":"connection_failed","client_ip":"10.96.218.255","username":"","login_type":"password","protocol":"HTTP","error":"not found: sql: no rows in result set"}
edit:
I tried to create a simple user, and it worked, it's only broken for the admins.
Thanks
😅 I got it. I didn't noticed the connection URL are not same between admin and client, I tried to connect on client page as admin.