Difference between revisions of "WiFi: HotSpot - CoovaChilli Instalasi Apache dan SSL"

From OnnoWiki
Jump to navigation Jump to search
(New page: Apache Server Create login page We need to create a login page. Fortunately the creators of coovachilli have included hotspotlogin.cgi with the source code: To find this file use this c...)
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Apache Server
+
==Instalasi Modul Apache==
  
Create login page
+
Kita butuh membuat halaman login melalui Web. Kita beruntung, pembuat CoocaChilli sudah membuatkan hotspotlogin.cgi di [[source code]]. Bisa di cari menggunakan perintah
  
We need to create a login page. Fortunately the creators of coovachilli have included hotspotlogin.cgi with the source code:
+
find / | grep 'hotspotlogin.cgi'
  
To find this file use this command:
+
Dalam contoh, file tersebut dapat di peroleh di
  
find / | grep 'hotspotlogin.cgi'
+
/usr/share/doc/coova-chilli/hotspotlogin.cgi.gz
  
In our example the file we require is found in:
+
Kita perlu membuat directory di Apache Web Server. Copy hotspotlogin.cgi dan ubah mode agar bisa di jalankan.
  
/usr/share/doc/coova-chilli/hotspotlogin.cgi.gz
+
sudo mkdir -p /var/www/hotspot/cgi-bin
 
+
zcat -c /usr/share/doc/coova-chilli/hotspotlogin.cgi.gz | sudo tee /var/www/hotspot/cgi-bin/hotspotlogin.cgi
We need to create a directory in our apache web server, copy hotspotlogin.cgi and make it executable.
+
sudo chmod a+x /var/www/hotspot/cgi-bin/hotspotlogin.cgi
 
 
sudo mkdir -p /var/www/hotspot/cgi-bin
 
zcat -c /usr/share/doc/coova-chilli/hotspotlogin.cgi.gz | sudo tee /var/www/hotspot/cgi-bin/hotspotlogin.cgi
 
sudo chmod a+x /var/www/hotspot/cgi-bin/hotspotlogin.cgi
 
  
 
edit login script
 
edit login script
  
nano -w /var/www/hotspot/cgi-bin/hotspotlogin.cgi
+
vi /var/www/hotspot/cgi-bin/hotspotlogin.cgi
  
Uncomment and change password
+
Uncomment dan ubah password
  
$uamsecret = "uamsecret";
+
$uamsecret = "uamsecret";
$userpassword=1;
+
$userpassword=1;
  
if you like to edit the page later, don't use print "HTML code"; use
+
Jika anda ingin mengedit halaman dikemudian hari, jangan gunakan print "HTML code"; gunakan
  
print <<ENDHTML;
+
print <<ENDHTML;
....your HTML code here.....
+
....source code HTML anda disini.....
 +
 +
ENDHTML
  
ENDHTML
+
Dengan cara ini anda tidak perlu keluar dari double quote.
  
this way you don't need to escape the double quotes.
+
==Instalasi Modul SSL==
SSL
 
  
Apache Modules
+
Untuk menginstalasi modul Apache2 untuk authentikasi MySQL, anda dapat menjalankan perintah berikut
  
To install the Apache2 module for MYSQL authentication, you can run the following command from a terminal prompt:
+
sudo apt-get install libapache2-mod-auth-mysql
  
sudo apt-get install libapache2-mod-auth-mysql
+
Setelah modul di install, modul akan tersedia di /etc/apache2/mods-available. Kita dapat menggunakan perintah a2enmod untuk mengaktifkan modul. Kita juga dapat menggunakan perintah a2dismod untuk mendisable module. Jika module telah di aktifkan, maka modul tersebut tersedia di /etc/apache2/mods-enabled.
  
Once you install the module, the module will be available in the /etc/apache2/mods-available directory. You can use the a2enmod command to enable a module. You can use the a2dismod command to disable a module. Once you enable the module, the module will be available in the the /etc/apache2/mods-enabled directory.
+
==Setup Apache dan SSL==
Setup up Apache and SSL
 
  
Make sure LAMP server is installed, if not use the following command:
+
Pastikan bahwa Server LAMP terinstalasi, jika tidak kita dapat menginstalasi melalui perintah
  
tasksel
+
tasksel
  
Create a Certificate
+
Buat sertifikat
  
sudo apt-get install ssl-cert
+
sudo apt-get install ssl-cert
 +
sudo mkdir /etc/apache2/ssl
  
