Senin, 14 Desember 2009

konfigurasi radius di freebsd

saya baru belajar freebsd so kl da yg salah tlg dibenerin yak langsung ke pokok bahasan aj yak biar g terlalu ngaret.

begini ni langkah-langkahnya :

Pastikan ports sudah di update ke versi terakhir.

1. Install FreeRadius, enablekan dukungan MYSQL saja.

2. Install MYSQL server.

3. Ubah rc.conf, tambahkan baris ini :

mysql_enable=”YES”

radiusd_enable=”YES”

4. Konfigurasi database dan impor sql

Disini saya menggunakan database yang terbaru dari freebsd yaitu menggunakan mysql60-server. Jalankan Database

mailserver# /usr/local/etc/rc.d/mysql-server start
Starting mysql.

mailserver# mysql -u root -p

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
+——————–+
2 rows in set (0.00 sec)

mysql> create database freeradius;
Query OK, 1 row affected (0.00 sec)

Import database

mailserver# mysql -uroot -p freeradius < /usr/local/share/doc/freeradius/examples/mysql.sql
Enter password:

Grant akses ke database freeradius

mysql> grant all privileges on freeradius.* to zeeboy@localhost identified by ‘1234’ with grant option;

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

5. Modifikasi setting file2 terkait.

Modif sql.conf

mailserver# cd /usr/local/etc/raddb

mailserver# ee sql.conf

# Connect info
server = “localhost”
login = “zeeboy”
password = “1234”

# Database table configuration
radius_db = “freeradius”

simpan.

Modif akses ke client radius :

mailserver# ee clients.conf

secret = 1234

simpan.

Modif radiusd.conf

mailserver# ee radiusd.conf

cari ’sql’ di bagian authorize dan accounting. Buang tanda # di depannya.

6. Jalankan service radius

mailserver# /usr/local/etc/rc.d/radiusd start
Starting radiusd.
Thu Jul 10 06:52:32 2008 : Info: Starting – reading configuration files …

mailserver# ps -ax | grep radius
96134 ?? IsJ 0:00.00 /usr/local/sbin/radiusd
96248 p0 S+J 0:00.00 grep radius

7. Tes servicenya

mailserver# ee users

Tambahkan baris ini di paling bawah :

zeeboy Auth-Type := Local, User-Password == “coba”

client 10.14.2.0/24 {
secret = 1234
shortname = private-network-1
}

simpan dan restart radiusnya.

Coba tes:

mailserver# radtest zeeboy coba 10.14.2.14 1812 1234
Sending Access-Request of id 102 to 10.14.2.14 port 1812
User-Name = “zeeboy”
User-Password = “coba”
NAS-IP-Address = 255.255.255.255
NAS-Port = 1812
rad_recv: Access-Accept packet from host 10.14.2.14:1812, id=102, length=20

next step gan :))

8. Input data tes

mysql> use freeradius;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>

Insert data dummy

mysql> INSERT INTO radcheck (UserName, Attribute, Value) VALUES (’zeeboy12’, ‘Password’, ‘12345’);

mysql> INSERT INTO radgroupcheck (GroupName, Attribute, Value) VALUES (’dynamic’, ‘Auth-Type’, ‘Local’);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO radgroupreply (GroupName, Attribute, op, Value) VALUES (’dynamic’, ‘Framed-Compression’, ‘:=’,

‘Van-Jacobsen-TCP-IP’);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO radgroupreply (GroupName, Attribute, op, Value) VALUES (’dynamic’, ‘Framed-Protocol’, ‘:=’, ‘PPP’);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO radgroupreply (GroupName, Attribute, op, Value) VALUES (’dynamic’, ‘Service-Type’, ‘:=’, ‘Framed-User’);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO radgroupreply (GroupName, Attribute, op, Value) VALUES (’dynamic’, ‘Framed-MTU’, ‘:=’, ‘1500′);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO radgroupreply (GroupName, Attribute, op, Value) VALUES (’dynamic’, ‘X-Ascend-Assign-IP-Pool’, ‘:=’, ‘0′);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO radgroupreply (GroupName, Attribute, op, Value) VALUES (’dynamic’, ‘X-Ascend-Maximum-Time’, ‘:=’, ‘7200′);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO radgroupreply (GroupName, Attribute, op, Value) VALUES (’dynamic’, ‘X-Ascend-Route-IP’, ‘:=’,

‘Route-IP-Yes’);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO radgroupreply (GroupName, Attribute, op, Value) VALUES (’dynamic’, ‘Idle-Timeout’, ‘:=’, ‘1800′);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO usergroup (UserName, GroupName) VALUES (’zeeboy12’,’dynamic’);
Query OK, 1 row affected (0.01 sec)

mysql> exit
Bye

9. Tes ulang authentifikasinya

mailserver# radtest zeeboy12 12345 10.14.2.14 1812 1234
Sending Access-Request of id 170 to 10.14.2.14 port 1812
User-Name = “zeeboy12”
User-Password = “12345”
NAS-IP-Address = 255.255.255.255
NAS-Port = 1812
rad_recv: Access-Accept packet from host 10.14.2.14:1812, id=170, length=68
Framed-Compression = Van-Jacobson-TCP-IP
Framed-Protocol = PPP
Service-Type = Framed-User
Framed-MTU = 1500
X-Ascend-Assign-IP-Pool = 0
X-Ascend-Maximum-Time = 7200
X-Ascend-Route-IP = Route-IP-Yes
Idle-Timeout = 1800
mailserver#

OK. Sampai disini server radius sudah berhasil di install, bisa di gunakan untuk auth di hotspot mikrotik.

Dgn data :

IP : 10.14.2.14

Port : 1812

secret key : 1234

Senin, 07 Desember 2009

instalasi,konfigurasi nginx serta mengaktifkan php-cgi di freebsd

Apa yang nginx?

Nginx adalah (kepanjangan "engine X") is a lightweight web server/reverse proxy and e-mail (IMAP/POP3) proxy, licensed under a BSD-like license. Nginx adalah (diucapkan "mesin X") adalah sebuah web server ringan / reverse proxy dan e-mail (IMAP/POP3) proxy, dilisensikan di bawah lisensi BSD-mirip.

Dalam tutorial ini kita akan mencoba untuk menginstal web server nginx dengan PHP5, PHP5 Ext, MySQL5 dan Pecl-Memcache PHP FreeBSD7 modul server.

Saya akan menggunakan port untuk menginstal semua paket.

Installing MySQL6

di tutorial sebelumnya saya sudah membuat langkah-langkah instalasi dan konfigurasi. jadi saya asumsikan tmen2 sudah menginstall mysql60-server

langkah selanjutnya adalah

Installing PHP5

# cd /usr/ports/lang/php5
# make config # Make config (make config disini digunakan untuk mensetting package yang akan diinstall dalam php5)
[X] CLI Build CLI version

[X] CGI Build CGI version

[X] APACHE Build Apache module

[ ] DEBUG Enable debug

[X]] SUHOSIN Enable Suhosin protection system

[X] MULTIBYTE Enable zend multibyte support

[ ] IPV6 Enable ipv6 support

[ ] REDIRECT Enable force-cgi-redirect support (CGI only)

[ ] DISCARD Enable discard-path support (CGI only)

[X] FASTCGI Enable fastcgi support (CGI only)

[X] PATHINFO Enable path-info-check support (CGI only)

# make install clean # Make install bersih
#cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

langkah selanjutnya instalasi php5-extension

Installing PHP5 Extension

[code]# cd /usr/ports/lang/php5-extensions/

# make config #

Options for php5-extensions 1.0 Pilihan untuk php5-extensions 1,0
------------------------------------------------- -------------------------------------------------
[X] FTP FTP support

[X] GD

[X] GETTEXT

[X] MBSTRING

[X] MYSQL

[ ] POSIX

[ ] SQLITE

[X] ZLIB

# make install clean

langkah selanjutnya instalasi nginx

Installing Nginx

#cd /usr/ports/www/nginx/

#make install clean

Installing Lighttpd

#cd /usr/ports/www/lighttpd/

#make install clean

Install spawn-fcgi

Digunakan untuk mengaktifkan php yang ada pada komputer server kita.

