Changes

From SME Server
Jump to navigationJump to search
no edit summary
Line 20: Line 20:     
   
 
   
  curl -s -k -b ~/.sme_cookies -c ~/.sme_cookies -F username=admin -F password=your_password \
+
  curl -s -k -b ~/.sme_cookies -c ~/.sme_cookies -F "username=admin" -F "password=your_password" \
 
         <nowiki>https://your_sme_server/server-common/cgi-bin/login</nowiki>
 
         <nowiki>https://your_sme_server/server-common/cgi-bin/login</nowiki>
 
   
 
   
Line 31: Line 31:  
     your_sme_server  is replaced with the name or IP number of the SME Server you wish to backup
 
     your_sme_server  is replaced with the name or IP number of the SME Server you wish to backup
 
     backupfile.tar.gz is the name you want to save the backup as
 
     backupfile.tar.gz is the name you want to save the backup as
 +
 +
{{Warning box|If you are sharing the machine doing the backup with others using <nowiki> -F "password=your_password"</nowiki> is not secure. Any user can see your password with ps if they can catch it while the command is running!
 +
 +
cURL does however allow you to save your password in a file and read it in as follows:
 +
echo your_password >~/sme_password
 +
Then you can replace <nowiki>"password=your_password" in the above with "password=<~/sme_password"</nowiki>
 +
}}
    
{{Note box|Full information on cURL can be found in the [http://curl.haxx.se/docs/manpage.html cURL manual]
 
{{Note box|Full information on cURL can be found in the [http://curl.haxx.se/docs/manpage.html cURL manual]
 +
    
  The Options I used are:
 
  The Options I used are:
Line 58: Line 66:  
  #!/bin/sh
 
  #!/bin/sh
 
   
 
   
  curl -s -k -b ~/.sme_cookies -c ~/.sme_cookies -F username=admin -F "password=<~/bin/sme_password" \
+
  curl -s -k -b ~/.sme_cookies -c ~/.sme_cookies -F username=admin -F "password=<~/sme_password" \
 
         <nowiki>https://snoopy/server-common/cgi-bin/login</nowiki> && \
 
         <nowiki>https://snoopy/server-common/cgi-bin/login</nowiki> && \
 
  curl -f -s -k -b ~/.sme_cookies -F function=desktop-backup -F state=perform \
 
  curl -f -s -k -b ~/.sme_cookies -F function=desktop-backup -F state=perform \
Line 68: Line 76:  
The use of date in the filename will append the day of the month to the filename. This will mean that a new backup will be created for every day of the month and overwrite them next month, obviously if the next month has fewer days you may be left with a couple of backups from last month. This is for use in automated backups (see below). This process can be further enhanced or changed as required.
 
The use of date in the filename will append the day of the month to the filename. This will mean that a new backup will be created for every day of the month and overwrite them next month, obviously if the next month has fewer days you may be left with a couple of backups from last month. This is for use in automated backups (see below). This process can be further enhanced or changed as required.
   −
This script has also been enhanced to read the password from the file sme_password also located in the bin folder. You will need to create the sme_password file in the bin folder. It should simply contain one line that is the password of your SME Server you wish to backup
+
This script has also been enhanced to read the password from the file sme_password also located in the users home directory. You will need to create the sme_password file. It should simply contain one line that is the password of your SME Server you wish to backup
    
{{Warning box|There are a couple of security considerations that you should consider when using curl.  
 
{{Warning box|There are a couple of security considerations that you should consider when using curl.  
   −
1. Your basic cURL command first used will cause the password to appear momentarily in the ps listing. This is avoided in the above script by placing the password in a file and using -F <nowiki>"password=<your_password_file" </nowiki>.<br>
+
1. Your basic cURL command first used will cause the password to appear momentarily in the ps listing. As described above, this is best avoided by placing the password in a file and using -F <nowiki>"password=<your_password_file" </nowiki>.<br>
 
2. The cookie jar ~/.sme_cookies should not be made world readable otherwise others could use your downloaded cookies. Likewise the password file should also be protected!}}
 
2. The cookie jar ~/.sme_cookies should not be made world readable otherwise others could use your downloaded cookies. Likewise the password file should also be protected!}}
   Line 82: Line 90:     
This starts a backup at 21:45 every day. The umask prevents other users on the machine reading the backups.
 
This starts a backup at 21:45 every day. The umask prevents other users on the machine reading the backups.
 +
 +
===Restoring your backup===
 +
 +
In versions of SME Server prior to 7.4 it was possible to restore the backup through the web interface. This was removed in 7.4 making it very difficult to manage a restore remotely. The recommended official [http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter10 restore procedure] is to build a whole new machine. Some alternative ways of restoring a backup are described in [http://wiki.contribs.org/Backup_server_config Backup server config].
    
===Other Extensions===
 
===Other Extensions===
Line 89: Line 101:  
To use a proxy with cURL you can simply add:
 
To use a proxy with cURL you can simply add:
 
  -x your_proxy_server:your_proxy_port
 
  -x your_proxy_server:your_proxy_port
 
+
For Example:
 +
curl -s -k -b -x stargate:3162 ~/.sme_cookies -c ~/.sme_cookies -F username=admin -F "password=<~/sme_password" \
 +
        <nowiki>https://snoopy/server-common/cgi-bin/login</nowiki>
 +
 
    
----
 
----
 
[[Category:Howto]] [[Category:Administration]]
 
[[Category:Howto]] [[Category:Administration]]
35

edits

Navigation menu