Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
534ba7f5
Commit
534ba7f5
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Changing matrix password
parent
46b9449b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-app-matrix
+41
-2
41 additions, 2 deletions
src/freedombone-app-matrix
with
41 additions
and
2 deletions
src/freedombone-app-matrix
+
41
−
2
View file @
534ba7f5
...
...
@@ -480,11 +480,50 @@ function install_interactive_matrix {
APP_INSTALLED
=
1
}
function
create_matrix_user_password_script
{
read_config_param ONION_ONLY
read_config_param MY_USERNAME
read_config_param MATRIX_DOMAIN_NAME
curl_command
=
'curl'
homebase
=
"https://
$MATRIX_DOMAIN_NAME
"
if
[[
"
$ONION_ONLY
"
!=
'no'
]]
;
then
curl_command
=
'torsocks curl'
homebase
=
"http://
$(
cat
/var/lib/tor/hidden_service_matrix/hostname
)
"
fi
matrix_passwd_filename
=
/usr/bin/matrix-passwd
{
echo
'#!/bin/bash'
;
echo
"cd
$MATRIX_DATA_DIR
|| exit 1"
;
echo
"username=
\$
1"
;
echo
"if [ !
\"\$
username
\"
]; then"
;
echo
' echo "No username given"'
;
echo
' exit 1'
;
echo
'fi'
;
echo
"new_password=
\$
2"
;
echo
"if [ !
\"\$
new_password
\"
]; then"
;
echo
' echo "No password given"'
;
echo
' exit 2'
;
echo
'fi'
;
echo
"ADMIN=
\"
@
${
MY_USERNAME
}
:
$MATRIX_DOMAIN_NAME
\"
"
;
echo
'BUSY="pragma busy_timeout=20000"'
;
echo
"BUFFER=
\$
(sqlite3 homeserver.db
\"\$
BUSY;select token from access_tokens where user_id like '
\$
ADMIN' order by id desc limit 1;
\"
)"
;
echo
"TOKEN=
\$
(echo
\$
BUFFER|awk '{print
\$
2}')"
;
echo
'set -x'
;
echo
"
${
curl_command
}
-X POST
\"
${
homebase
}
/_matrix/client/r0/admin/reset_password/%40
\$
username%3A
$MATRIX_DOMAIN_NAME
?access_token=
\$
TOKEN
\"
--data '{
\"
new_password
\"
:
\"\$
new_password
\"
}'"
;
}
>
$matrix_passwd_filename
chmod
+x
$matrix_passwd_filename
}
function
change_password_matrix
{
#
curr_username="$1"
curr_username
=
"
$1
"
new_user_password
=
"
$2
"
#${PROJECT_NAME}-pass -u "$curr_username" -a matrix -p "$new_user_password"
create_matrix_user_password_script
/usr/bin/matrix-passwd
"
$curr_username
"
"
$new_user_password
"
"
${
PROJECT_NAME
}
-pass"
-u
"
$curr_username
"
-a
matrix
-p
"
$new_user_password
"
}
function
reconfigure_matrix
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment