2015-01-26

Creating FTP or FTPS on IIS 8.5 (with Active Directory User isolation).

The goal of this article is to describe how to create FTP(S) on IIS  so we can use Active Directory accounts to authenticate to FTP. And configure AD user isolation, so  the users have individual home folders.
 
1. Install IIS Role and required features
 
In Server Manager click on Add roles and features
Click Next
Installation Type - choose Role-based or feature-based installation and click Next
Server Selection - choose your server and click Next
Server Roles - select Web Server (IIS) and confirm required features by clicking Add Features in the popup window, click Next
In the Features and Web Server Role (IIS) sections click Next
Role Services - deselect the roles you don't need, if it's going to be dedicated FTP server then leave only FTP Server/FTP Service and Management Tools/IIS management Console selected and click Next
Confirmation - click Install
 
2. Create FTP users and Groups
In active directory create your FTP users for example:
FTPuser1
FTPuser2
FTPuser3
 
And create FTP users security group:
FTP Users
 
Add all ftp users to the membership of "FTP Users" group.
 
3. Create folders and assign permissions
Prepare folder structure on your preferred location. In this example we will be using Fileserver as FTP root so users can access ftp folders directly via file share while they are connected to company network.
 
Share a folder on Fileserver
Set sharing permissions for group "FTP Users" to Full Control.
Set NTFS permissions (security tab) for "FTP Users" group to List folder contents.
 
Next we will create home folder for every user group that needs to be isolated.
For example users FTPuser1 and FTPuser2 will share same home folder, because they are colleagues and are working with the same data and FTPuser3 is from another department, so he will have separate home folder.
 
Add security permissions for users FTPuser1 and FTPuser2 and set them to Modify
 
Add security permissions for user FTPuser3 and set them to Modify
 
4. Configure IIS
Open IIS Manager in Control Panel->Administrative Tools->Internet Information Services (IIS) Manager
 
In IIS Manager expand your server, right click Sites and choose Add FTP Site...
Enter site name: myFTP
Physical path: \\Fileserver\FTProot
 
If you want to run FTPS select Require SSL and select your SSL Certificate, otherwise select No SSL.
 
 
Authentication:
Basic
Auhorization:
Select Specified roles or user groups from drop-down menu.
Type FTP Users.
Select Read and Write checkboxes.
Click Finish.
 
Next configure FTP User Isolation.
Under myFTP site open FTP User Isolation.
Select Isolate users. Restrict users to the following directory:
FTP home directory configured in Active Directory
and enter credentials of user that has access to read AD properties.
 
5. Configure user AD properties
Open Active Directory Users and Computers (ADUC) and modify properties for your FTPusers.
To be able to modify attributes, first in ADUC select View and turn on Advanced Features.
Now you should see Attribute Editor tab in user properties.
Configure AD properties as follows:
 
FTPuser1
msIIS-FTPDir: \Home1
msIIS-FTPRoot: \\Fileserver\FTProot\
 
FTPuser2
msIIS-FTPDir: \Home1
msIIS-FTPRoot: \\Fileserver\FTProot\
 
FTPuser3
msIIS-FTPDir: \Home2
msIIS-FTPRoot: \\Fileserver\FTProot\
 
6. Login
For testing login we will use FileZilla FTP client.
Configure connection as follows.
Host: address of your FTP server
Protocol: FTP File Transfer Protocol
Port: 21
Encryption: if your FTP requires SSL select Require explicit FTP over TLS, otherwise select Only use plain FTP (insecure)
Logon type: Ask for password
User: FTPuser1
 
Click Connect, enter your password and click OK.
 
 
7. Conclusion
If everything went to plan users FTPuser1 and FTPuser2 should login to \\Fileserver\FTProot\Home1 folder and user FTPuser3 should login to \\Fileserver\FTProot\Home2.
 
Links:

2014-12-30

Check Microsoft Office 2010/2013 activation type and status. Change from MAK to KMS (or from KMS to MAK). Troubleshoot KMS activation.

To check if your office is activated with MAK or KMS key:
 
1. Launch CMD as administrator
 
2. In command prompt navigate to Office installation folder:
Office 2010: C:\Program Files (x86)\Microsoft Office\Office14
Office 2013: C:\Program Files (x86)\Microsoft Office\Office15
Office 2010 x32: C:\Program Files\Microsoft Office\Office14
Office 2013 x64: C:\Program Files\Microsoft Office\Office15
 
3. In the command prompt type "cscript ospp.vbs /dstatus" (without quotes) and press enter
 
4. You can identify license type from "LICENSE NAME" and activation status from "LICENSE STATUS"
example of MAK activated Office 2013:
example of KMS activated Office 2010:
 
To change from MAK activation to KMS (or vice versa) - change to appropriate key:
 
1. Launch CMD as administrator
 
2. In command prompt navigate to Office installation folder:
Office 2010: C:\Program Files (x86)\Microsoft Office\Office14
Office 2013: C:\Program Files (x86)\Microsoft Office\Office15
Office 2010 x32: C:\Program Files\Microsoft Office\Office14
Office 2013 x64: C:\Program Files\Microsoft Office\Office15
 
