In IIS7 and IIS7.5 which runs on Windows Server 2008 or Windows Server 2008 R2, it is not possible to use the WebDav PUT command without ‘authentication’.
This is a problem for your Avaya VOIP phones. Avaya uses the PUT command to backup a phone configuration and to store contacts.
Now, there are 3 possible options:
- Install Apache on Windows or Linux. I know many of you guys don’t like this…Especially because you need to configure and update/patch it.
- Use a WebDav server like IP Tel from Avaya. However, that program looks like a Windows95 program,.. is it supported at all. ?
- Install my Avaya script / workarround! I’ll tell you how it works below.
My Avaya WebDav workarround:
- Install IIS on a Workstation or Server. You might have already installed IIS for phones to download the firmware and settings file.
Make sure to have the WebDav module UNinstalled! (If you install it and disable it inside the IIS Manager, it will not work!) - Install the URL Rewrite module of IIS.
- Add a rewrite rule on your backup directory which looks like this:
(click to enlarge) - Use the following script:
avayaupload.asp
< %
'#THIS IS THE ONLY VARIABLE NEEDED! PLEASE END WITH A SLASH!!#
backup_dir = "c:\inetpub\wwwroot\backup\"
uri = Request.ServerVariables("REQUEST_URI")
filename = Right( uri, Len(uri) - InStrRev(uri,"/",Len(uri)) )
If UCase(Request.ServerVariables("HTTP_METHOD"))="PUT" Then
If Request.Totalbytes>0 Then
sourcedata = Request.BinaryRead(Request.Totalbytes)
SaveBinaryData backup_dir&filename, sourcedata
Response.Status="201 Created"
End If
Else
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists (backup_dir&filename) Then
filecontent = ReadBinaryFile(backup_dir&filename)
response.binarywrite filecontent
End If
End If
Function SaveBinaryData(FileName, ByteArray)
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To save binary data.
BinaryStream.Type = adTypeBinary
'Open the stream And write binary data To the object
BinaryStream.Open
BinaryStream.Write ByteArray
'Save binary data To disk
BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
End Function
Function ReadBinaryFile(FileName)
Const adTypeBinary = 1
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To get binary data.
BinaryStream.Type = adTypeBinary
'Open the stream
BinaryStream.Open
'Load the file data from disk To stream object
BinaryStream.LoadFromFile FileName
'Open the stream And get binary data from the object
ReadBinaryFile = BinaryStream.Read
End Function
%>
Don’t forget to give the backup directory Write permissions (NTFS) for the IUSR account.
Implemented this today on IIS 7.5 with a few adjustments:
– I also had to activate the PUT verb for classic ASP
– I adjusted the matching condition for the rewrite rule to a regex that is accurate enough to make sure that only files in the expected path / filename are passed to the script, everything else get’s handled static by IIS. *txt* breaks a lot of other stuff and might be a security risk.
– highly recommended: harden the setup by restricting access to only your phone networks
– MOST IMPORTANT: put this in a separate App pool, configure anonymous authentication to the apppool identity and grant NTFS permissions only to this apppool user. That way you’re making sure that the script is not able to write anywhere else via path traversal, etc.
I know this is a really old thread but still relevant.
I’ve done all of the above, and IIS logs are showing:
PUT /Avaya/backup/4141_96xxdata.txt – 80 – 10.123.40.17 AVAYA/SPICE/v3.1+(9650)/Std/0.1 200 0 0 2246
The 200 response code seemingly meaning success, although the script seems to be sending a 201 response on success. No file update in the backup directory.
Any clues as to how to find the problem?
I am in the same place as Marcus from last year in that I have set this up added the PUT verbs etc. and the phone tells me Backup Successful but the file never shows up in the backup folder. Or anywhere else for that matter. I also get a message 200 in the IIS logs. Any help would be appreciated.
Thanks
Hi Marcus, I have the same issue as you, it says that the backup is successful on the handset but the IIS server is not updated.
Did you ever find a solution for this?
Thanks
Steve
Hi Roel
I am trying to set this up, i did all the changes you suggested, but the backup is still failing, restoring is fine.
do the phones need to be using the latest version?
Hi there, i did what Roel post here and i can successfully create backups for my phones, but restore is really not working. Is it possible to modify urlrewrite for GET command or may be someone may changes asp script?
thank you.
Ive spent nearly two days trying to get this work! i must be missing something….
Ive tried on Windows 2012 R2, and then reverted back to a Windows 2008 R2 back. Ive installed url rewrite, setup the handlers, and set NTFS perms on the backup folder.
In IIS, i see the phone connecting via PUT and uploading the file with 200 (success), and on the phone i get no errors! If i manaully perform a backup it says on the handset “Backup successful” but no text file is created in the backup folder!!!
So i’m really at a loss what to do.
I’d really appreciate any assistance.
Hey All,
Having same issue with 9650’s not backing up to 7.5 iis. Updated phones to latest 3.2.2 but still nothing. Tried adding username and password in the settings file still nothing.
Trying the above pasted the asp script in to a txt file and renamed it asp and called it avayaupload. Added Rewrite and the rule but still get backup failed.
Can someone tell me where and how you put the PUT command in the asp handlers please?
Thanks
Kevin
Roel,
Thanks a bunch for the script! I also had to add the PUT command to the handlers like Robin suggested. Unfortunately in “this” situation we were forced to use IIS 7.5 as thats what was running on the host that was intended for phone backups.
I have noticed that MV_IPTel does have memory leak with uploading files via WebDav. I have not yet used apache but that is a good suggestion and work around to MV_IPTel. It looks as Avaya’s Utility server runs Apache and is enabled for WebDav, although I have not tested it out yet.
# WebDAV module configuration section.
#
# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/lockdb
Dav On
With my testing on IIS7.5 w/ 2008r2 everything worked as should, we backed up phones, added contacts, backed up call logs and cleared the values and allowed them to pull the backups without any issues.
Thanks again for taking your time and building the script.
Thjank you for all the good information.
Backups are working fine on my IIS7.5 using the above information, but I am unable to retreive from the Avaya 9620 backed up files. The Manual restore indicates Retreival Failed. I look a tthe IIS logs and it indicates the Get has a result of 200
2013-04-19 15:58:22 x.x.18.7 GET /backups/214_96xxdata.txt – 80 – x.x.115.12 AVAYA/SPICE/v3.1+(9620)/Std/0.1 200 0 0 15
which looks successful to me… but really is not.
Any suggestions at what else I should look at?
That applies to the ASP solution. Using Apache one can avoid allowing remote shell/code execution.
The downside is you have a security vulnerability that allows anyone on the same network as your phones to upload and overwrite files anywhere on your server. This would allow an attacker to gain a remote shell on your server.
Good contribution, Jeroen! Did you discovered that yourself?
-Roel
Actually: MV_IPtel is supported. Configuring Apache on Windows takes editing the following steps:
– Dowload and install Apache 2.2 for windows
– create directory “var” in /Apache2.2/
– create direcrory “backup” in /Apache2.2/
– Edit two config files as described below:
– edit Apache2.2/conf/
#below three rules uncommented for backup Avaya IP phones
#
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
#
edit httpd-dav.conf in Apache2.2/conf/extra
DavLockDB “D:/Program Files (x86)/Apache Software Foundation/Apache2.2/var/DavLock”
Alias /backup “D:/Program Files (x86)/Apache Software Foundation/Apache2.2/backup”
Dav On
Order Allow,Deny
Allow from all
AuthType Basic
AuthName DAV-upload
#below 3 rowes commented for Avaya Phones to disable Digest Authentication
# AuthUserFile “D:/Program Files (x86)/Apache Software Foundation/Apache2.2/user.passwd”
# AuthDigestProvider file
# Allow universal read-access, but writes are restricted
# to the admin user.
#below 3 rows commented for Avaya Phones.
#
# require user admin
#
All done!
[…] http://www.roelbroersma.nl/index.php/2011/10/17/how-to-backuprestore-avaya-to-iis7-5 […]
Avaya Utility Server Config….
See first: …
I am new to this and would like to get this working in order to backup my 9650 and 9611G phones. I have windows server 2008 r2. I open the URL Rewrite module and right click to add rules, my options are inbound rules, inbound and outbound rules, outbound rules and search engine optimization (SEO). In your screen shot it shows just “edit rules”. Not sure if I am doing this right. Also, I am not sure where to add your script. Any additional help would be great. Thanks
I strucled all day with this.
When I chanced the patern in the role from “txt” to 1*.txt it works.
The 1 is for our nummers starts with 1.
We are using w2008 R2 with IIS 7.5
Okay, got it, sorry for false panic. ASP wasn’t installed, once it was, I went to the backup directory, selected handler mappings, opened up aspclassic, hit ‘request restrictions’, and added PUT to the verb list. Way more than a phone guy really wanted to know about IIS…
=-]
Hi, I’m so close. How do you add PUT to *.asp? Many thanks for this note all, very helpful.
Ok, figured it out. I needed to add PUT to the list of allowed verbs for the *.asp handler mapping.
I get nothing but a 405 error in the logfile with the PUT command. Do I need to setup a handler mapping or something?
Thanks. Good old firefox :)
I can still see it on the blog.
Please can you repost the image avaya-rewrite-screenshot.png. Its not on the blog anymore. I am new to rewrite so this would be helpful
Hi!
I’ts not working always drop a “method not allowed” error. why?
Here is my original version in PHP. http://www.stephenjc.com/2010/08/19/avaya-backup-and-restore-on-iis-7-5/
I am just not a ASP fan thats why I wrote it in PHP.