sudo mkdir /etc/apache2/ssl
+
Kita perlu mengetahui hostname untuk cert sertifikat digital
  
We need to find our host name for our cert
+
hostname -f
  
hostname -f
+
masukan (hardcoding) cert lifetime sesuai dengan patch http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=293821#22
  
Hardcoding cert lifetime based on this patch: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=293821#22
+
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
  
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
 
  
(Answer questions)
+
CATATAN: "Host Name" harus diisi dengan benar dengan hostname dari server yang akan digunakan sertifikatnya.
  
    * Note: The "Host Name" must be fill out correctly The host name of the server the certificate is for. This must be filled in. (commonName)
+
Host Name sesuai dengan hostname -f
 +
host.name #ubah hostname sesuai dengan anda
  
Host Name as per hostname -f
+
==Instalasi Modul==
  
host.name #change to your host name
+
Modul mod_ssl menambahkan fitur penting di Apache2 server agar dapat berkomunikasi dengan terenkripsi. Oleh karenanya browser akan berkomunikasi menggunakan enkripsi SSL. Hal ini akan tampak pada prefix https:// digunakan pada awal dari Uniform Resource Locator (URL) di browser.
  
Install Module
+
sudo a2enmod ssl
 +
/etc/init.d/apache2 force-reload
  
The mod_ssl module adds an important feature to the Apache2 server - the ability to encrypt communications. Thus, when your browser is communicating using SSL encryption, the https:// prefix is used at the beginning of the Uniform Resource Locator (URL) in the browser navigation bar.
+
==Membuat Virtual Host==
  
sudo a2enmod ssl
+
Membuat virtualhost kita perlu membuat seperti berikut
  
/etc/init.d/apache2 force-reload
+
vi /etc/apache2/sites-available/hotspot
  
Create virtualhost
+
NameVirtualHost 10.1.0.1:443
 +
<VirtualHost 10.1.0.1:443>
 +
        ServerAdmin webmaster@domain.org
 +
        DocumentRoot "/var/www/hotspot"
 +
        ServerName "10.1.0.1"
 +
        <Directory "/var/www/hotspot/">
 +
                Options Indexes FollowSymLinks MultiViews
 +
                AllowOverride None
 +
                Order allow,deny
 +
                allow from all
 +
        </Directory>
 +
 +
        Alias "/dialupadmin/" "/usr/share/freeradius-dialupadmin/htdocs/"
 +
        <Directory "/usr/share/freeradius-dialupadmin/htdocs/">
 +
                Options Indexes FollowSymLinks MultiViews
 +
                AllowOverride None
 +
                Order allow,deny
 +
                allow from all
 +
        </Directory>
 +
 +
        ScriptAlias /cgi-bin/ /var/www/hotspot/cgi-bin/ #this here is a alias with no hotspot path !!!!!!!
 +
        <Directory "/var/www/hotspot/cgi-bin/">
 +
                AllowOverride None
 +
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
 +
                Order allow,deny
 +
                Allow from all
 +
        </Directory>
 +
 +
        ErrorLog /var/log/apache2/hotspot-error.log
 +
 +
        LogLevel warn
 +
 +
        CustomLog /var/log/apache2/hotspot-access.log combined
 +
 +
        ServerSignature On
 +
        SSLEngine on
 +
        SSLCertificateFile /etc/apache2/ssl/apache.pem
 +
</VirtualHost>
  
Create a virtualhost file so it looks something like this:
+
Aktifkan SSL virtualhost
  
sudo nano -w /etc/apache2/sites-available/hotspot
+
sudo a2ensite hotspot
 +
/etc/init.d/apache2 reload
  
NameVirtualHost 10.1.0.1:443
+
==Buka Port==
<VirtualHost 10.1.0.1:443>
 
        ServerAdmin webmaster@domain.org
 
        DocumentRoot "/var/www/hotspot"
 
        ServerName "10.1.0.1"
 
        <Directory "/var/www/hotspot/">
 
                Options Indexes FollowSymLinks MultiViews
 
                AllowOverride None
 
                Order allow,deny
 
                allow from all
 
        </Directory>
 
  
        Alias "/dialupadmin/" "/usr/share/freeradius-dialupadmin/htdocs/"
+
HTTPS harus memonitor port 443. Kita perlu membuka line berikut pada /etc/apache2/ports.conf:
        <Directory "/usr/share/freeradius-dialupadmin/htdocs/">
 
                Options Indexes FollowSymLinks MultiViews
 
                AllowOverride None
 
                Order allow,deny
 
                allow from all
 
        </Directory>
 
  
        ScriptAlias /cgi-bin/ /var/www/hotspot/cgi-bin/ #this here is a alias with no hotspot path !!!!!!!
