<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.koozali.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.koozali.org/"
          
          maintainer="staff@lists.contribs.org"
>

    <bug>
          <bug_id>4850</bug_id>
          
          <creation_ts>2008-12-11 18:56:02 +0100</creation_ts>
          <short_desc>Backup to Workstation fails with some characters in passwords</short_desc>
          <delta_ts>2011-03-11 10:10:13 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>SME Server</classification>
          <product>SME Server 7.X</product>
          <component>e-smith-*/smeserver-* packages</component>
          <version>7.4</version>
          <rep_platform>---</rep_platform>
          <op_sys>---</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>7.5.1</target_milestone>
          
          <blocked>4785</blocked>
    
    <blocked>5442</blocked>
    
    <blocked>5589</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="dgs">admin</reporter>
          <assigned_to name="SME Server Docteam">docteam</assigned_to>
          <cc>devlist</cc>
    
    <cc>esmith</cc>
    
    <cc>giacomo</cc>
    
    <cc>gweight</cc>
    
    <cc>hans.riethmann</cc>
    
    <cc>jean-paul</cc>
    
    <cc>sme</cc>
    
    <cc>smeserver-bugzilla</cc>
          
          <qa_contact name="SME Server bug team">bugteam</qa_contact>
          <cf_package>---</cf_package>
          <votes>0</votes>

      

      

      

          <comment_sort_order>newest_to_oldest_desc_first</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>42649</commentid>
    <comment_count>0</comment_count>
    <who name="dgs">admin</who>
    <bug_when>2008-12-11 18:56:02 +0100</bug_when>
    <thetext>Backup to Workstation configured to backup to another SME server on local Lan. 

If the password to access the remote server contains the &quot;!&quot; character the backup will fail. Alternate passwords result in normal operation.

Error Messages below.
 
==================================
DAILY BACKUP TO WORKSTATION REPORT
==================================
Backup started at Fri Dec 12 12:51:02 2008
Backup of mysql databases has been done.
Mounting backup shared directory svr03/recovery
*** No backup allowed or error during backup ***
Error while mounting svr03:recovery :
mount error 13 = Permission denied
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs) 

