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
ef0b5366
Commit
ef0b5366
authored
8 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Hash etherpad passwords
parent
dffea8f5
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-etherpad
+13
-8
13 additions, 8 deletions
src/freedombone-app-etherpad
with
13 additions
and
8 deletions
src/freedombone-app-etherpad
+
13
−
8
View file @
ef0b5366
...
...
@@ -53,20 +53,24 @@ etherpad_variables=(ETHERPAD_COMMIT
DDNS_PROVIDER
MY_USERNAME
)
function
etherpad_password_hash
{
echo
$(
python
-c
"from passlib.hash import bcrypt;print(bcrypt.encrypt(
\"
$1
\"
, rounds=10))"
)
}
function
change_password_etherpad
{
change_username
=
"
$1
"
new_user_password
=
"
$2
"
new_user_password
=
$(
etherpad_password_hash
"
$2
"
)
read_config_param ETHERPAD_DOMAIN_NAME
if
grep
"
\"
$change_username
\"
: {"
/var/www/
${
ETHERPAD_DOMAIN_NAME
}
/htdocs/settings.json
;
then
user_line
=
$(
cat
/var/www/
${
ETHERPAD_DOMAIN_NAME
}
/htdocs/settings.json |
grep
"
\"
$change_username
\"
: {"
)
if
[[
"
$user_line
"
==
*
"
\"
is_admin
\"
: true"
*
]]
;
then
sed
-i
"s|
\"
$change_username
\"
: {.*|
\"
$change_username
\"
: {
\"
p
as
sword
\"
:
\"
$new_user_password
\"
,
\"
is_admin
\"
: true }|g"
/var/www/
${
ETHERPAD_DOMAIN_NAME
}
/htdocs/settings.json
sed
-i
"s|
\"
$change_username
\"
: {.*|
\"
$change_username
\"
: {
\"
h
as
h
\"
:
\"
$new_user_password
\"
,
\"
is_admin
\"
: true }|g"
/var/www/
${
ETHERPAD_DOMAIN_NAME
}
/htdocs/settings.json
else
sed
-i
"s|
\"
$change_username
\"
: {.*|
\"
$change_username
\"
: {
\"
p
as
sword
\"
:
\"
$new_user_password
\"
,
\"
is_admin
\"
: false },|g"
/var/www/
${
ETHERPAD_DOMAIN_NAME
}
/htdocs/settings.json
sed
-i
"s|
\"
$change_username
\"
: {.*|
\"
$change_username
\"
: {
\"
h
as
h
\"
:
\"
$new_user_password
\"
,
\"
is_admin
\"
: false },|g"
/var/www/
${
ETHERPAD_DOMAIN_NAME
}
/htdocs/settings.json
fi
${
PROJECT_NAME
}
-pass
-u
$change_username
-a
etherpad
-p
"
$
new_user_password
"
${
PROJECT_NAME
}
-pass
-u
$change_username
-a
etherpad
-p
"
$
2
"
systemctl restart etherpad
fi
}
...
...
@@ -146,7 +150,7 @@ function create_etherpad_settings {
echo
' "disableIPlogging" : true,'
>>
$settings_file
echo
' "users": {'
>>
$settings_file
echo
"
\"
${
MY_USERNAME
}
\"
: {
\"
password
\"
:
\
"
${
ETHERPAD_ADMIN_PASSWORD
}
\"
,
\"
is_admin
\"
: true }"
>>
$settings_file
echo
"
\"
${
MY_USERNAME
}
\"
: {
\"
hash
\"
:
\"
$(
etherpad_
password
_hash
"
${
ETHERPAD_ADMIN_PASSWORD
}
"
)
\"
,
\"
is_admin
\"
: true }"
>>
$settings_file
echo
' },'
>>
$settings_file
echo
' "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],'
>>
$settings_file
...
...
@@ -187,12 +191,12 @@ function remove_user_etherpad {
function
add_user_etherpad
{
new_username
=
"
$1
"
new_user_password
=
"
$2
"
new_user_password
=
$(
etherpad_password_hash
"
$2
"
)
settings_file
=
/var/www/
${
ETHERPAD_DOMAIN_NAME
}
/htdocs/settings.json
if
!
grep
-q
"
\"
$new_username
\"
: {"
$settings_file
;
then
${
PROJECT_NAME
}
-pass
-u
$new_username
-a
etherpad
-p
"
$new_user_password
"
sed
-i
"/
\"
users
\"
: {/a
\"
$new_username
\"
: {
\"
p
as
sword
\"
:
\"
$new_user_password
\"
,
\"
is_admin
\"
: false },"
$settings_file
sed
-i
"/
\"
users
\"
: {/a
\"
$new_username
\"
: {
\"
h
as
h
\"
:
\"
$new_user_password
\"
,
\"
is_admin
\"
: false },"
$settings_file
if
grep
-q
"
\"
$new_username
\"
: {"
$settings_file
;
then
systemctl restart etherpad
else
...
...
@@ -458,7 +462,8 @@ function install_etherpad {
repair_databases_script
apt-get
-yq
install gzip
git curl python libssl-dev pkg-config
\
build-essential python g++ make checkinstall
build-essential python g++ make checkinstall
\
python-bcrypt python-passlib
function_check install_nodejs
install_nodejs etherpad
...
...
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