+
vi /etc/apache2/ports.conf
        <Directory "/var/www/hotspot/cgi-bin/">
 
                AllowOverride None
 
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
 
                Order allow,deny
 
                Allow from all
 
        </Directory>
 
  
        ErrorLog /var/log/apache2/hotspot-error.log
+
Listen *:443
 +
Listen *:80
 +
#<IfModule mod_ssl.c>
 +
#    Listen 443
 +
#</IfModule>
  
        LogLevel warn
+
Jangan lupa untuk menggubah
  
        CustomLog /var/log/apache2/hotspot-access.log combined
+
vi /etc/apache2/sites-available/default
  
        ServerSignature On
+
NameVirtualHost *:80
        SSLEngine on
+
<virtualhost *:80>
        SSLCertificateFile /etc/apache2/ssl/apache.pem
 
</VirtualHost>
 
  
Enable SSL virtualhost
+
Juga pada Server Root
  
sudo a2ensite hotspot
+
vi /etc/apache2/apache2.conf
  
/etc/init.d/apache2 reload
+
tambahkan
  
Listen Ports
+
ServerName 10.1.0.1
  
HTTPS should listen on port number 443. You should add the following line to the /etc/apache2/ports.conf file:
+
Edit file host
  
nano -w /etc/apache2/ports.conf
+
nano -w /etc/hosts
  
Listen *:443
+
10.1.0.1   host.name host # ubah ke nama hostname anda
Listen *:80
 
#<IfModule mod_ssl.c>
 
#   Listen 443
 
#</IfModule>
 
  
don't forget to modify
+
Restart Apache server
  
sudo nano -w /etc/apache2/sites-available/default
+
sudo /etc/init.d/apache2 restart
  
NameVirtualHost *:80
+
Coba akses ke
<virtualhost *:80>
 
  
Server Root
+
https://10.1.0.1/cgi-bin/hotspotlogin.cgi
  
nano -w /etc/apache2/apache2.conf
+
dan
  
add
+
http://10.1.0.1:3990/
 
 
ServerName 10.1.0.1
 
 
 
Edit host file
 
 
 
nano -w /etc/hosts
 
 
 
10.1.0.1   host.name host #change to your host name
 
 
 
Restart Apache server
 
  
sudo /etc/init.d/apache2 restart
+
==Selesai==
  
your web broswer should be able to link to pages
+
Reboot komputer untuk memastikan tidak ada masalah sama sekali.
  
https://10.1.0.1/cgi-bin/hotspotlogin.cgi
+
reboot
  
and
 
  
http://10.1.0.1:3990/
 
  
Finish
+
==Pranala Menarik==
  
Reboot your computer and everything should work, lol does that really need a reboot???? whatever lets restart:
+
* [[WiFi: HotSpot - CoovaChilli Pendahuluan]]
 +
* [[WiFi: HotSpot - CoovaChilli Kebutuhan Hardware dan Software]]
 +
* [[WiFi: HotSpot - CoovaChilli Instalasi Radius Server]]
 +
* [[WiFi: HotSpot - Instalasi CoovaChilli]]
 +
* [[WiFi: HotSpot - CoovaChilli Instalasi Firewall]]
 +
* [[WiFi: HotSpot - CoovaChilli Instalasi Apache dan SSL]]
 +
* [[WiFi: HotSpot - CoovaChilli Fitur dan Keterangan Tambahan]]
 +
* [[WiFi: HotSpot]]
  
reboot
+
[[Category: WiFi]]
 +
[[Category: HotSpot]]
 +
[[Category: CoovaChilli]]

Latest revision as of 09:19, 11 May 2010

Instalasi Modul Apache

Kita butuh membuat halaman login melalui Web. Kita beruntung, pembuat CoocaChilli sudah membuatkan hotspotlogin.cgi di source code. Bisa di cari menggunakan perintah

find / | grep 'hotspotlogin.cgi'

Dalam contoh, file tersebut dapat di peroleh di

/usr/share/doc/coova-chilli/hotspotlogin.cgi.gz

Kita perlu membuat directory di Apache Web Server. Copy hotspotlogin.cgi dan ubah mode agar bisa di jalankan.