Ambil spawn-fcgi terbaru dari instalasi Lighttpd lain atau hanya menginstalnya sebagai berikut:
# pkg_add -r -v lighttpd
Sample output: Contoh output:

 scheme:   [ftp] skema: [ftp] 
user: [] user: []
password: [] password: []
host: [ftp.freebsd.org] host: [ftp.freebsd.org]
port: [0] Port: [0]
document: [/pub/FreeBSD/ports/amd64/packages-7.0-release/Latest/lighttpd.tbz] Dokumen: [/ pub/FreeBSD/ports/amd64/packages-7.0-release/Latest/lighttpd.tbz]
---> ftp.freebsd.org:21 ---> Ftp.freebsd.org: 21
looking up ftp.freebsd.org menengadah ftp.freebsd.org
connecting to ftp.freebsd.org:21 menghubungkan ke ftp.freebsd.org: 21
<<<> <<<220>
>>> USER anonymous >>> PENGGUNA anonim
<<<> <<<331>
..... .....
..... .....
x lib/lighttpd/mod_access.so x lib / lighttpd / mod_access.so
x lib/lighttpd/mod_accesslog.a x lib / lighttpd / mod_accesslog.a
x lib/lighttpd/mod_accesslog.la x lib / lighttpd / mod_accesslog.la
x lib/lighttpd/mod_accesslog.so x lib / lighttpd / mod_accesslog.so
x lib/lighttpd/mod_alias.a x lib / lighttpd / mod_alias.a
x lib/lighttpd/mod_alias.la x lib / lighttpd / mod_alias.la
x lib/lighttpd/mod_alias.so x lib / lighttpd / mod_alias.so
x lib/lighttpd/mod_auth.a x lib / lighttpd / mod_auth.a
x lib/lighttpd/mod_auth.la x lib / lighttpd / mod_auth.la
..... .....
.. ..

Sekarang Anda dapat menggunakan / etc / local / bin / spawn-fcgi untuk proses swap. Jika Anda ingin, Anda dapat menyalin / usr / local / bin / spawn-fcgi ke / root atau direktori lain dan hanya menghapus paket lighttpd dengan mengetikkan perintah berikut:

# cp /usr/local/bin/spawn-fcgi /root/

# pkg_delete -v lighttpd-1.4.18_1

# cp /root/spawn-fcgi /usr/local/bin/spawn-fcgi

Sekarang Anda dapat mulai PHP FastCGI dari baris perintah sebagai berikut:

# /usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/local/bin/php-cgi
berikut maksud dari command line diatas,

  • -a 127.0.0.1 : PHP FastCGI bind IP address, where Nginx will connect. -a 127.0.0.1: PHP FastCGI bind alamat IP, di mana nginx akan menghubungkan.
  • -p 9000 : PHP FastCGI port number, where Nginx will connect. -p 9.000: PHP FastCGI nomor port, di mana nginx akan menghubungkan.
  • -u www : PHP FastCGI username. -u www: PHP FastCGI username.
  • -g www : PHP FastCGI groupname. -g www: PHP FastCGI groupname.
  • -f /usr/local/bin/php-cgi : Path to PHP5 fastcgi binary. -f / usr / local / bin / php-cgi: Path ke PHP5 fastcgi biner.

Memverifikasi bahwa php berjalan sebagai FastCGI, masukkan:
# sockstat -4 | grep 9000
Contoh Keluaran:

 www      php-cgi    8998  0  tcp4   127.0.0.1:9000    *:* php-cgi www 8998 0 tcp4 127.0.0.1:9000 *: * 
www php-cgi 8997 0 tcp4 127.0.0.1:9000 *:* php-cgi www 8997 0 tcp4 127.0.0.1:9000 *: *
www php-cgi 8996 0 tcp4 127.0.0.1:9000 *:* php-cgi www 8996 0 tcp4 127.0.0.1:9000 *: *
www php-cgi 8995 0 tcp4 127.0.0.1:9000 *:* php-cgi www 8995 0 tcp4 127.0.0.1:9000 *: *
www php-cgi 8994 0 tcp4 127.0.0.1:9000 *:* php-cgi www 8994 0 tcp4 127.0.0.1:9000 *: *
www php-cgi 8993 0 tcp4 127.0.0.1:9000 *:* php-cgi www 8993 0 tcp4 127.0.0.1:9000 *: *

