设为首页 收藏本站
查看: 534|回复: 0

[经验分享] Using WebDAV with IIS

[复制链接]

尚未签到

发表于 2015-8-15 11:23:06 | 显示全部楼层 |阅读模式
Using WebDAV with IIS

This article walks you through the process of using Web-based Distributed Authoring and Versioning (WebDAV) to publish content to an Internet Information Services (IIS) web server. The article also explains why WebDAV is a more secure and better solution to publishing content than the traditional FTP approach.
  The traditional method for uploading content to a web server is File Transfer Protocol (FTP), but using this approach has its disadvantages:

  • Using FTP requires that you open additional ports on your perimeter firewall, and this can increase the attack surface of your network and make it more susceptible to penetration by attackers. This is obviously undesirable from the perspective of keeping your network secure.
  • FTP has no file locking mechanism, so it’s possible for two users to upload different versions of the same file simultaneously causing one to be overwritten. This can mean lost time troubleshooting why an uploaded file is different from what you expect.
  • The FTP approach means you have to edit your content locally on the client. In other words, to edit a page already on the web server you would have to download it to the client, edit it there, and then upload it again to the web server. This is a time-consuming and inefficient approach to managing content.
  The solution to these problems is WebDAV, a protocol used for publishing and managing content to web servers. WebDAV is an extension of the HTTP/1.1 protocol described in RFCs 2518 and 3253. WebDAV overcomes the three issues described above as follows:

  • WebDAV uses port 80, the same port used by HTTP for web access. So using WebDAV means you don’t have to open any extra ports on your firewall.
  • WebDAV lets only one user modify a file at a time, while allowing multiple users to read it. This allows files to be locked while they are being edited, preventing unexpected changes from occurring.
  • WebDAV lets you edit files on the server instead of needing to download them first to the client. Editing files remotely using WebDAV is as easy as if they were locally present, and the whole process is transparent to the content producer.
  Let’s walk through the steps necessary to have WebDAV enabled on an IIS machine and then show how to publish and remotely modify content using WebDAV. For my web server I’m using a Windows Server 2003 machine with IIS 6 installed, and for simplicity we’ll publish content to the Default Web Site.
Install and Enable WebDAV on the Server
  First we need to install WebDAV on the server. Note that when you promote a Windows Server 2003 machine to the role of Application Server, it installs various IIS 6 components but WebDAV isn’t one of these components installed. This is different from the earlier Windows 2000 Server platform where installing IIS 5 automatically installed WebDAV as well. To install WebDAV on the IIS 6 machine, use Add or Remove Programs in Control Panel and run the Windows Components Wizard. You can find WebDAV under Application Server | Internet Information Services | World Wide Web Service | WebDAV Publishing:
DSC0000.gif
  Once you’ve installed WebDAV, you need to ensure it is enabled. To verify this, check the WebDAV option under the Web Service Extensions node in IIS Manager:
DSC0001.gif
Note that when you allow the WebDAV extension (httpext.dll) you are allowing it for all websites on your server. IIS unfortunately does not let you enable WebDAV on a per-website basis.
Enable WebDAV on the Client
  The next step is to enable WebDAV on the client machines that will be used to create and manage content for your website. Windows XP has a built-in WebDAV client that doesn’t need to be installed, only enabled. To enable WebDAV on XP, open the Services console under Administrative Tools and find the WebClient service and double-click on this service to open its Properties sheet:
DSC0002.gif
  Change the Startup Type to Automatic, then click the Start button to get the service running. You’re ready to start publishing content to your web server.
  Tip:
WebDAV is also supported by Windows 2000 with Internet Explorer 5 or higher installed, and it’s also supported by Office 2000 or later. Some of these earlier platforms don’t fully support every feature of WebDAV that Windows Server 2003 and Windows XP support however.
Preparing the Web Server for Publishing
  Now let’s do a bit more preparation of our web server to get it ready for publishing content from the client. First, we’ll create a new virtual directory where we’ll be putting our content. I created a local virtual directory named Budgets, which is an alias to the C:\Finance directory on the web server:
DSC0003.gif
  Tip:
To learn how to create and configure virtual directories on an IIS web server, see my earlier article called Creating and Configuring Web Sites in Windows Server 2003 here on WindowsNetworking.com.
  Now let’s configure the web permissions for this virtual directory so users can publish content. This is done on the Virtual Directory tab of the Properties sheet for the virtual directory:
DSC0004.gif
  As you can see from the figure, by default only Read permission is enabled for the virtual directory. This won’t do as it means users will be able to read content in the directory but not upload or edit content. To publish content using WebDAV, you should enable the following web permissions on the directory:

  • Read - lets users read what has been published to the server
  • Write - lets users upload new content to the server and edit existing content on the server
  • Directory listing - lets users view a list of published files on the server so they can select the one they want to view or edit.
  Note that enabling Write permission on the virtual directory can constitute a security hole on your web server, as the Write web permission allows anyone to upload content to your server. It’s therefore extremely important that you complete the next and final step of the procedure, namely, configure NTFS permissions on your web server to restrict who has access to the content directory. To do this, open Windows Explorer, open the Properties sheet for your content directory (C:\Finance) and select the Security tab:
DSC0005.gif
  Note that the Users group has Read, Read & Execute, and List Folder Contents permissions. These are necessary for WebDAV users to be able to write and modify content on the web server. There are also two additional special permissions that the Users group has:

  • Create Files / Write Data
  • Create Folders / Append Data
  These permissions too are necessary for WebDAV publishing, so don’t change them.
  Since the Users group here is a local group (the web server is a member server that belongs to a domain) its membership includes the Domain Users group, so this means any user in the domain is authorized to publish content to your server using WebDAV. If this is not what you want, then remove the ACE for the Users group from the ACL for your content directory in the figure above and add a different group whose membership contains only those users who are allowed to publish, then give this new group the same permissions that Users has above.
  One more tip about permissions:
If your web server is a public-facing one (residing on your DMZ) on the Internet, you should add the Internet guest account (IUSR_servername) to the ACL for your content directory and assign this group Deny Write permission. That way, anonymous users on the Internet will be able to read the content in the directory but won’t be able to modify it.
Publishing Content Using WebDAV
  Let’s try out our setup and see if it works. On an XP client machine I have a directory named C:\Stuff with four HTML files in it:
DSC0006.gif
  To publish these files to my web server, I select File | Open in Internet Explorer on the client and enter the URL to the virtual directory, which is http://server/Budgets where “server” can be the name, IP address, or DNS name of my web server. The key here is to select the checkbox labeled “Open as Web Folder” as this will enable me to use WebDAV for publishing to the target folder on the server:
DSC0007.gif
  Once the web folder opens on the remote server, it looks like this:
DSC0008.gif
  Now I simply select the four HTML files in my C:\Stuff window and drag them into my open Web Folder, and WebDAV does its magic. To verify that the files have been published, I can open the same URL http://server/Budgets again in Internet Explorer but this time as a normal web site (i.e. do not select the “Open as Web Folder” option). Here is the result:
DSC0009.jpg
  A final tip:
if I need to open this Web Folder often to publish content, I can use Add Network Place in My Network Places to create a shortcut to the http://server/Budgets web folder, then simply copy files from my local Stuff folder to the web folder on the remote machine. If you try this you’ll see that you can even use Notepad open and edit the published pages directly on the web server.
  About Mitch Tulloch
              Mitch Tulloch is a writer, trainer and consultant specializing in Windows server operating systems, IIS administration, network troubleshooting, and security. He is the author of 15 books including the Microsoft Encyclopedia of Networking (Microsoft Press), the Microsoft Encyclopedia of Security (Microsoft Press), Windows Server Hacks (O'Reilly), Windows Server 2003 in a Nutshell (O'Reilly), Windows 2000 Administration in a Nutshell (O'Reilly), and IIS 6 Administration (Osborne/McGraw-Hill). Mitch is based in Winnipeg, Canada, and you can find more information about his books at his website www.mtit.com  
      Click here for Mitch Tulloch's section.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-99299-1-1.html 上篇帖子: iis 并发数 下篇帖子: IIS配置文件的XML格式不正确 applicationHost.config崩溃 恢复解决办法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表