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
b62ccfd3
Commit
b62ccfd3
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Tidying
parent
608d84fd
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-xmpp
+63
-88
63 additions, 88 deletions
src/freedombone-app-xmpp
with
63 additions
and
88 deletions
src/freedombone-app-xmpp
+
63
−
88
View file @
b62ccfd3
...
...
@@ -80,6 +80,66 @@ xmpp_variables=(ONION_ONLY
DEFAULT_DOMAIN_NAME
XMPP_DOMAIN_CODE
)
function
prosody_remove_module_from_config
{
remove_prosody_module_name
=
"
$1
"
prosody_config_file
=
"
$2
"
if
[
!
"
${
remove_prosody_module_name
}
"
]
;
then
return
fi
if
[
!
-f
"
${
prosody_config_file
}
"
]
;
then
echo
"Config file
${
prosody_config_file
}
not found when removing module
$remove_prosody_module_name
"
return
fi
if
grep
-q
"
\"
${
remove_prosody_module_name
}
\"
"
"
${
prosody_config_file
}
"
;
then
sed
-i
"/
\"
${
remove_prosody_module_name
}
\"
/d"
"
${
prosody_config_file
}
"
xmpp_restart
=
1
fi
}
function
prosody_remove_module
{
remove_prosody_module_name
=
"
$1
"
prosody_remove_module_from_config
"
${
remove_prosody_module_name
}
"
/etc/prosody/prosody.cfg.lua
prosody_remove_module_from_config
"
${
remove_prosody_module_name
}
"
/etc/prosody/conf.avail/xmpp.cfg.lua
}
function
prosody_add_module_to_config
{
new_prosody_module_name
=
"
$1
"
prosody_config_file
=
"
$2
"
add_to_muc
=
"
$3
"
if
[
!
"
${
new_prosody_module_name
}
"
]
;
then
return
fi
if
[
!
-f
"
${
prosody_config_file
}
"
]
;
then
echo
"Config file
${
prosody_config_file
}
not found when adding module
$new_prosody_module_name
"
return
fi
if
!
grep
-q
"
\"
${
new_prosody_module_name
}
\"
"
"
$prosody_config_file
"
;
then
sed
-i
"/
\"
pep
\"
/a
\"
${
new_prosody_module_name
}
\"
;"
"
$prosody_config_file
"
if
[
"
$add_to_muc
"
]
;
then
if
grep
-q
"
\"
muc_limits
\"
"
"
$prosody_config_file
"
;
then
sed
-i
"/
\"
muc_limits
\"
/a
\"
${
new_prosody_module_name
}
\"
;"
"
$prosody_config_file
"
fi
fi
sed
-i
"s|
\"
${
new_prosody_module_name
}
\"
|
\"
${
new_prosody_module_name
}
\"
|g"
"
$prosody_config_file
"
xmpp_restart
=
1
fi
}
function
prosody_add_module
{
new_prosody_module_name
=
"
$1
"
add_to_muc
=
"
$2
"
prosody_add_module_to_config
"
${
new_prosody_module_name
}
"
/etc/prosody/prosody.cfg.lua
"
$add_to_muc
"
prosody_add_module_to_config
"
${
new_prosody_module_name
}
"
/etc/prosody/conf.avail/xmpp.cfg.lua
"
$add_to_muc
"
}
function
xmpp_fix_exists
{
if
!
grep
-q
"CREATE INDEX IF NOT EXISTS"
plugins/mod_storage_sql1.lua
;
then
sed
-i
's|CREATE INDEX|CREATE INDEX IF NOT EXISTS|g'
plugins/mod_storage_sql1.lua
...
...
@@ -552,32 +612,9 @@ function update_prosody_modules {
fi
fi
if
!
grep
-q
"s2s_blacklist"
/etc/prosody/conf.avail/xmpp.cfg.lua
;
then
sed
-i
'/"pep";/a "s2s_blacklist"; -- Block bad domains'
/etc/prosody/conf.avail/xmpp.cfg.lua
sed
-i
's|"s2s_blacklist";| "s2s_blacklist";|g'
/etc/prosody/conf.avail/xmpp.cfg.lua
xmpp_restart
=
1
fi
if
!
grep
-q
"
\"
firewall
\"
"
/etc/prosody/conf.avail/xmpp.cfg.lua
;
then
sed
-i
'/"pep";/a "firewall"; -- Block addresses'
/etc/prosody/conf.avail/xmpp.cfg.lua
sed
-i
's|"firewall";| "firewall";|g'
/etc/prosody/conf.avail/xmpp.cfg.lua
xmpp_restart
=
1
fi
if
!
grep
-q
"s2s_blacklist"
/etc/prosody/prosody.cfg.lua
;
then
sed
-i
'/"pep";/a "s2s_blacklist"; -- Block bad domains'
/etc/prosody/prosody.cfg.lua
sed
-i
's|"s2s_blacklist";| "s2s_blacklist";|g'
/etc/prosody/prosody.cfg.lua
xmpp_restart
=
1
fi
if
!
grep
-q
"s2s_blacklist"
/etc/prosody/prosody.cfg.lua
;
then
sed
-i
'/"pep";/a "s2s_blacklist"; -- Block bad domains'
/etc/prosody/prosody.cfg.lua
sed
-i
'/"muc_limits";/a "s2s_blacklist";'
/etc/prosody/prosody.cfg.lua
sed
-i
's|"s2s_blacklist";| "s2s_blacklist";|g'
/etc/prosody/prosody.cfg.lua
xmpp_restart
=
1
fi
if
!
grep
-q
"
\"
firewall
\"
"
/etc/prosody/prosody.cfg.lua
;
then
sed
-i
'/"pep";/a "firewall"; -- Block addresses'
/etc/prosody/prosody.cfg.lua
sed
-i
's|"firewall";| "firewall";|g'
/etc/prosody/prosody.cfg.lua
xmpp_restart
=
1
fi
prosody_add_module
's2s_blacklist'
muc
prosody_add_module
'firewall'
prosody_add_module
'block_strangers'
xmpp_server_blacklist /etc/prosody/prosody.cfg.lua
...
...
@@ -585,17 +622,6 @@ function update_prosody_modules {
sed
-i
'/"mam_muc";/d'
/etc/prosody/prosody.cfg.lua
xmpp_restart
=
1
fi
if
!
grep
-q
"block_strangers"
/etc/prosody/conf.avail/xmpp.cfg.lua
;
then
sed
-i
'/"pep";/a "block_strangers"; -- Dont allow messages from strangers'
/etc/prosody/conf.avail/xmpp.cfg.lua
sed
-i
's|"block_strangers";| "block_strangers";|g'
/etc/prosody/conf.avail/xmpp.cfg.lua
xmpp_restart
=
1
fi
if
!
grep
-q
"block_strangers"
/etc/prosody/prosody.cfg.lua
;
then
sed
-i
'/"pep";/a "block_strangers"; -- Dont allow messages from strangers'
/etc/prosody/prosody.cfg.lua
sed
-i
's|"block_strangers";| "block_strangers";|g'
/etc/prosody/prosody.cfg.lua
xmpp_restart
=
1
fi
}
function
prosody_daemon_restart_script
{
...
...
@@ -658,57 +684,6 @@ function upgrade_xmppsend {
}
function
prosody_remove_module_from_config
{
remove_prosody_module_name
=
"
$1
"
prosody_config_file
=
"
$2
"
if
[
!
"
${
remove_prosody_module_name
}
"
]
;
then
return
fi
if
[
!
-f
"
${
prosody_config_file
}
"
]
;
then
echo
"Config file
${
prosody_config_file
}
not found when removing module
$remove_prosody_module_name
"
return
fi
if
grep
-q
"
\"
${
remove_prosody_module_name
}
\"
"
"
${
prosody_config_file
}
"
;
then
sed
-i
"/
\"
${
remove_prosody_module_name
}
\"
/d"
"
${
prosody_config_file
}
"
xmpp_restart
=
1
fi
}
function
prosody_remove_module
{
remove_prosody_module_name
=
"
$1
"
prosody_remove_module_from_config
"
${
remove_prosody_module_name
}
"
/etc/prosody/prosody.cfg.lua
prosody_remove_module_from_config
"
${
remove_prosody_module_name
}
"
/etc/prosody/conf.avail/xmpp.cfg.lua
}
function
prosody_add_module_to_config
{
new_prosody_module_name
=
"
$1
"
prosody_config_file
=
"
$2
"
if
[
!
"
${
new_prosody_module_name
}
"
]
;
then
return
fi
if
[
!
-f
"
${
prosody_config_file
}
"
]
;
then
echo
"Config file
${
prosody_config_file
}
not found when adding module
$new_prosody_module_name
"
return
fi
if
!
grep
-q
"
\"
${
new_prosody_module_name
}
\"
"
"
$prosody_config_file
"
;
then
sed
-i
"/
\"
pep
\"
/a
\"
${
new_prosody_module_name
}
\"
;"
"
$prosody_config_file
"
sed
-i
"s|
\"
${
new_prosody_module_name
}
\"
|
\"
${
new_prosody_module_name
}
\"
|g"
"
$prosody_config_file
"
xmpp_restart
=
1
fi
}
function
prosody_add_module
{
new_prosody_module_name
=
"
$1
"
prosody_add_module_to_config
"
${
new_prosody_module_name
}
"
/etc/prosody/prosody.cfg.lua
prosody_add_module_to_config
"
${
new_prosody_module_name
}
"
/etc/prosody/conf.avail/xmpp.cfg.lua
}
function
upgrade_xmpp
{
xmpp_restart
=
...
...
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