Bugzilla – Attachment 109617 Details for
Bug 26290
Add the ability to set a default SMTP server in koha-conf.xml
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26290: Add option forsetting default SMTP parameters in koha-conf.xml
Bug-26290-Add-option-forsetting-default-SMTP-param.patch (text/plain), 9.10 KB, created by
Kyle M Hall (khall)
on 2020-09-03 11:15:46 UTC
(
hide
)
Description:
Bug 26290: Add option forsetting default SMTP parameters in koha-conf.xml
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-09-03 11:15:46 UTC
Size:
9.10 KB
patch
obsolete
>From 477145f5cb0a419793ea33440fb91de8849aecba Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 24 Aug 2020 16:19:44 -0300 >Subject: [PATCH] Bug 26290: Add option forsetting default SMTP parameters in > koha-conf.xml > >This patch adds an entry to koha-conf.xml for setting a default SMTP >server config. 'koha-create' gets option switches for all options. > >To test: >1. Use the tweaked script to crete a new instance >2. Notice it contains entries for smtp_server and they respect your > options. >3. If you don't choose any option, it sets the current default. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > debian/docs/koha-create.xml | 56 ++++++++++++++++++ > debian/scripts/koha-create | 78 +++++++++++++++++++++++++- > debian/templates/koha-conf-site.xml.in | 10 ++++ > etc/koha-conf.xml | 10 ++++ > 4 files changed, 153 insertions(+), 1 deletion(-) > >diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml >index 44758e5eae..f86038a9c8 100644 >--- a/debian/docs/koha-create.xml >+++ b/debian/docs/koha-create.xml >@@ -43,6 +43,13 @@ > <arg><option>--upload-path</option> directory</arg> > <arg><option>--tmp-path</option> directory</arg> > <arg><option>--letsencrypt</option></arg> >+ <arg><option>--smtp-host</option> host</arg> >+ <arg><option>--smtp-port</option> port</arg> >+ <arg><option>--smtp-timeout</option> n</arg> >+ <arg><option>--smtp-ssl-mode</option> disabled|ssl|starttls</arg> >+ <arg><option>--smtp-user-name</option> user</arg> >+ <arg><option>--smtp-password</option> pass</arg> >+ <arg><option>--smtp-debug</option></arg> > <arg><option>--help</option>|<option>-h</option></arg> > > <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg> >@@ -209,6 +216,55 @@ > </listitem> > </varlistentry> > >+ <varlistentry> >+ <term><option>--smtp-host</option></term> >+ <listitem> >+ <para>Specify the SMTP server <option>hostname</option>. (default: localhost)</para> >+ </listitem> >+ </varlistentry> >+ >+ <varlistentry> >+ <term><option>--smtp-port</option></term> >+ <listitem> >+ <para>Specify the SMTP server <option>port</option>. (default: 25)</para> >+ </listitem> >+ </varlistentry> >+ >+ <varlistentry> >+ <term><option>--smtp-timeout</option></term> >+ <listitem> >+ <para>Timeout for outbound SMTP connections. (default: 120)</para> >+ </listitem> >+ </varlistentry> >+ >+ <varlistentry> >+ <term><option>--smtp-ssl-mode</option></term> >+ <listitem> >+ <para>Set the SSL mode. Options are <option>disabled</option> (default), <option>ssl</option> and <option>starttls</option>.</para> >+ </listitem> >+ </varlistentry> >+ >+ <varlistentry> >+ <term><option>--smtp-user-name</option></term> >+ <listitem> >+ <para>Specify the user name to use for SMTP. (default: empty)</para> >+ </listitem> >+ </varlistentry> >+ >+ <varlistentry> >+ <term><option>--smtp-password</option></term> >+ <listitem> >+ <para>Specify the password for SMTP. (default: empty)</para> >+ </listitem> >+ </varlistentry> >+ >+ <varlistentry> >+ <term><option>--smtp-debug</option></term> >+ <listitem> >+ <para>Enable debug mode.</para> >+ </listitem> >+ </varlistentry> >+ > <varlistentry> > <term><option>--help</option>,<option>-h</option></term> > <listitem> >diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create >index 390879f37f..2260c31ee7 100755 >--- a/debian/scripts/koha-create >+++ b/debian/scripts/koha-create >@@ -76,6 +76,13 @@ Options: > --tmp-path dir Set a user defined tmp_path. It defaults to > /var/lib/koha/<instance>/tmp > --letsencrypt Set up a https-only site with letsencrypt certificates >+ --smtp-host host SMTP host name >+ --smtp-port NN SMTP port >+ --smtp-timeout NN Connection timeout in seconds >+ --smtp-ssl-mode mode SSL mode. Options are 'disabled' (default), 'ssl' and 'starttls'. >+ --smtp-user-name user User name to be used on SMTP auth >+ --smtp-password pass Password to authenticate SMTP >+ --smtp-debug Enable debug mode for SMTP > --help,-h Show this help. > > Note: the instance name cannot be longer that 11 chars. >@@ -118,6 +125,13 @@ generate_config_file() { > -e "s/__PLUGINS_DIR__/\/var\/lib\/koha\/$name\/plugins/g" \ > -e "s/__MEMCACHED_NAMESPACE__/$MEMCACHED_NAMESPACE/g" \ > -e "s/__MEMCACHED_SERVERS__/$MEMCACHED_SERVERS/g" \ >+ -e "s/__SMTP_HOST__/$SMTP_HOST/g" \ >+ -e "s/__SMTP_PORT__/$SMTP_PORT/g" \ >+ -e "s/__SMTP_TIMEOUT__/$SMTP_TIMEOUT/g" \ >+ -e "s/__SMTP_SSL_MODE__/$SMTP_SSL_MODE/g" \ >+ -e "s/__SMTP_USER_NAME__/$SMTP_USER_NAME/g" \ >+ -e "s/__SMTP_PASSWORD__/$SMTP_PASSWORD/g" \ >+ -e "s/__SMTP_DEBUG__/$SMTP_DEBUG/g" \ > "/etc/koha/$1" > "$2" > > } >@@ -244,6 +258,37 @@ set_memcached() > > } > >+set_smtp() >+{ >+ if [ "$CLO_SMTP_HOST" != "" ]; then >+ SMTP_HOST=$CLO_SMTP_HOST >+ fi >+ >+ if [ "$CLO_SMTP_PORT" != "" ]; then >+ SMTP_PORT=$CLO_SMTP_PORT >+ fi >+ >+ if [ "$CLO_SMTP_TIMEOUT" != "" ]; then >+ SMTP_TIMEOUT=$CLO_SMTP_TIMEOUT >+ fi >+ >+ if [ "$CLO_SMTP_SSL_MODE" != "" ]; then >+ SMTP_SSL_MODE=$CLO_SMTP_SSL_MODE >+ fi >+ >+ if [ "$CLO_SMTP_USER_NAME" != "" ]; then >+ SMTP_USER_NAME=$CLO_SMTP_USER_NAME >+ fi >+ >+ if [ "$CLO_SMTP_PASSWORD" != "" ]; then >+ SMTP_PASSWORD=$CLO_SMTP_PASSWORD >+ fi >+ >+ if [ "$CLO_SMTP_DEBUG" != "" ]; then >+ SMTP_DEBUG=$CLO_SMTP_DEBUG >+ fi >+} >+ > set_upload_path() > { > local instance="$1" >@@ -341,6 +386,15 @@ ZEBRA_LANGUAGE="en" > ADMINUSER="1" > PASSWDFILE="/etc/koha/passwd" > >+# SMTP config >+SMTP_HOST="localhost" >+SMTP_PORT="25" >+SMTP_TIMEOUT="120" >+SMTP_SSL_MODE="disabled" >+SMTP_USER_NAME="" >+SMTP_PASSWORD="" >+SMTP_DEBUG="0" >+ > # memcached variables > USE_MEMCACHED="yes" > MEMCACHED_SERVERS="" >@@ -380,7 +434,7 @@ fi > > [ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) > >-TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,elasticsearch-server:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \ >+TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,elasticsearch-server:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,smtp-host:,smtp-port,smtp-timeout:,smtp-ssl-mode:smtp-user-name:,smtp-password:,smtp-debug,letsencrypt, \ > -n "$0" -- "$@"` > > # Note the quotes around `$TEMP': they are essential! >@@ -399,6 +453,13 @@ CLO_TMP_PATH="" > CLO_LETSENCRYPT="" > CLO_TEMPLATE_CACHE_DIR="" > CLO_TIMEZONE="" >+CLO_SMTP_HOST="" >+CLO_SMTP_PORT="" >+CLO_SMTP_TIMEOUT="" >+CLO_SMTP_SSL_MODE="" >+CLO_SMTP_USER_NAME="" >+CLO_SMTP_PASSWORD="" >+CLO_SMTP_DEBUG="" > > while true ; do > case "$1" in >@@ -434,6 +495,20 @@ while true ; do > CLO_ADMINUSER="$2" ; shift 2 ;; > --enable-sru) > ENABLE_SRU="yes" ; shift ;; >+ --smtp-debug) >+ CLO_SMTP_DEBUG="1" ; shift ;; >+ --smtp-host) >+ CLO_SMTP_HOST="$2" ; shift 2 ;; >+ --smtp-port) >+ CLO_SMTP_PORT="$2" ; shift 2 ;; >+ --smtp-timeout) >+ CLO_SMTP_TIMEOUT="$2" ; shift 2 ;; >+ --smtp-ssl-mode) >+ CLO_SMTP_SSL_MODE="$2" ; shift 2 ;; >+ --smtp-user-name) >+ CLO_SMTP_USER_NAME="$2" ; shift 2 ;; >+ --smtp-password) >+ CLO_SMTP_PASSWORD="$2" ; shift 2 ;; > --sru-port) > SRU_SERVER_PORT="$2" ; shift 2 ;; > --template-cache-dir) >@@ -507,6 +582,7 @@ fi > > name="$1" > >+set_smtp > set_upload_path $name > set_tmp_path $name > >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index b02204d85c..2fa15ca8f5 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -440,5 +440,15 @@ __END_SRU_PUBLICSERVER__ > --> > </koha_xslt_security> > >+ <smtp_server> >+ <host>__SMTP_HOST__</host> >+ <port>__SMTP_PORT__</port> >+ <timeout>__SMTP_TIMEOUT__</timeout> >+ <ssl_mode>__SMTP_SSL_MODE__</ssl_mode> >+ <user_name>__SMTP_USER_NAME__</user_name> >+ <password>__SMTP_PASSWORD__</password> >+ <debug>__SMTP_DEBUG__</debug> >+ </smtp_server> >+ > </config> > </yazgfs> >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index 7c0bc68e42..54fbbdab08 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -260,5 +260,15 @@ __PAZPAR2_TOGGLE_XML_POST__ > --> > </koha_xslt_security> > >+ <smtp_server> >+ <host>localhost</host> >+ <port>25</port> >+ <timeout>120</timeout> >+ <ssl_mode>disabled</ssl_mode> >+ <user_name></user_name> >+ <password></password> >+ <debug>0</debug> >+ </smtp_server> >+ > </config> > </yazgfs> >-- >2.24.1 (Apple Git-126)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26290
:
109035
|
109036
|
109617
|
109618
|
109949
|
110758
|
110759
|
110760
|
111141