Categories
TIK

Autodetect Proxy dengan WPAD

Mengenai apa itu WPAD untuk lebih jelasnya dapat dilihat pada link berikut  Expired Internet-Draft.

Untuk mengimplementasikan wpad setidaknya diperlukan pemahaman mengenai :

  • instalasi dan modifikasi web server.
  • instalasi dan setting squid proxy server atau yg lainnya.
  • instalasi dan maintenance Domain Name System.
  • instalasi dan modifikasi DHCP Server.
<!> Mohon untuk tidak menanyakan mengenai instalasi atau seting serta modifikasi hal tersebut diatas. Silahkan untuk melihat dokumentasi masing-masing topik.

 

Contoh kasus:

Saat ini dikantor saya menggunakan squid sebagai proxy dengan menggunakan system autentikasi. Sehingga setiap ada karyawan baru atau tamu maka harus disetting proxy secara manual di browser client.

Maka untuk memudahkan setting browser di client seyogyanya dapat menggunakan transparat proxy sehingga tidak perlu repot-repot harus setting proxy satu-satu di sisi user. Namun karena akses ke squid proxy menggunakan autentikasi maka hal itu tidak dapat dilakukan. Untuk itu maka dibuatlah setting autodetect proxy secara otomatis menggunakan WPAD.

 

Artikel ini tidak direkomendasikan untuk semua produk dan versi. Namun hampir semua browser saat ini sudah mengimplementasikan WPAD.

Ada beberapa metode diantaranya dengan metode Web Server,  DNS dan DHCP, namun saat ini lebih fokus pada metode Domain Name (DNS) dibanding metode DHCP karena lebih mudah.

Langkah membuat autodetect menggunakan WPAD

A. Metode Modifikasi Web Server

Yang dimaksud dengan Metode ini adalah dengan memodifikasi web server. Berikut langkahnya :

1. Buat file standar auto proxy config lalu save dengan nama wpad.dat. Berikut contohnya :

//We (www.is.co.za) run a central cache for our customers that they
//access through a firewall - thus if they want to connect to their intranet
//system (or anything in their domain at all) they have to connect
//directly - hence all the "fiddling" to see if they are trying to connect
//to their local domain.
//
//Replace each occurrence of company.com with your domain name
//and if you have some kind of intranet system, make sure
//that you put it's name in place of "internal" below.
//
//We also assume that your cache is called "cache.company.com", and
//that it runs on port 8080. Change it down at the bottom.
//
//(C) Oskar Pearson and the Internet Solution (http://www.is.co.za)

function FindProxyForURL(url, host)
{
    //If they have only specified a hostname, go directly.
    if (isPlainHostName(host))
            return "DIRECT";

    //These connect directly if the machine they are trying to
    //connect to starts with "intranet" - ie http://intranet
    //Connect  directly if it is intranet.*
    //If you have another machine that you want them to
    //access directly, replace "internal*" with that
    //machine's name
    if (shExpMatch( host, "intranet*")||
                    shExpMatch(host, "internal*"))
        return "DIRECT";

    //Connect directly to our domains (NB for Important News)
    if (dnsDomainIs( host,"company.com")||
    //If you have another domain that you wish to connect to
    //directly, put it in here
                    dnsDomainIs(host,"sistercompany.com"))
        return "DIRECT";

    //So the error message "no such host" will appear through the
    //normal Netscape box - less support queries :)
    if (!isResolvable(host))
            return "DIRECT";

    //We only cache http, ftp and gopher
    if (url.substring(0, 5) == "http:" ||
                    url.substring(0, 4) == "ftp:"||
                    url.substring(0, 7) == "gopher:")

    //Change the ":8080" to the port that your cache
    //runs on, and "cache.company.com" to the machine that
    //you run the cache on
            return "PROXY cache.company.com:8080; DIRECT";

    //We don't cache WAIS
    if (url.substring(0, 5) == "wais:")
            return "DIRECT";

    else
            return "DIRECT";
}

 

atau download di sini lalu save dengan nama wpad.dat.

2.  Simpan/copy file tersebut di direktori document root pada web server.

3.  Coba akses file tersebut menggunakan browser seperti berikut:

http://www.example.com/wpad.dat

selanjutnya akan muncul text script pada browser.

4.  Selanjutnya sisipkan entri berikut pada bagian mime.type di file konfigurasi web server. Untuk apache masukkan entri berikut :
AddType application/x-ns-proxy-autoconfig .dat

Lalu restart web server agar seting mime berfungsi.

5. Selanjutnya test script tersebut menggunakan browser

  1. Firefox
    Pada menu tools, pilih option (untuk windows) atau Edit, pilih preference (untuk linux), Advanced, Network, Settings, set Automatic proxy configuration url lalu isi dgn http://www.example.com/wpad.dat
  2. Internet Explore
    Pada Tools, Internet Options, Connection, Setting atau Lan Settings, set hanyaUse Automatic Configuration Script dengan url :http://www.example.com/wpad.dat

Pastikan semua berfungsi dengan baik agar bisa melanjutkan ke tahap berikutnya. Apabila masih belum berjalan dengan baik ulangi langkah diatas.

B. Metode Automatic WPAD dengan DNS

Metode ini hampir sama dengan metode modifikasi web server, namun ditambah dengan modifikasi/penambahan record pada DNS Server.

1. Buat DNS record untuk subdomain wpad.example.com

2. Dalam artikel ini kami menggunakan bind sg DNS server, lalu tambahkan baris berikut :
wpad            IN    A    192.168.0.1  ;sesuaikan ip address anda
lalu restart bind/ dns server

3.  Pastikan alamat subdomain baru tersebut bisa di resolve

# dig wpad.example.com

;; QUESTION SECTION:
;wpad.lintasnet.com.		IN	A

;; ANSWER SECTION:
wpad.example.com.	86400	IN	A	192.168.0.1

;; AUTHORITY SECTION:
example.com.		86400	IN	NS	ns1.example.com.
example.com.		86400	IN	NS	ns2.example.com.

4. Lakukan test seperti langkah 5 diatas dengan mengganti alamat url menjadi http://wpad.example.com/wpad.dat.

5. Selanjutnya lakukan setup pada browser seperti langkah 5 diatas dengan mengganti seting ke “Auto-detect proxy setting for Network” untuk Firefox dan “Automatically detect settings” untuk Internet Explorer.

C. Metode Automatic WPAD dengan DHCP

1. Untuk dapat melakukan automatic wpad dengan menggunakan  DHCP, tambahkan line berikut pada file dhcpd.conf:

option WPAD code 252 = string;
option WPAD "http://wpad.example.com/wpad.datn";

Lalu restart DHCP server

2. Lakukan langkah 5 pada setting browser seperti diatas

Cat :

Bahwa metode DHCP tidak berjalan dengan baik pada beberapa versi Internet Explorer. Sedangkan penggunaan metode DNS lebih reliable/handal dalam menemukan wpad.dat.

Sekarang kita tidak perlu repot harus mengisi seting proxy secara manual di masing-masing client. Cukup dengan merubah setting proxy ke setingan otomatis, maka user sudah bisa menggunakan proxy server.

Semoga bermanfaat.

Sumber Autodetect Proxy dengan WPAD :

  1. http://wiki.squid-cache.org/SquidFaq/ConfiguringBrowsers
  2. http://www.wlug.org.nz/WPAD
  3. http://blog.rusmana.org/

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from Just Shared on Tel-U

Subscribe now to keep reading and get access to the full archive.

Continue reading