# cd /tmp
# fetch http://bash.cyberciti.biz/dl/251.sh.zip
- jika tidak dapat mendownload silahkan download secara manual dengan mengunjungi website

http://bash.cyberciti.biz/dl/251.sh.zip
- setelah itu masukkan file yg telah didownload tadi dengan menggunakan aplikasi winscp
- setelah selesei lanjutkan perintah berikut
# unzip 251.sh.zip
# mv 251.sh /usr/local/etc/rc.d/php.cgi.sh
# chmod +x /usr/local/etc/rc.d/php.cgi.sh
# rm 251.sh.zip

Untuk memulai php FastCGI, enter:
# /usr/local/etc/rc.d/php.cgi.sh start
# sockstat -4 | less

Berhenti php FastCGI, enter:
# /usr/local/etc/rc.d/php.cgi.sh stop

Connect Nginx Webserver To PHP FastCGI Process

Buka file ngixn.conf Anda, masukkan:
# vi /usr/local/etc/nginx/nginx.conf
Tambahkan konfigurasi berikut nginx petunjuk sehingga dapat melewati naskah PHP FastCGI server untuk mendengarkan pada 127.0.0.1:9000:

location ~ \.php$ { lokasi ~ \. php $ (
fastcgi_pass 127.0 .0 .1 : 9000 ;
fastcgi_pass 127,0 .0 .1: 9.000;

fastcgi_index index.php ; fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /websites/example.com/http$fastcgi_script_name ; fastcgi_param SCRIPT_FILENAME / website / example.com / http $ fastcgi_script_name;
include fastcgi_params ; termasuk fastcgi_params;
} )

Jika situs Web Anda di-host di / home / www / zeeboy / http, konfigurasi Anda akan terlihat seperti sebagai berikut:

server { server (
listen 80 ; mendengarkan 80;
server_name zeeboy www.ny@h_ny0.com ; SERVER_NAME zeeboy www.ny@h_ny0.com;

access_log /var/log/nginx/zeeboy/access.log main ; access_log / var / log / nginx / zeeboy / access_log utama;

location / { lokasi / (
root /home/www/zeeboy/http ; root / home / www / zeeboy / http;
index index.php index.html index.htm ; indeks index.php index.html index.htm;
} )

error_page 500 502 503 504 /50x.html ; error_page 500 502 503 504 / 50x.html;
location = /50x.html { lokasi = / 50x.html (
root /usr/local/www/nginx-dist ; root / usr / local / www / nginx-dist;
} )

# Mengoper naskah PHP FastCGI server untuk mendengarkan pada 127,0 .0 .1: 9.000
location ~ \.php$ { lokasi ~ \. php $ (
fastcgi_pass 127.0 .0 .1 : 9000 ; fastcgi_pass 127,0 .0 .1: 9.000;
fastcgi_index index.php ; fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/www/zeeboy/http$fastcgi_script_name ; fastcgi_param SCRIPT_FILENAME / home / www / zeeboy / http $ fastcgi_script_name;
include fastcgi_params ; termasuk fastcgi_params;
} )

location ~ /\.ht { lokasi ~ / \. ht (
deny all ; deny all;
} )
} )

Restart Nginx web server Nginx restart web server

# nginx -c /usr/local/etc/nginx/nginx.conf -t
# /usr/local/etc/rc.d/nginx restart

Test php with following sample script: Uji php dengan script contoh berikut:

php
phpinfo ( ) ;
?>
sedikit saja yang saya sampaikan,jika da yang tidak berkenan ataupun salah dalam pembuatan artikel ini saya mohon maaf.
Jika da yg salah atau kurang tlg ditambahin aja..


^_^

Jumat, 04 Desember 2009