3. Change to KMS key by entering the following command with corresponding KMS keys:
Office 2010 ProPlus: cscript ospp.vbs /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB
Office 2013 ProPlus: cscript ospp.vbs /inpkey:YC7DK-G2NP3-2QQC3-J6H88-GVGXT
 
note: those are KMS keys available publicly, if you need to change from KMS to MAK, enter your MAK keys instead
 
4. After changing the key you can go ahead and activate office to KMS host by entering command in the cmd: "cscript ospp.vbs /act" (without quotes).
 
If KMS activation fails you can check the following:
 
1. See if the right KMS host resolves from DNS:
In the command prompt run "nslookup -type=srv _vlmcs._tcp" (without quotes),
you should see something like this:
_vlmcs._tcp.pzu.lt      SRV service location:
          priority       = 0
          weight         = 0
          port           = 1688
          svr hostname   =
kms-host.company.com
kms-host.company.com      internet address = 192.168.1.17
 
2. If you see correct host, check if you can access it on port 1688:
in the command prompt type "telnet kms-host.company.com 1688"
If connection is successful you will see black window, if it's not successful you will receive message:
Connecting To kms-host.company.com...Could not open connection to the host, on port 1688:
Connect failed
 
3. If you see incorrect host, you should resolve problems in your infrastructure (deactivate wrong KMS hosts and delete entries from your DNS server). Meanwhile you can specify KMS host to activate to manually by running the following command "cscript ospp.vbs /sethst:kms-host.company.com" (without quotes)
and activate afterwards with the command "cscript ospp.vbs /act" (without quotes).
 
Links:

2014-12-16

Website publishing on TMG 2010. HTTP to HTTPS and domain.com to www.domain.com redirect with response code 301 (for search engine optimization and pageRank).

Consider the following scenario:
You need to publish a new secure website and to avoid situations where users can't access your site because they do not know the difference between http vs. https nor www.company.com vs. company.com

For this we will need to setup some redirection rules.

There are few ways you can do that via TMG, but it will result in 302 redirects which you want to avoid and instead use 301 response code for redirection (so I've been told by SEO guys).

So our goal is to configure IIS/TMG to redirect the following addresses with response code 301:
http://company.com
https://company.com
http://www.company.com

to https://www.company.com

First step - configuring IIS applications.

For this to work we will need two IIS applications. One for redirects and another one - the actual application.
For your actual application in IIS assign binding address: https://www.company.com
For redirection application assign bindings for addresses: http://company.com, https://company.com and http://www.company.com
And enable HTTP redirect to https://www.company.com with status code: Permanent (301).


Second step - TMG rules.
We will need two TMG rules with common weblistener.

Connections tab:
Enable HTTP connections
Enable SSL (HTTPS) connections
Do not redirect traffic from HTTP to HTTPS
First publishing rule for www.company.com (make sure it is above second rule)Bridging tab:
Redirect requests to HTTP
Redirect requests to SSL

Public name: www.company.com

Second rule for company.com (make sure it is below first rule).
Settings are identical to first rule, except for public name you specify domain company.com
After that any of the four addresses
http://company.com
https://company.com
http://www.company.com
https://www.company.com
should result in https://www.company.com

Links:
How to Allow HTTP 301 through ISA Server 2006 - http://blogs.technet.com/b/isablog/archive/2009/03/05/how-to-allow-http-301-through-isa-server-2006.aspx
Test your redirect method - http://www.redirect-checker.org/

2013-05-23

Server 2012 RDS. How to create .rdp shortcut for RemoteApp.

It seems that RDS in server 2012 won't let you create .rdp shortcuts for remote applications.

The easiest workaround I found so far is to login to your RD Web Access via Firefox and click on RemoteApp, firefox then asks if you want to open the file or save it.
Of course we want to save it :) so do just that.
Here you go an .rdp shortcut for your RemoteApp.

2013-03-18

Exchange 2010 - This attachment was removed.

Hello,
recently I've encountered a problem where .pdf attachments were being stripped for particular sender emails.

I had had no .pdf file name, file extension or MIME type listed in my Attachment Filtering Agent so it was a mystery.
You can check the config with command on the edge server:

  • Get-AttachmentFilterEntry |fl
You can also disable Attachment Filtering Agent for testing purposes using following command:
Disable-TransportAgent -Identity "Attachment Filtering agent"

After you confirmed that the problem is due to this agent you can re-enable it:
Enable-TransportAgent -Identity "Attachment Filtering agent"

At this point it was clear that Attachment Filtering Agent was stripping those particular .pdf files created by that specific sender and letting all other .pdf attachments through.

After posting my problem on technet forums it appears that for some reason Attachment Filtering Agent was recognizing those .pdf files as "invalid attachment".

To workaround this you have to do the following:

1.Stop the Microsoft Exchange Transport service.
2.Locate the EdgeTransport.exe.config file. This file is located in the following path: drive:\Program Files\Microsoft\Exchange Server\Bin\
3.Add the following entry between the element and the element of the EdgeTransport.exe.config file
4.Restart the Microsoft Exchange Transport service

Links:
http://social.technet.microsoft.com/Forums/en-US/exchange2010/thread/8c35b394-915a-475f-af88-de0a465fb5c8