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
a8b80e01
Commit
a8b80e01
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
smtp proxy settings in control panel
parent
0136efa9
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-controlpanel
+37
-47
37 additions, 47 deletions
src/freedombone-controlpanel
with
37 additions
and
47 deletions
src/freedombone-controlpanel
+
37
−
47
View file @
a8b80e01
...
...
@@ -64,6 +64,8 @@ do
source
"
$f
"
done
source
"/usr/share/
${
PROJECT_NAME
}
/base/
${
PROJECT_NAME
}
-base-email"
APP_FILES
=
"/usr/share/
${
PROJECT_NAME
}
/apps/
${
PROJECT_NAME
}
-app-*"
for
f
in
$APP_FILES
do
...
...
@@ -87,14 +89,6 @@ MUMBLE_ONION_PORT=8095
SSH_PORT
=
2222
# outgoing SMTP proxy
SMTP_PROXY_ENABLE
=
$'no'
SMTP_PROXY_PROTOCOL
=
'smtps'
SMTP_PROXY_SERVER
=
'mail.myispdomain'
SMTP_PROXY_PORT
=
465
SMTP_PROXY_USERNAME
=
''
SMTP_PROXY_PASSWORD
=
''
WIFI_INTERFACE
=
wlan0
WIFI_SSID
=
WIFI_TYPE
=
'wpa2-psk'
...
...
@@ -112,12 +106,6 @@ read_config_param WIFI_TYPE
read_config_param WIFI_SSID
read_config_param WIFI_PASSPHRASE
read_config_param SSH_PORT
read_config_param SMTP_PROXY_ENABLE
read_config_param SMTP_PROXY_PROTOCOL
read_config_param SMTP_PROXY_SERVER
read_config_param SMTP_PROXY_PORT
read_config_param SMTP_PROXY_USERNAME
read_config_param SMTP_PROXY_PASSWORD
read_config_param USB_DRIVE
read_config_param MY_USERNAME
read_config_param ONION_ONLY
...
...
@@ -1543,20 +1531,35 @@ function email_extra_domains {
function
email_smtp_proxy
{
MUTTRC_FILE
=
/home/
$ADMIN_USER
/.muttrc
if
[
!
-f
$MUTTRC_FILE
]
;
then
return
isp_smtp_domain
=
isp_smtp_port
=
465
isp_smtp_username
=
if
[
-f
/etc/exim4/passwd.client
]
;
then
line_str
=
$(
tail
-n
1 /etc/exim4/passwd.client
)
if
[[
"
$line_str
"
!=
'#'
*
]]
;
then
isp_smtp_domain
=
$(
tail
-n
1 /etc/exim4/passwd.client |
awk
-F
':'
'{print $1}'
)
isp_smtp_username
=
$(
tail
-n
1 /etc/exim4/passwd.client |
awk
-F
':'
'{print $2}'
)
fi
fi
# get the remote SMTP port number
if
[
-f
/etc/exim4/update-exim4.conf.conf
]
;
then
smarthost_str
=
$(
grep
'dc_smarthost='
/etc/exim4/update-exim4.conf.conf
)
if
[[
"
$smarthost_str
"
==
*
'::'
*
]]
;
then
isp_smtp_port
=
$(
echo
"
$smarthost_str
"
|
awk
-F
'::'
'{print $2}'
)
fi
fi
data
=
$(
mktemp
2>/dev/null
)
dialog
--backtitle
$"Freedombone Control Panel"
\
--title
$"SMTP Proxy for
$ADMIN_USER
"
\
--form
$"You may need to proxy outgoing email via your ISP's mail server. If so enter the details below."
14 75 6
\
$"Enable proxy:"
1 1
"
$SMTP_PROXY_ENABLE
"
1 24 5 5
\
$"Protocol (smtp/smtps):"
2 1
"
$SMTP_PROXY_PROTOCOL
"
2 24 5 5
\
$"ISP mail server:"
3 1
"
$SMTP_PROXY_SERVER
"
3 24 40 10000
\
$"Port:"
4 1
"
$SMTP_PROXY_PORT
"
4 24 5 5
\
$"Username:"
5 1
"
$SMTP_PROXY_USERNAME
"
5 24 40 10000
\
$"Password:"
6 1
"
$SMTP_PROXY_PASSWORD
"
6 24 40 10000
\
--title
$"SMTP Proxy"
\
--form
$"You may need to proxy outgoing email via your ISP's mail server. If so enter the details below."
14 75 4
\
$"ISP mail server:"
3 1
"
$SMTP_PROXY_SERVER
"
1 24 40 10000
\
$"Port:"
4 1
"
$SMTP_PROXY_PORT
"
2 24 5 5
\
$"Username:"
5 1
"
$SMTP_PROXY_USERNAME
"
3 24 40 10000
\
$"Password:"
6 1
""
4 24 40 10000
\
2>
"
$data
"
sel
=
$?
case
$sel
in
...
...
@@ -1565,35 +1568,22 @@ function email_smtp_proxy {
255
)
rm
-f
"
$data
"
return
;;
esac
SMTP_PROXY_ENABLE
=
$(
sed
-n
1p <
"
$data
"
)
SMTP_PROXY_PROTOCOL
=
$(
sed
-n
2p <
"
$data
"
)
SMTP_PROXY_SERVER
=
$(
sed
-n
3p <
"
$data
"
)
SMTP_PROXY_PORT
=
$(
sed
-n
4p <
"
$data
"
)
SMTP_PROXY_USERNAME
=
$(
sed
-n
5p <
"
$data
"
)
SMTP_PROXY_PASSWORD
=
$(
sed
-n
6p <
"
$data
"
)
isp_smtp_domain
=
$(
sed
-n
1p <
"
$data
"
)
isp_smtp_port
=
$(
sed
-n
2p <
"
$data
"
)
isp_smtp_username
=
$(
sed
-n
3p <
"
$data
"
)
isp_smtp_password
=
$(
sed
-n
4p <
"
$data
"
)
rm
-f
"
$data
"
email_smtp_proxy_through_isp
"
$isp_smtp_domain
"
"
$isp_smtp_port
"
"
$isp_smtp_username
"
"
$isp_smtp_password
"
# change muttrc
if
[
"
$SMTP_PROXY_ENABLE
"
!=
$'no'
]
;
then
if
!
grep
-q
"set smtp_url"
"
$MUTTRC_FILE
"
;
then
echo
"set smtp_url=
\"
${
SMTP_PROXY_PROTOCOL
}
://
${
SMTP_PROXY_USERNAME
}
:
${
SMTP_PROXY_PASSWORD
}
@
${
SMTP_PROXY_SERVER
}
:
${
SMTP_PROXY_PORT
}
/
\"
"
>>
"
$MUTTRC_FILE
"
else
sed
-i
"s|set smtp_url=.*|set smtp_url=
\"
${
SMTP_PROXY_PROTOCOL
}
://
${
SMTP_PROXY_USERNAME
}
:
${
SMTP_PROXY_PASSWORD
}
@
${
SMTP_PROXY_SERVER
}
:
${
SMTP_PROXY_PORT
}
/
\"
|g"
"
$MUTTRC_FILE
"
fi
sed
-i
's|#set smtp_url|set smtp_url|g'
"
$MUTTRC_FILE
"
else
if
[
-f
$MUTTRC_FILE
]
;
then
if
grep
-q
"set smtp_url"
"
$MUTTRC_FILE
"
;
then
sed
-i
's|set smtp_url|#set smtp_url|g'
"
$MUTTRC_FILE
"
if
!
grep
-q
"#set smtp_url"
"
$MUTTRC_FILE
"
;
then
sed
-i
's|set smtp_url|#set smtp_url|g'
"
$MUTTRC_FILE
"
fi
fi
fi
# save settings within the main configuration file
write_config_param
"SMTP_PROXY_ENABLE"
"
$SMTP_PROXY_ENABLE
"
write_config_param
"SMTP_PROXY_PROTOCOL"
"
$SMTP_PROXY_PROTOCOL
"
write_config_param
"SMTP_PROXY_SERVER"
"
$SMTP_PROXY_SERVER
"
write_config_param
"SMTP_PROXY_PORT"
"
$SMTP_PROXY_PORT
"
write_config_param
"SMTP_PROXY_USERNAME"
"
$SMTP_PROXY_USERNAME
"
write_config_param
"SMTP_PROXY_PASSWORD"
"
$SMTP_PROXY_PASSWORD
"
}
function
menu_backup_restore
{
...
...
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