Error while mounting svr03:recovery :
mount error 13 = Permission denied
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
Backup terminated: backup failed - status: 7424</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56248</commentid>
    <comment_count>53</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2010-07-09 14:42:57 +0200</bug_when>
    <thetext>*** Bug 4923 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54580</commentid>
    <comment_count>52</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2010-05-26 14:05:04 +0200</bug_when>
    <thetext>Released in SME 7.5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50488</commentid>
    <comment_count>51</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2009-11-13 03:05:58 +0100</bug_when>
    <thetext>(In reply to comment #49)
&gt; I think we should split off first as the problem we are discussing is not
&gt; related to the issue fixed in this bug.

Cloned to bug 5589.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50487</commentid>
    <comment_count>50</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2009-11-13 03:03:49 +0100</bug_when>
    <thetext>Setting back to VERIFIED</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50485</commentid>
    <comment_count>49</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2009-11-13 03:02:38 +0100</bug_when>
    <thetext>(In reply to comment #48)
&gt; Yes, as stated earlier, there is a samba bug which parses that file
&gt; incorrectly. We have a choice to be fancy during template expansion and
&gt; post-process the file to remove the trailing newline, or to fix samba.

I think we should split off first as the problem we are discussing is not related to the issue fixed in this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50477</commentid>
    <comment_count>48</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-11-12 15:19:59 +0100</bug_when>
    <thetext>(In reply to comment #47)
&gt; (In reply to comment #45)
&gt; &gt; An empty line? Do you really mean an empty line - i.e. file ends with \n\n? If
&gt; &gt; so, the only thing I can see which would cause that is if $backupwk{&apos;Password&apos;}
&gt; &gt; actually contains a \n.
&gt; 
&gt; According to this, no;(nice tip, thanks):
&gt; 
&gt; [root@example dar]# od -c CIFScredentials
&gt; 0000000   u   s   e   r   n   a   m   e   =   b   a   c   k   u   p  \n
&gt; 0000020   p   a   s   s   w   o   r   d   =   b   a   c   k   u   p  \n
&gt; 0000040
&gt; [root@example dar]#
&gt; 
&gt; But as soon as you remove the 0000040 line the workstation to backup parses
&gt; correctly.

There is no 0000040 line. You mean byte 0x3F, I think, which is the trailing newline.

Yes, as stated earlier, there is a samba bug which parses that file incorrectly. We have a choice to be fancy during template expansion and post-process the file to remove the trailing newline, or to fix samba.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50476</commentid>
    <comment_count>47</comment_count>
    <who name="Gavin">gweight</who>
    <bug_when>2009-11-12 15:16:43 +0100</bug_when>
    <thetext>(In reply to comment #45)
&gt; An empty line? Do you really mean an empty line - i.e. file ends with \n\n? If
&gt; so, the only thing I can see which would cause that is if $backupwk{&apos;Password&apos;}
&gt; actually contains a \n.

According to this, no;(nice tip, thanks):

[root@example dar]# od -c CIFScredentials
0000000   u   s   e   r   n   a   m   e   =   b   a   c   k   u   p  \n
0000020   p   a   s   s   w   o   r   d   =   b   a   c   k   u   p  \n
0000040
[root@example dar]#

But as soon as you remove the 0000040 line the workstation to backup parses correctly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50475</commentid>
    <comment_count>46</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-11-12 15:01:54 +0100</bug_when>
    <thetext>(In reply to comment #40)

&gt; Looking at the patch from e-smith-backup v22 I don&apos;t see how we could 
&gt; avoid the 0A 

We could avoid it by use of a custom FILTER in the templates.metadata file.

&gt; so do we need to take the patch from
&gt; https://bugzilla.redhat.com/show_bug.cgi?id=532094 which has been tested by
&gt; CentOS.

I think that is a better option, especially since I believe we should be using a much later samba version anyway (for Vista and Windows 7 compatibility).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50474</commentid>
    <comment_count>45</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-11-12 14:58:29 +0100</bug_when>
    <thetext>(In reply to comment #36)

&gt; This is because CIFScredentials file in /etc/dar has an empty line at the end
&gt; of the file.  If you remove the empty line at the end of the file you are then
&gt; able to mount correctly.

An empty line? Do you really mean an empty line - i.e. file ends with \n\n? If so, the only thing I can see which would cause that is if $backupwk{&apos;Password&apos;} actually contains a \n.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50473</commentid>
    <comment_count>44</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-11-12 14:52:01 +0100</bug_when>
    <thetext>(In reply to comment #41)
&gt; Maybe the credentials file issue should be made into a separate bug against
&gt; samba, as the fix for e-smith-backup is actually correct.

OK, sounds good. 

[This is another reason for us maintaining our own samba stream, rather than relying on an upstream who seem not to care enough about samba capabilities.]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50472</commentid>
    <comment_count>43</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-11-12 14:44:12 +0100</bug_when>
    <thetext>(In reply to comment #38)

&gt; Not sure about that. In vi there is no additional line visible, and from my
&gt; workstation I cannot see any strange line endings, although it sounds like a
&gt; good theory.

Don&apos;t trust what vi shows you as line feeds. Use:

od -c &lt; /path/to/file

and you will see exactly what is in the file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50470</commentid>
    <comment_count>42</comment_count>
    <who name="Gavin">gweight</who>
    <bug_when>2009-11-12 14:34:11 +0100</bug_when>
    <thetext>(In reply to comment #41)
&gt; Maybe the credentials file issue should be made into a separate bug against
&gt; samba, as the fix for e-smith-backup is actually correct. Here is a
&gt; verification for this bug but it is blocked due to the samba issue so I won&apos;t
&gt; change the bug status.

It also makes me think that bug 5442 wasn&apos;t verified correctly due to this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50469</commentid>
    <comment_count>41</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2009-11-12 13:22:50 +0100</bug_when>
    <thetext>Maybe the credentials file issue should be made into a separate bug against samba, as the fix for e-smith-backup is actually correct. Here is a verification for this bug but it is blocked due to the samba issue so I won&apos;t change the bug status.


= Environment:

SME Server 7.4

Backup to Workstation configured to backup to another SME server on local Lan. 

If the password to access the remote server contains the &quot;!&quot; or &quot;,&quot; character the backup will fail. Other passwords result in normal operation.

# rpm -q e-smith-backup samba
e-smith-backup-2.0.0-19.el4.sme
samba-3.0.28-0.el4.9

Either start a backup from the panel, or just # /sbin/e-smith/do_backupwk

Error while mounting 192.168.0.254:temp :
mount error 13 = Permission denied
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
Backup terminated: backup failed - status: 7424 


= Updated version installed:

Updated via yum

# rpm -q e-smith-backup samba
e-smith-backup-2.0.0-23.el4.sme
samba-3.0.33-0.18.el4_8

# signal-event post-upgrade; signal-event reboot


Note: Hack /etc/e-smith/templates/etc/dar/CIFScredentials/template-begin to remove the final LF if using samba-3.0.33-0.18.el4_8 due to a known problem with the credentials file


= Problem fixed:

Try a problematic password eg &quot;Te2er,!&quot;

# /sbin/e-smith/do_backupwk

Backup is made and email arrives informing of successful backup.


= Release note information suggestion:

Some valid passwords would fail due to how the backup directory was mounted. The backup now uses a credentials file for mount.cifs to avoid this limitation.

= Verified or Reopen:

Marking VERIFIED pending resolving the samba credentials file issue, or splitting that into a separate bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50468</commentid>
    <comment_count>40</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2009-11-12 12:53:19 +0100</bug_when>
    <thetext>(In reply to comment #36)
&gt; This is because CIFScredentials file in /etc/dar has an empty line at the end
&gt; of the file.  If you remove the empty line at the end of the file you are then
&gt; able to mount correctly.

I can now see the 0A LineFeed character in the file. Vi also adds it by default so in my own credentials file I also got it.

Looking at the patch from e-smith-backup v22 I don&apos;t see how we could avoid the 0A so do we need to take the patch from https://bugzilla.redhat.com/show_bug.cgi?id=532094 which has been tested by CentOS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50466</commentid>
    <comment_count>39</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2009-11-12 12:34:28 +0100</bug_when>
    <thetext>http://www.mail-archive.com/centos@centos.org/msg44572.html

It seems that a samba update may have broken this. Even the final LF needs to be removed now, or patch samba.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50465</commentid>
    <comment_count>38</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2009-11-12 12:25:11 +0100</bug_when>
    <thetext>(In reply to comment #36)
&gt; (In reply to comment #35)
&gt; &gt; It just fails when tying to use the credentials file, which visually contains
&gt; &gt; the correct information.
&gt; 
&gt; This is because CIFScredentials file in /etc/dar has an empty line at the end
&gt; of the file.  If you remove the empty line at the end of the file you are then
&gt; able to mount correctly.

Not sure about that. In vi there is no additional line visible, and from my workstation I cannot see any strange line endings, although it sounds like a good theory. 

I&apos;ve also tried manually creating a credentials file but that also failed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50464</commentid>
    <comment_count>37</comment_count>
    <who name="Gavin">gweight</who>
    <bug_when>2009-11-12 11:29:04 +0100</bug_when>
    <thetext>(In reply to comment #36)
&gt; (In reply to comment #35)
&gt; &gt; It just fails when tying to use the credentials file, which visually contains
&gt; &gt; the correct information.
&gt; 
&gt; This is because CIFScredentials file in /etc/dar has an empty line at the end
&gt; of the file.  If you remove the empty line at the end of the file you are then
&gt; able to mount correctly.

Reopening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50463</commentid>
    <comment_count>36</comment_count>
    <who name="Gavin">gweight</who>
    <bug_when>2009-11-12 11:28:35 +0100</bug_when>
    <thetext>(In reply to comment #35)
&gt; It just fails when tying to use the credentials file, which visually contains
&gt; the correct information.

This is because CIFScredentials file in /etc/dar has an empty line at the end of the file.  If you remove the empty line at the end of the file you are then able to mount correctly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50460</commentid>
    <comment_count>35</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2009-11-12 09:36:01 +0100</bug_when>
    <thetext>I cannot verify this, even with a normal user and password I just get 
mount error 13 = Permission denied

I&apos;ve tried running the mount.cifs by itself with the --verbose to see what is going on. 

OLD WAY
mount.cifs kernel mount options: unc=//192.168.0.254\data,ip=192.168.0.254,ver=1,rw,user=test2,pass=********

This mounts fine

NEW WAY
mount.cifs kernel mount options: unc=//192.168.0.254\data,ip=192.168.0.254,user=test2,ver=1,rw,credentials=/etc/dar/CIFScredentials,nounix,pass=********

This fails, however it does pick up the user correctly so it has been able to read the credentials file correctly.

It just fails when tying to use the credentials file, which visually contains the correct information.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50450</commentid>
    <comment_count>34</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2009-11-11 02:06:52 +0100</bug_when>
    <thetext>(In reply to comment #33)
&gt; seems done
&gt; 
&gt; see e-smith-backup.spec for 2.2.0-22 :
&gt; 
&gt; * Wed Aug 26 2009 Jonathan Martens &lt;smeserver-contribs@snetram.nl&gt; 2.2.0-22.sme
&gt; Porting Jean-Paul Leclere changes in the SME Server 7 tree to SME Server 8:
&gt; - using credentials file for cifs mount [SME: 5442]
&gt; - workstation backup: add cifs credentials expand to bootstrap-console-save
&gt; [SME: 5442] 
&gt; 
&gt; needs only verification

No this is the SME Server 8.x fix actual changelog entries for SME Server 7.x release are:

* Wed Aug 26 2009 Jean-Paul Leclere &lt;jean-paul@leclere.org&gt; 2.0.0-23.sme
- workstation backup: add cifs credentials expand to bootstrap-console-save [SME: 4850]

* Tue Aug 25 2009 Jean-Paul Leclere &lt;jean-paul@leclere.org&gt; 2.0.0-22.sme
- workstation backup: using credentials file for cifs mount [SME: 4850]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49670</commentid>
    <comment_count>33</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2009-10-28 13:31:36 +0100</bug_when>
    <thetext>seems done

see e-smith-backup.spec for 2.2.0-22 :

* Wed Aug 26 2009 Jonathan Martens &lt;smeserver-contribs@snetram.nl&gt; 2.2.0-22.sme
Porting Jean-Paul Leclere changes in the SME Server 7 tree to SME Server 8:
- using credentials file for cifs mount [SME: 5442]
- workstation backup: add cifs credentials expand to bootstrap-console-save [SME: 5442] 

needs only verification</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48596</commentid>
    <comment_count>32</comment_count>
    <who name="Shad L. Lords">slords</who>
    <bug_when>2009-08-26 11:07:29 +0200</bug_when>
    <thetext>(In reply to comment #31)
&gt; Shouldn&apos;t this be cloned to SME 8 as well?

It should and fixes should be applied there as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48595</commentid>
    <comment_count>31</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2009-08-26 09:45:10 +0200</bug_when>
    <thetext>(In reply to comment #30)
&gt; Marking FIXED in e-smith-backup:
&gt; 
&gt; * Wed Aug 26 2009 Jean-Paul Leclere &lt;jean-paul@leclere.org&gt; 2.0.0-23.sme
&gt; - workstation backup: add cifs credentials expand to bootstrap-console-save
&gt; [SME: 4850]

Shouldn&apos;t this be cloned to SME 8 as well?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48594</commentid>
    <comment_count>30</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2009-08-26 09:44:35 +0200</bug_when>
    <thetext>Marking FIXED in e-smith-backup:

* Wed Aug 26 2009 Jean-Paul Leclere &lt;jean-paul@leclere.org&gt; 2.0.0-23.sme
- workstation backup: add cifs credentials expand to bootstrap-console-save [SME: 4850]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48561</commentid>
    <comment_count>29</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-08-25 15:02:33 +0200</bug_when>
    <thetext>(In reply to comment #28)
&gt; (In reply to comment #27)
&gt; &gt; But the two solutions are equally functional for SME, and the core team
&gt; &gt; decides. So, agree with expand in conf-backup event (which is effectively
&gt; &gt; called in backup function).
&gt; 
&gt; You also want to link this into console-save or bootstrap-console-save.  This
&gt; way the file gets expanded after a restore as well.

bootstrap-console-save. console-save is only used in very limited circumstances, and not, as far as I am aware, after restore.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48560</commentid>
    <comment_count>28</comment_count>
    <who name="Shad L. Lords">slords</who>
    <bug_when>2009-08-25 14:45:46 +0200</bug_when>
    <thetext>(In reply to comment #27)
&gt; But the two solutions are equally functional for SME, and the core team
&gt; decides. So, agree with expand in conf-backup event (which is effectively
&gt; called in backup function).

You also want to link this into console-save or bootstrap-console-save.  This way the file gets expanded after a restore as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48529</commentid>
    <comment_count>27</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2009-08-21 13:16:14 +0200</bug_when>
    <thetext>I am convinced for the place of the credentials file under /etc/dar. 

Not for expanding credentials file from template in pre-backup event or, as
Shad suggests only in the conf-backup event, because I prefer code which
updates only one reference (the config db), and derives from it the shell
command parameters (the credentials file) each time that is needed and  close
by the calling code. &quot;Une affaire de gout et de couleurs&quot;, as we said in
french.

But the two solutions are equally functional for SME, and the core team
decides. So, agree with expand in conf-backup event (which is effectively
called in backup function).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48528</commentid>
    <comment_count>26</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-08-21 11:10:33 +0200</bug_when>
    <thetext>(In reply to comment #25)

&gt; Don&apos;t agree.

I do.

&gt; As every configuration data, cifs login/password are stored in
&gt; configuration db when changed in the backup panel via the backuop function..
&gt; But it&apos;s also perfectly legitimate, like for others conf db variables, to set
&gt; them via the db command in a console.

Yes. And if you change the db via the command line, then you either need to do:

signal-event post-upgrade ; signal-event reboot

or you take full responsibility to know what templates need to be expanded and what actions need to be executed.

&gt; The credentials file is just a file needed during the mount.cifs command, and
&gt; it is logical (and has no drawback) to generate it from real effective db
&gt; values just before launching the cifs mount.

No, I agree with Shad that it is logical to generate it whenever the data it contains might have changed. It&apos;s harmless, but unnecessary, to generate it any other time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48527</commentid>
    <comment_count>25</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2009-08-21 11:04:36 +0200</bug_when>
    <thetext>(In reply to comment #24)
&gt; (In reply to comment #22)
&gt; &gt; Mounting the cifs folder job is not needed by the pre-backup event but by the
&gt; &gt; workstation-backup-dar action (and also by the backup server-manager script).
&gt; &gt; Getting the actual values of cifs login/password from configuration db must be
&gt; &gt; made by them when the do the mount, not by any other event driven mechanism.
&gt; 
&gt; All you are going to do in the mount is use a file that is already there.  The
&gt; place you want to expand that file is where you change the values on the
&gt; database.  It would make sense to expand that template as part of the
&gt; conf-backup event which is called when the panel is saved (or should be).  Then
&gt; all you need is an event script in pre-backup to mount the share if the backup
&gt; type is workstation/dar.

Don&apos;t agree. As every configuration data, cifs login/password are stored in configuration db when changed in the backup panel via the backuop function..
But it&apos;s also perfectly legitimate, like for others conf db variables, to set them via the db command in a console. SME configuration db variables are the real references, not the content of a file generated for command purpose.
The credentials file is just a file needed during the mount.cifs command, and it is logical (and has no drawback) to generate it from real effective db values just before launching the cifs mount.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48526</commentid>
    <comment_count>24</comment_count>
    <who name="Shad L. Lords">slords</who>
    <bug_when>2009-08-21 10:36:44 +0200</bug_when>
    <thetext>(In reply to comment #22)
&gt; Mounting the cifs folder job is not needed by the pre-backup event but by the
&gt; workstation-backup-dar action (and also by the backup server-manager script).
&gt; Getting the actual values of cifs login/password from configuration db must be
&gt; made by them when the do the mount, not by any other event driven mechanism.

All you are going to do in the mount is use a file that is already there.  The place you want to expand that file is where you change the values on the database.  It would make sense to expand that template as part of the conf-backup event which is called when the panel is saved (or should be).  Then all you need is an event script in pre-backup to mount the share if the backup type is workstation/dar.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48525</commentid>
    <comment_count>23</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-08-21 09:44:10 +0200</bug_when>
    <thetext>(In reply to comment #22)&gt;

&gt; Events rely on actions, not the opposite.

Not really. Many of the actions do depend on the template expansion which is provided by the the templates2expand tree. Either technique will get the job done.

&gt; And the credential file, if we want security, must be resident in a secure
&gt; directory, accessed onle y by root.

No, the file must be readable only by root, and the directory must not be writable by non-root, but there is no problem with other users having read and execute access to the directory.

&gt; /home/e-smith/db seems the right choice.

It would be better in a directory you create within /etc. All the other files in /home/e-smith/db are db files, and you are also including this templated configuration file unnecessarily in the backup. No big deal either way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48524</commentid>
    <comment_count>22</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2009-08-21 07:47:41 +0200</bug_when>
    <thetext>I am also a supporter of event driven actions from SME, but I don&apos;t agree.

Mounting the cifs folder job is not needed by the pre-backup event but by the workstation-backup-dar action (and also by the backup server-manager script). Getting the actual values of cifs login/password from configuration db must be made by them when the do the mount, not by any other event driven mechanism.

workstation-backup-dar action and backup function should not rely on an event to get the credentials. Events rely on actions, not the opposite.

And the credential file, if we want security, must be resident in a secure directory, accessed only by root. /home/e-smith/db seems the right choice.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48523</commentid>
    <comment_count>21</comment_count>
    <who name="Hans Riethmann">hans.riethmann</who>
    <bug_when>2009-08-21 01:31:50 +0200</bug_when>
    <thetext>what if you do it the same way as you did for DailyBackup.dcf

cd /etc/e-smith/events/pre-backup/templates2expand/etc/dar
touch SmbLogin.cred

and create the template accordingly. i always liked the event driven approach of SME, it makes it well structured. expanding templates in the code works but is a different philosophy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48522</commentid>
    <comment_count>20</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2009-08-20 14:28:21 +0200</bug_when>
    <thetext>So, we should change the lines :

&lt; $err = qx(/bin/mount -t cifs &quot;$smbhost:$smbshare&quot; $mntdir -o nounix,user=$login,pass=$password 2&gt;&amp;1);

with lines :

&gt;    processTemplate({
&gt;        TEMPLATE_PATH =&gt; &apos;/home/e-smith/db/workstationSmbLogin&apos;,
&gt;        PERMS =&gt; 0640
&gt;    });
&gt;    $err = qx(/bin/mount -t cifs &quot;$smbhost:$smbshare&quot; $mntdir -o credentials=/ho
me/e-smith/db/workstationSmbLogin,nounix 2&gt;&amp;1);

and have a template file for /home/e-smith/db/workstationSmbLogin with the lines :

username={$backupwk{&apos;Login&apos;}}
password={$backupwk{&apos;Password&apos;}}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48521</commentid>
    <comment_count>19</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-08-20 07:43:12 +0200</bug_when>
    <thetext>(In reply to comment #18)
&gt; &gt; You won&apos;t. You&apos;ll see it there during the mount command.
&gt; 
&gt; Was what I supposed. So don&apos;t see here a real security problem.

Of course it is. Any exposure of the password makes the backup vulnerable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48520</commentid>
    <comment_count>18</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2009-08-20 07:18:46 +0200</bug_when>
    <thetext>
&gt; You won&apos;t. You&apos;ll see it there during the mount command.

Was what I supposed. So don&apos;t see here a real security problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48517</commentid>
    <comment_count>17</comment_count>
    <who name="Charlie Brady">charlieb-contribs-bugzilla</who>
    <bug_when>2009-08-20 06:15:44 +0200</bug_when>
    <thetext>(In reply to comment #16)
&gt; (In reply to comment #15)
&gt; 
&gt; &gt; This may be the only way to be able to use any character but does make the
&gt; &gt; password visible in the process table.
&gt; 
&gt; Are you sure ? I don&apos;t see any info about USER and PASSWD in the process table
&gt; once the mount is done.

You won&apos;t. You&apos;ll see it there during the mount command.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48513</commentid>
    <comment_count>16</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2009-08-20 02:53:08 +0200</bug_when>
    <thetext>(In reply to comment #15)

&gt; This may be the only way to be able to use any character but does make the
&gt; password visible in the process table.

Are you sure ? I don&apos;t see any info about USER and PASSWD in the process table once the mount is done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48512</commentid>
    <comment_count>15</comment_count>
    <who name="Shad L. Lords">slords</who>
    <bug_when>2009-08-19 12:05:38 +0200</bug_when>
    <thetext>(In reply to comment #14)
&gt; $ENV{&apos;USER&apos;} = $login;
&gt; $ENV{&apos;PASSWD&apos;} = $password;
&gt; $err = qx(/bin/mount -t cifs &quot;$smbhost:$smbshare&quot; $mntdir -o nounix 2&gt;&amp;1);

This may be the only way to be able to use any character but does make the password visible in the process table.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48511</commentid>
    <comment_count>14</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2009-08-19 09:18:05 +0200</bug_when>
    <thetext>I think a more simple way could be to change the line :

&gt; $err = qx(/bin/mount -t cifs &quot;$smbhost:$smbshare&quot; $mntdir -o nounix,user=$login,pass=$password 2&gt;&amp;1);

with lines :

&gt; $ENV{&apos;USER&apos;} = $login;
&gt; $ENV{&apos;PASSWD&apos;} = $password;
&gt; $err = qx(/bin/mount -t cifs &quot;$smbhost:$smbshare&quot; $mntdir -o nounix 2&gt;&amp;1);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48497</commentid>
    <comment_count>13</comment_count>
    <who name="Hans Riethmann">hans.riethmann</who>
    <bug_when>2009-08-18 08:12:32 +0200</bug_when>
    <thetext>both scripts

/etc/e-smith/events/actions/workstation-backup-dar
/etc/e-smith/web/functions/backup

can&apos;t handle shell special characters, the will both fail with a an error message similar to

sh: -c: line 0: syntax error near unexpected token `(&apos;
sh: -c: line 0: `/bin/mount -t cifs &quot;192.168.1.62:backup&quot; /mnt/smb -o user=administrator,pass=xxxxxx(? 2&gt;&amp;1&apos;
umount: /mnt/smb: not mounted

the shell special character case could be dealt with by putting single quotes around $password like 

root@sme73-dev - base-oti-backup-0.1 &gt; cd /etc/e-smith/web/functions/
root@sme73-dev - base-oti-backup-0.1 &gt; diff backup*
3048c3048
&lt;       return ( qx(/bin/mount -t cifs &quot;$host:$share&quot; $mountdir -o user=$login,pass=&apos;$password&apos;) );
---
&gt;       return ( qx(/bin/mount -t cifs &quot;$host:$share&quot; $mountdir -o user=$login,pass=$password) );

as stated before, comma is a whole different story, it disturbs the mount command and not the shell. to allow strong passwords and to keep exceptions for administrators at a minimum, my suggestion would be to create a credentials file via the templates meachnism and change the call to the mount command to use the &quot;credentials&quot; option instead of the &quot;user&quot; and &quot;pass&quot; ones.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46455</commentid>
    <comment_count>12</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2009-05-14 14:04:11 +0200</bug_when>
    <thetext>(In reply to comment #11)
&gt; Bug 4529 which has just been marked as a duplicate was specifically about the
&gt; use of comma which appears to be a special case that has a workaround either
&gt; via the credentials file, or environment variable:
&gt; (http://linux.die.net/man/8/mount.cifs)

Thanks Ian, did not find this that quickly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46454</commentid>
    <comment_count>11</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2009-05-14 13:56:02 +0200</bug_when>
    <thetext>Bug 4529 which has just been marked as a duplicate was specifically about the use of comma which appears to be a special case that has a workaround either via the credentials file, or environment variable: (http://linux.die.net/man/8/mount.cifs)
&quot;Note that a password which contains the delimiter character (i.e. a comma &apos;,&apos;) will fail to be parsed correctly on the command line. However, the same password defined in the PASSWD environment variable or via a credentials file (see below) or entered at the password prompt will be read correctly.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46443</commentid>
    <comment_count>10</comment_count>
    <who name="Gavin">gweight</who>
    <bug_when>2009-05-14 11:35:28 +0200</bug_when>
    <thetext>*** Bug 4529 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43264</commentid>
    <comment_count>9</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2009-01-01 21:25:23 +0100</bug_when>
    <thetext>See also Bug 4906

Another bug that would not have been raised if some password checking was done in the panel.



</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42667</commentid>
    <comment_count>8</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2008-12-12 10:57:25 +0100</bug_when>
    <thetext>I thought about this possibility, but  :
- the pannel does not assign a password, it just gathers an existent information
- if an admin has succesfully put this password on the workstation share, it will be difficult for him to understand why sme doesn&apos;t want to read it on the panel
So if we want to prevent such passwords we must give the admin a comprehensive feedback ans ask him to change the pasword on the workstation share.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42666</commentid>
    <comment_count>7</comment_count>
    <who name="Ian Wells">esmith</who>
    <bug_when>2008-12-12 10:06:11 +0100</bug_when>
    <thetext>I&apos;m going to re-open this as the Backup panel should not accept passwords that we know are not acceptable.

On one page you have to select your backup method, in this case cifs

Then on the next page you enter the password. I would recommend that this is then checked and only accepted if valid for mount.cifs</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42661</commentid>
    <comment_count>6</comment_count>
    <who name="Gavin">gweight</who>
    <bug_when>2008-12-12 04:05:37 +0100</bug_when>
    <thetext>Moving back to SME Server tracker.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42657</commentid>
    <comment_count>5</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2008-12-12 03:18:23 +0100</bug_when>
    <thetext>Marking FIXED in http://wiki.contribs.org/index.php?title=SME_Server%3ADocumentation%3AAdministration_Manual%3AChapter10&amp;diff=11803&amp;oldid=11772

Although I am not sure if there does not need to be some escaping/urlencoding as I am unfamiliar with the script.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42656</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan">smeserver-bugzilla</who>
    <bug_when>2008-12-12 03:11:24 +0100</bug_when>
    <thetext>(In reply to comment #3)
&gt; Thanks Jean-Paul.

Yes, thanks indeed.

&gt; Looking at the mount.cifs man page I see that other characters are also taboo.
&gt; I understand now that this is not a SME bug, and the workaround is to use a
&gt; different password. 
&gt; 
&gt; I guess the best action would be to document what to avoid. The errors give
&gt; little clue to what is going on and I would like to help other avoid the hours
&gt; of frustration I have just spent.
&gt; 
&gt; I now know exclamation marks, commas and leading spaces are taboo, is anyone
&gt; aware of others?

Moving to DocTeam as this should be documented in the Manual:

http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter10#To_desktop</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42655</commentid>
    <comment_count>3</comment_count>
    <who name="dgs">admin</who>
    <bug_when>2008-12-12 03:03:19 +0100</bug_when>
    <thetext>Thanks Jean-Paul.

Looking at the mount.cifs man page I see that other characters are also taboo.
I understand now that this is not a SME bug, and the workaround is to use a different password. 

I guess the best action would be to document what to avoid. The errors give little clue to what is going on and I would like to help other avoid the hours of frustration I have just spent.

I now know exclamation marks, commas and leading spaces are taboo, is anyone aware of others?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42654</commentid>
    <comment_count>2</comment_count>
    <who name="Jean-Paul Leclère">jean-paul</who>
    <bug_when>2008-12-12 02:04:23 +0100</bug_when>
    <thetext>Backup to workstation is no more maintained as a contrib. The code is in e-smith-backup.

But for the reported problem, it&apos;s not a sme bug, but a mount.cifs problem that we cannot resolve in sme.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42651</commentid>
    <comment_count>1</comment_count>
    <who name="chris burnat">devlist</who>
    <bug_when>2008-12-11 19:26:45 +0100</bug_when>
    <thetext>Backup in 7.4 is based on DAR, a Contrib and not core SME7xx.
Moving to contrib section</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>