Install MySQL50-server di freebsd

  1. masuk ke direktory mysql50-server port dengan menggunakan command:
    cd /usr/ports/databases/mysql50-server
  2. Build port
    make BUILD_OPTIMIZED=yes BUILD_STATIC=yes
  3. Install mysql50 database server
    make config
    make install
  4. Buka /etc/rc.conf dengan editor misal ( ee /etc/rc.conf ) and tambahkan configurasi sebagai berikut. ( ini digunakan untuk menjalankan Mysql Database server pertama server dinyalakan )
    mysql_enable="YES"
  5. Start mysql server secara manual:
    /usr/local/etc/rc.d/mysql-server start
  6. masukanpassword untuk MySQL root user dengan perintah sbb:
    /usr/local/bin/mysqladmin -uroot password 'new-password'

    Mysql telah selesai terinstal.

Mengamankan Direktory Di APACHE

Saya akan mencoba sedikit berbagi bagaimana Mengamankan Akses Data web pada sebuah direktory yang menggunakan server apache. kita akan mencoba memberikan sedikit gambaran bagaimana cara memberikan password pada suatu directory yang diakses melalui web. kebetulan saya menggunakan FreeBSD dan Apache2. sekarang mulai, pertama-tama Buka file configurasi webserver yaitu file httpd.conf ( misal: di /usr/local/etc/apache22/httpd.conf )

hal penting pertama sebelum memberi password adalah mengamankan direktory apache dengan menghilangkan Option Index yang biasanya default ada pada configurasi.

Sebelum :

DocumentRoot “/usr/local/www/apache22/data/”

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all

Sesudah :
DocumentRoot “/usr/local/www/apache22/data/”

Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all

Keterangan :

- Allow from all (bisa diakses oleh semua pengunjung)
- Allow from 192.168.1.0/24 >> hanya bisa diaksek untuk Network tertentu dengan range IP tersebut

Akses Directory dengan Password
Web bisa juga mengizinkan pengaksesan dengan menggunakan passsword dimana password akan disimpan dalam sebuah file, yang kemudian file tersebut diakses oleh apache.

1. Buat sebuah direktori baru sebagai penampung password

maone032# cd /usr/local/www/apache22/
maone032# mkdir paswdsite
maone032# cd paswdsite

2. Buat sebuah file untuk menampung username dan password ( cari lokasi file htpasswd kebetulan saya di /usr/local/sbin/htpasswd )
maone032# /usr/local/sbin/htpasswd -c htpasswd.user maone032
New password : *********
Re-type new password :*********
Adding password for user maone032

Keterangan : opsi -c (jika kita membuat file untuk user yang pertama kalau selanjutnya tidak perlu)

3.ubah konfigurasi httpd.conf agar dapat diakses oleh user yang sudah dibuat tadi ( maone032 )

Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
Authname Protected
AuthType Basic
AuthUserFile “/usr/local/www/apache22/paswdsite/htpasswd.user “

require user maone032

Setelah selesai reboot apache, kemudian buka http://web_server. akan muncul dialog box username dan password.

Install PHP5

  1. Masuk ke direktori php5 port dengan menggunakan perintah:
    cd /usr/ports/lang/php5
  2. masukan perintah sbb:
    make config
    - PENTING : pada tapilan ini pilih Apache ( Build apache module )
    jika tidak biasanya nanti muncul error :
    httpd: Syntax error on line 104 of
    /usr/local/etc/apache22/httpd.conf: Cannot load
    /usr/local/libexec/apache22/libphp5.so into server:
    /usr/local/lib/compat/pkg/libmysqlclient.so.14: version
    libmysqlclient_14 required by /usr/local/libexec/apache22/libphp5.so
    not found


    selanjutnya :
    make install
  3. masuk ke php5-extentions port directory :
    cd /usr/ports/lang/php5-extentions
  4. Instalasi PHP
    make config
    - PENTING :Ojo Lali Pilih juga MYSQL ( MysQl Database Support )

    make install
  5. masuk Ke setting untuk php.ini :
    cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
  6. Edit file konfigurasi untuk Apache di (/usr/local/etc/apache22/httpd.conf) and masukkan beberapa baris kode sbb:
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
  7. Kemudian cari kode di bawah ini :
    DirectoryIndex index.html

    ganti dengan kode sbb : >( TAMBAH index.php sebagai default file )

    DirectoryIndex index.php index.html
  8. Start Apache script:
    /usr/local/etc/rc.d/apache22 start


Blogspot Templates by Isnaini Dot Com. Powered by Blogger and Supported by Lincah.Com - Mazda Cars