Acij 040103
Acij 040103
Acij 040103
1, January 2013
Design and Implementation of an IP based authentication mechanism for Open Source Proxy Servers in Interception Mode
Tejaswi Agarwal1 and Mike Leonetti2
1
ABSTRACT
Proxy servers are being increasingly deployed at organizations for performance benefits; however, there still exists drawbacks in ease of client authentication in interception proxy mode mainly for Open Source Proxy Servers. Technically, an interception mode is not designed for client authentication, but implementation in certain organizations does require this feature. In this paper, we focus on the World Wide Web, highlight the existing transparent proxy authentication mechanisms, its drawbacks and propose an authentication scheme for transparent proxy users by using external scripts based on the clients Internet Protocol Address. This authentication mechanism has been implemented and verified on Squid-one of the most widely used HTTP Open Source Proxy Server.
KEYWORDS
Interception Proxy, Authentication, Squid, Cookie Based Authentication
1. INTRODUCTION
The reach of internet connectivity has penetrated tremendously over the last decade, and with such a growing demand, there has been an increase in the access and response time of the World Wide Web. Increase in bandwidth has not necessarily helped in decreasing the access time [1]. This has prompted organizations to deploy proxy servers which would cache Internet resources for re-use by the set of clients connected to a network. Proxy servers are systems deployed to act as an intermediary for clients seeking resources from other servers or clients to connect to the World Wide Web. Proxy servers are deployed to keep clients anonymous, to block unwanted content on a network, to save network bandwidth by supplying commonly accessed data to clients, and to log and audit client usage [2]. Every request from the client passes through the proxy server, which in turn may or may not modify the client request based on its implementation mechanism. Client authentication is an essential feature required in situations where users would need to authenticate in order to access the Internet. Client authentication is easily configurable in nontransparent mode where every client will have to suitably modify the workstation browser
DOI : 10.5121/acij.2013.4103 23
settings. A non-transparent proxy requires client configuration on each client system connected to the network by manually specifying the proxy servers IP address or DNS. Large organizations, where manually configuring every client is an overhead, turn to the use of proxy servers in interception mode for ease of configuration and access. However, client authentication in interception mode is not suitably designed in Open Source Proxy Servers. Interception Proxying works by having an active agent (the proxy) where there should be none. The browser does not expect a proxy server to be present and is being confused when the request comes from the proxy server in intercepting mode. A user of the browser wouldnt expect credentials to be sent to a third party when it is not expecting a proxy server. Hence browsers are designed not to give away credentials when it is not manually configured to a proxy server. To overcome the limitations of client authentication we designed a mechanism for user authentication in Interception mode using external PERL scripts. The authentication mechanism maintains a centralised database of logged in users based on client IP address and deny access to the clients who are not logged in. The scripts are designed in a way to accept user input of credentials, verify it against an existing LDAP directory and log the user IP on the database for a specified amount of time if the credentials are correct, thus allowing Internet access to this particular client. We have implemented and verified this using Squid, one of the most widely used proxy servers. Squid is very well adept to tackle external Access Control lists, and hence, it would conveniently verify against an SQL table if the script to check for the validity of IP address in the table, is externally linked to Squid in its configuration file. Section 2 will throw light on Transparent Proxy and issues with authentication in transparent proxy. Section 3 explains the existing authentication mechanisms in transparent mode and its drawbacks. Section 4 discusses the algorithm used in our authentication mechanism in detail and its design. Section 5 will explain on the two types of implementation scenario based on how the proxy server is set up. We conclude with a discussion on performance and future aspects of this mechanism.
results in silent corruption of the security credentials in the context of the browser. Thus authentication in interception mode fails due to security feature enabled in browsers which prevents credentials being sent to an unknown host.
3.EXISTING MECHANISM
A. Captive Portal and its constraints A captive portal is a Web page that the user of a public-access network is obliged to view and interact with before access is granted. Captive Portal is implemented in transparent mode where it forces an HTTP client connected to the network to pass through a special web-page mostly for authentication purpose. All client packets are intercepted, until the user authenticates itself via a web-browser. Captive Portals are deployed at several open Wi-Fi hotspots to control Internet Access. In the case of Captive Portals, the entire Internet becomes unavailable to all users who are not logged in. This implies any packets regardless of destination port or IP address are blocked until a user passes authentication. A client will always have to first authenticate with the help of a browser, even if it does not intend to use the browser. With transparent proxy authentication clients are only restricted web usage and with the proxy servers granular ACL rules, more control can be given on what web pages can be "whitelisted" or "blacklisted". This type of flexibility on Internet restriction makes it more ideal for organizations who still wish to have its users restricted from checking social media websites and becoming distracted while not interrupting important processes like software updates or other Internet programs that would be necessary for productivity.
When a request comes through Squid and its user defined ACL rules decide that authentication is required before the client can either be allowed or denied the page, it calls upon the Perl script using the requesting client's IP. At that point the Perl script then performs a query on a MySQL database table to see if the IP address of the client exists as being authenticated and that his authentication session is not expired. If the IP address is found in the table and the session is not expired, the requested web page will be displayed just as it normally would. However, if the IP address is not found or the session is expired custom web page will be displayed in its place describing the details of the access issue and that authentication is needed. On that access denied page a link is then displayed with further instructions for proper authentication. When the user clicks on said link, he is brought to another custom Perl/CGI program that will allow him to input his user, password, and desired duration of access. On successful authentication, the IP of his machine will then be added to the MySQL table of authenticated IP addresses. The user then has the ability to browse the Internet until the session expires according to the use of the previous Perl program. In this method, any form of authentication can become applicable. For example, organisations can take advantage of internal LDAP or ActiveDirectory users and groups to centrally manage user Internet access. On the other end of the spectrum, users can also be stored in a flat file on another server. Other authentication policies like combination of text and graphical passwords could also be used [12]. With the help of the figure given below, we explain our design with an LDAP directory.
26
1. Client requests internet access which passes through Squid Proxy server.
2. Squid through an external ACL and PERL script checks the SQL database whether the client IP is present in the database for allowing Internet Access. 3. The PERL script returns a value of OK in case the client IP is logged and allows internet access. The script intimates Squid by sending a return ERR in case the client IP is not in the SQL Database. 4. Squid, on receiving a value of OK grants internet access to the client for a specific time as permitted by the Access Control Lists. 5. Squid, on receiving a value ERR is configured to send the user an external page for authentication. This is achieved by modifying Squid Access Control Lists.
6. Client credentials are verified through an existing LDAP directory containing usernames and passwords. Internet access is allowed to the user on successful authentication credentials. 7. User IP is logged into the SQL table for a specific amount of time, before the user has to login again.
Figure 4: Successful Login for Specified Time The user IP address will be automatically deleted from the SQL table once the user session is timed out. Configurable user session limits, inactivity timers, and user name request polls are other methods to determine user logout status. Upon user logout, the User IP address is deleted from the SQL table confirming that the user has logged out and terminating the session. The pseudo code, which eliminates IP address from the table and checks for an existing IP address is as follows:
while( <STDIN> ) { # Store the IP address $ip_address = $_; $current_time = time(); $dbh = DBI->connect( "dbi:mysql:$mysql_db;$mysql_host", $mysql_user, $mysql_pass ); $dbh->do( qq/DELETE FROM addresses WHERE `end_time`<$current_time;/ ); $dbh->do( q/DELETE FROM `groups` WHERE NOT EXISTS (SELECT `user` FROM `addresses` WHERE `user`=`groups`.`user`);/ ); $query_handle = $dbh->prepare( qq/SELECT `addresses`.`user` FROM `addresses` JOIN `groups` USING(`user`) WHERE `addresses`.`ip`='$ip_address' AND `groups`.`group`='$group' LIMIT 0, 1;/ ); $query_handle->execute(); # Make sure the value exists first @result = $query_handle->fetchrow_array(); if( @result and defined($result[0]) ) { print( "OK user=".$result[1]."\n" ); } else 28
Advanced Computing: An International Journal ( ACIJ ), Vol.4, No.1, January 2013 { print( "ERR\n" ); } $query_handle->finish(); $dbh->disconnect(); }
5.IMPLEMENTATION
The design proposed above was successfully implemented and tested using Squid proxy server in two ways. Type 1 requires Squid to be on the router/gateway system. In this implementation, packets marked to be forwarded to destination port 80 are redirected to the local Squid port on the machine (port 3128 by default). Type 2 allows for Squid to be placed on a separate server. In this implementation, the router will recognize packets being forwarded with a destination port of 80, as in Type 1, but it will opt to route these packets through the server with Squid. Rules on the router will then allow the server with Squid will also then allow all traffic forwarded from that machine to destination port 80 as normal passage. Implementation of the two scenarios have slightly different requirements and therefore have slightly different configurations.
29
Figure 5: Type 1 implementation with Squid is directly on the gateway Due to the Time to Live option on the Squid external access control, web pages that have already been cleared for access have that setting cached for a certain period of time [10]. In the case of this scenario the TTL time was set to five minutes. Also, MySQL has been tuned so that more memory would be used for caching tables so that IO access frequency can be limited to save time [11]. Due to these optimizations, the performance penalty for the queries run per page request is negligible. Users are able to browse the Internet normally without noticing any changes. Users with login privileges through the special login page adapt quickly to be able to enter their username and password to extend their web access. The ability to manage the users who have access in LDAP becomes great advantage as well for management.
Figure 6: Type 2 implementation where Squid is on a Virtual Machine This design was implemented with 10 clients using Citrix Desktop virtual machines with different dynamic IPs for each machine. It features the same table structures and Perl programs as described in Type 1 implementation. However, in this scenario Squid is configured in the access control rules to deny a list of bad or blacklisted domains and allow all other web pages. In addition, the external access rule running our special Perl program, takes precedence over the blacklisted domains. Effectively, in Type 2 as in Type 1, users are unaware of the presence of the proxy itself. Despite being location on a VM, Again, users adapt quickly to being able to log in to elevate their browsing privileges.
31
Transparent Web Proxy No Sonicwall Firewall No Device Squid Transparent Web Proxy+Script (Proposed) No
8. ACKNOWLEDGEMENT
This work was carried out at Indian Institute of Technology, Madras under the guidance of and Dr. V. Kamakoti and Vasan Srini. We thank them for their feedback and support.
9. REFERENCES
[1] R. Howard, and B. J. Jansen, "A Proxy server experiment: an indication of the changing nature of the web," Proc of the Seventh International Conference on computer Communications and Networks (ICCCN '98), pp. 646649, Washington, DC, October 1998. [2] Squid Cache Wiki. http://wiki.squid-cache.org/WhySquid [3] IETF Requests for Comments 2616 http://www.ietf.org/rfc/rfc2616.txt [4] IETF Requests for Comments 1919 http://www.ietf.org/rfc/rfc1919.txt [5] IETF Requests for Comments 2109 http://www.ietf.org/rfc/rfc2109.txt [6] Yamai, N. Okayama K. and Nakamura, M. An Identification Method of PCs behind NAT Router with Proxy Authentication on HTTP Communication 2011 IEEE/IPSJ International Symposium on Applications and the Internet (SAINT 11),Munich Bavaria, July 2011 [7] Transparent Proxying with Squid http://linuxdevcenter.com/pub/a/linux/2001/10/25/transparent_proxy.html [8] Squid HTTP Port Documentation http://www.squid-cache.org/Doc/config/http_port/ [9] Squid Interception Proxy setup. http://wiki.squid-cache.org/SquidFaq/InterceptionProxy 32
Advanced Computing: An International Journal ( ACIJ ), Vol.4, No.1, January 2013 [10] Squid External ACL type. http://www.squid-cache.org/Doc/config/external_acl_type/) [11] InnoDB configuration http://dev.mysql.com/doc/refman/5.0/en/innodb-configuration.html
[12] Chandrashekar Singh, Lenandlar Singh, Investigating the Combination of Text and Graphical
Passwords for a more secure and usable experience, International Journal of Network Security & Its Applications (IJNSA), Vol.3, No.2, March 2011 [13] A. Niemi, J. Arkko, V. Torvine, "Hypertext Transfer Protocol (HTTP) Digest Authentication using Authentication and Key Agreement (AKA)", IETF Request for Comments RFC 3310, September 2002
33