sudo mkdir -p /var/www/hotspot/cgi-bin
zcat -c /usr/share/doc/coova-chilli/hotspotlogin.cgi.gz | sudo tee /var/www/hotspot/cgi-bin/hotspotlogin.cgi
sudo chmod a+x /var/www/hotspot/cgi-bin/hotspotlogin.cgi

edit login script

vi /var/www/hotspot/cgi-bin/hotspotlogin.cgi

Uncomment dan ubah password

$uamsecret = "uamsecret";
$userpassword=1;

Jika anda ingin mengedit halaman dikemudian hari, jangan gunakan print "HTML code"; gunakan

print <<ENDHTML;
....source code HTML anda disini.....

ENDHTML 

Dengan cara ini anda tidak perlu keluar dari double quote.

Instalasi Modul SSL

Untuk menginstalasi modul Apache2 untuk authentikasi MySQL, anda dapat menjalankan perintah berikut

sudo apt-get install libapache2-mod-auth-mysql

Setelah modul di install, modul akan tersedia di /etc/apache2/mods-available. Kita dapat menggunakan perintah a2enmod untuk mengaktifkan modul. Kita juga dapat menggunakan perintah a2dismod untuk mendisable module. Jika module telah di aktifkan, maka modul tersebut tersedia di /etc/apache2/mods-enabled.

Setup Apache dan SSL

Pastikan bahwa Server LAMP terinstalasi, jika tidak kita dapat menginstalasi melalui perintah

tasksel

Buat sertifikat

sudo apt-get install ssl-cert
sudo mkdir /etc/apache2/ssl

Kita perlu mengetahui hostname untuk cert sertifikat digital

hostname -f

masukan (hardcoding) cert lifetime sesuai dengan patch http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=293821#22

sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem


CATATAN: "Host Name" harus diisi dengan benar dengan hostname dari server yang akan digunakan sertifikatnya.

Host Name sesuai dengan hostname -f
host.name #ubah hostname sesuai dengan anda

Instalasi Modul

Modul mod_ssl menambahkan fitur penting di Apache2 server agar dapat berkomunikasi dengan terenkripsi. Oleh karenanya browser akan berkomunikasi menggunakan enkripsi SSL. Hal ini akan tampak pada prefix https:// digunakan pada awal dari Uniform Resource Locator (URL) di browser.

sudo a2enmod ssl
/etc/init.d/apache2 force-reload

Membuat Virtual Host

Membuat virtualhost kita perlu membuat seperti berikut

vi /etc/apache2/sites-available/hotspot
NameVirtualHost 10.1.0.1:443
<VirtualHost 10.1.0.1:443>
        ServerAdmin webmaster@domain.org
        DocumentRoot "/var/www/hotspot"
        ServerName "10.1.0.1"
        <Directory "/var/www/hotspot/">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory> 

        Alias "/dialupadmin/" "/usr/share/freeradius-dialupadmin/htdocs/" 
        <Directory "/usr/share/freeradius-dialupadmin/htdocs/"> 
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /var/www/hotspot/cgi-bin/ #this here is a alias with no hotspot path !!!!!!!
        <Directory "/var/www/hotspot/cgi-bin/">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/hotspot-error.log 

        LogLevel warn

        CustomLog /var/log/apache2/hotspot-access.log combined 

        ServerSignature On 
        SSLEngine on 
        SSLCertificateFile /etc/apache2/ssl/apache.pem
</VirtualHost>

Aktifkan SSL virtualhost

sudo a2ensite hotspot
/etc/init.d/apache2 reload

Buka Port

HTTPS harus memonitor port 443. Kita perlu membuka line berikut pada /etc/apache2/ports.conf:

vi /etc/apache2/ports.conf
Listen *:443
Listen *:80
#<IfModule mod_ssl.c>
#    Listen 443
#</IfModule>

Jangan lupa untuk menggubah

vi /etc/apache2/sites-available/default
NameVirtualHost *:80
<virtualhost *:80>

Juga pada Server Root

vi /etc/apache2/apache2.conf

tambahkan

ServerName 10.1.0.1

Edit file host

nano -w /etc/hosts
10.1.0.1    host.name host # ubah ke nama hostname anda

Restart Apache server

sudo /etc/init.d/apache2 restart

Coba akses ke

https://10.1.0.1/cgi-bin/hotspotlogin.cgi

dan

http://10.1.0.1:3990/

Selesai

Reboot komputer untuk memastikan tidak ada masalah sama sekali.

reboot


Pranala Menarik