Saturday 21 December 2013

Empty the Trash in Command Line

rm -fr /home/name/.local/share/Trash/info/* 
rm -fr /home/name/.local/share/Trash/files/*

Tuesday 10 December 2013

Install Firefox 25 in 5 easy steps

1. Download

Download the release from the official channels page:
www.mozilla.com/firefox/channels/
A 64 bit build is also available in the x86_64 directory of Mozilla's FTP.
This how-to supposes that the downloaded file is saved in the “Downloads” directory situated in your home directory.

2. Extract

The downloaded file is a compressed .tar.bz2 archive. In case you want to Learn more on these extensions: tar, bzip2. To extract this juicy archive, open the Downloads directory. Look for a file named firefox-25.0.tar.bz2, right-click on it and select “extract here”.
Alternatively, you can extract the archive from the command line:
cd ~/Downloads/

tar xjf firefox-25.0.tar.bz2

For those interested, here are the tar arguments used in the command:
x : eXtract
j : deal with bzipped file
f : read from a file (rather than a tape device)
The firefox-245.0.tar.bz2 archive can now be deleted.

3. Move to /opt

External programs like LibreOffice, Google Chrome, Adobe reader, ... are all installed in the /opt directory. If you want more info about why /opt, check out these two links:
Where to install my products on linux?
Filesystem Hierarchy Standard
If you already had a previous Firefox version installed in the /opt directory, remove it with the following command:

sudo rm -r /opt/firefox

Now move the firefox directory (which was created in your Downloads folder during extraction) to /opt:

sudo mv firefox /opt/firefox25

4. Set up symbolic links

Depending on you usage pattern, follow the instructions for case 1 OR for case 2.
Case 1: you want to use Firefox 25 as you default browser:
“Backup” the old Firefox launcher:

sudo mv /usr/bin/firefox /usr/bin/firefox-old

Create a symbolic link pointing to the new Firefox version:

sudo ln -s /opt/firefox25/firefox /usr/bin/firefox

No need to update your icons/shortcuts, they should now launch the new version of Firefox.
Your old Firefox version is still installed. If you want to use it, run firefox-old in a terminal or create shortcuts/icons referring to firefox-old.
Case 2: you want to keep using your “old” Firefox by default:
Create a symbolic link pointing to the new Firefox version:
sudo ln -s /opt/firefox25/firefox /usr/bin/firefox254
Launch the newly installed Firefox by running firefox25 in a terminal, or create shortcuts/icons referring to firefox25.

5. Updates & Final

Firefox will manage its own updates independently of your system's package manager, an download subsequent releases. There will be no need to repeat the whole “procedure”... Enjoy Firefox!

Source : http://www.libre-software.net/how-to-install-firefox-on-ubuntu-linux-mint
Alternatif : http://www.cyberciti.biz/faq/howto-install-firefox-14-0-1-tar-bz2-in-linux/

Wednesday 27 November 2013

Membuat IVR (interactive voice responses) di Asterisk

1. merekam suara IVR dengan menggunakan software pengolah suara, misalnya : audacity
download audacity http://audacity.sourceforge.net/download/
misal suaranya berbunyi :
“selamat datang di layanan voip UBS, tekan nomer extention yang anda inginkan atau
tekan 9002 untuk mengetahui jam saat ini
tekan 9003 untuk mendengarkan lagu yogya
tekan 9004 untuk bantuan operator
tekan 9005 untuk Cabang A
tekan 9006 untuk Cabang B “
2. simpan dalam format .wav (dalam contoh ivr.wav)

3. lakukan konversi suara ke format .gsm (dalam contoh ivr.gsm), dengan menggunakan software sox [saya menggunakan yang versi linux]
a. download software sox
http://sourceforge.net/projects/sox/files/sox/14.3.0/sox-14.3.0.tar.gz/download
b. configure
# cd /usr/local/src/
# tar xvzf sox-14.3.0.tar.gz
# cd sox-14.3.0
# ./configure
c.lakukan konversi
# sox ivr.wav -r 8000 -c1 ivr.gsm resample -ql
d. untuk convert sekumpulan mp3 ke gsm
# vi mp32gsm
for I in $(ls -1 *.mp3)
do
NAME=$I
echo “Converting from mp3.wav”
mpg123 -w “$NAME.wav” “$NAME”
echo “Converting from wav to gsm”
sox -t wav “$NAME.wav” -r 8000 -c1 -t gsm “$NAME.gsm” resample -ql
echo “output filename: $NAME.gsm”
done
# chmod a+x mp32gsm
# ./mp32gsm
4. hasil konversi disimpan ke /var/lib/asterisk/sounds
# cp ivr01.gsm /var/lib/asterisk/sounds/
ASTERISK
5. melakukan konfigurasi extension.conf
# vi /etc/asterisk/extensions.conf
;————————–
; ivr
;————————–
Exten => 001,1,Answer()
Exten => 001,2,Background(ivr)
exten => 001,3,Background(silence/3)
exten => 001,4,Goto(2)
artinya :
baris 1 : jika ada user mendial 001 maka prioritas pertama adalah dijawab
baris 2 : jika tidak dijawab akan ada suara rekaman ‘ivr’ kita yang bunyinya seperti diatas
baris 3 : silence selama 3 dial tone
baris 4 : ulangi ke baris 2
6. reload asterisk
# asterisk -vvvr
linux*CLI> reload
linux*CLI> exit

Source : http://setijoagus.wordpress.com/2009/08/26/membuat-ivr-interactive-voice-responses-di-asterisk/

Subdomain Forbidden 403

salah permission

masih tidak bisa
"chown diskonjc:diskonjc public_html/

sudah bisa
"chown diskonjc:nobody public_html/"

Sunday 10 November 2013

Reset BIOS hp dc5000 sff (pv607uc)

Resetting the Password Jumper

1. Shut down the operating system properly, then turn off the computer and any external devices, and disconnect the power cord from the power outlet.
2. With the power cord disconnected, press the power button again to drain the system of any residual power. WARNING: To reduce the risk of personal injury from electrical shock and/or hot surfaces, be sure to disconnect the power cord from the wall outlet, and allow the internal system components to cool before touching. CAUTION: When the computer is plugged in, the power supply always has voltage applied to the system board even when the unit is turned off. Failure to disconnect the power cord can result in damage to the system. CAUTION: Static electricity can damage the electronic components of the computer or optional equipment. Before beginning these procedures, ensure that you are discharged of static electricity by briefly touching a grounded metal object. See the Safety & Regulatory Information guide on the Documentation and Diagnostics CD for more information.

3. Remove the computer cover or access panel.
4. Locate the header and jumper.  The password jumper is green so that it can be easily identified.
5. Remove the jumper from pins 1 and 2. Place the jumper on either pin 1 or 2, but not both, so that it does not get lost. You can hold it in your hand if you want, too.  :smileyhappy:
6. Replace the computer cover or access panel.
7. Reconnect the external equipment.

8. Plug in the computer and turn on power. Allow the operating system to start. This clears the current passwords and disables the password features.
9. To establish new passwords, repeat steps 1 through 4, replace the password jumper on pins 1 and 2, then repeat steps 6 through 8. Establish the new passwords in Computer Setup. Refer to the Computer Setup (F10) Utility Guide on the Documentation and Diagnostics CD for Computer Setup instructions.

Paul

Friday 18 October 2013

Install WordPress via SSH

  1. SSH into your server, then navigate to your domain’s web root:
    cd /var/www/vhosts/example.com/httpdocs
  2. Grab the latest WP install
    wget http://wordpress.org/latest.tar.gz
  3. Get the files out of the archive:
    tar xfz latest.tar.gz
  4. Navigate to the wordpress subfolder:
    cd wordpress
  5. Copy everything back up to the web root:
    cp -rpf * ../
  6. Navigate back up to web root:
    cd ..
  7. Remove the wordpress subfolder:
    rm -rf wordpress
  8. Remove the downloaded archive file:
    rm -f latest.tar.gz
Source : http://code.garyjones.co.uk/install-wordpress-ssh

Sunday 6 October 2013

How to Install Asterisk 11 in RHEL/CentOS/Fedora and Ubuntu/Debian/Linux Mint

Asterisk is an Open Source software PBX (Private Branch Exchange), developed by Mark Specer of Digium. It allows you to make calls to one another which may have connected to other PSTN (Public Switched Telephone Network) and Voice over Internet Protocol (VoIP). Asterisk runs on Linux, BSD, MacOSX and others. Having built-in features like voicemail, conferencing, IVR, queuing etc.
In this article, we are going to see a basic installation and working of Asterisk 11 in RHEL 6.4/6.3/6.2/6.1/6.0, CentOS 6.4/6.3/6.2/6.1/6.0, Fedora 18,17,16, Ubuntu 12.10/12.04/11.10, Linux Mint 14/13 and Debian Linux Operating Systems.

1. Preparation for Installation

First, you make sure that your system is up-to-date, if not try to update the system and then install dependencies packages using “yum command” and “apt-get command“, before installing Asterisk on your system.
On RHEL/CentOS/Fedora
# yum -y update
# yum install -y make wget openssl-devel ncurses-devel newt-devel libxml2-devel kernel-devel gcc gcc-c++ sqlite-devel
Turn Off SELinux by changing the line “enforcing” to “disabled” in /etc/selinux/config file.
SELINUX=disabled
Once you disabled SELinux, you need to reboot the system.
reboot
On Ubuntu / Linux Mint / Debian
# su root
# apt-get update && apt-get upgrade -y && reboot
# apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev  libxml2-dev linux-headers-$(uname -r) libsqlite3-dev

2. Downloading DAHDI, LibPRI and Asterisk Tarballs

Download the source tarballs, these following commands will download current release of DAHDI 2.6, LibPRI 1.4 and Asterisk 11.
# cd /usr/src/
# wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
Next, extract the files from source tarballs using “tar command” as shown below.
# tar zxvf dahdi-linux-complete-current.tar.gz
# tar zxvf libpri-1.4-current.tar.gz
# tar zxvf asterisk-11-current.tar.gz

3. Configuring, Compiling And Installing

Go to the each directory from where you have downloaded and extracted the packages and start running the following commands to install DAHDI, LibPRI and Asterisk.
Installing DAHDI.
# cd /usr/src/dahdi-linux-complete-2.6.2+2.6.2/
# make && make install && make config
Installing LibPRI
# cd /usr/src/libpri-1.4.14/
# make && make install
Installing Asterisk
Next, run the “configure” script will vary depending upon whether your system is 32-bit or 64-bit. In the middle, when “menuselect” command executes, select your desired options and then hit “Save and Exit” option and the installation will continuous.
Run this command if you’re installing Asterisk on a 32-bit OS.
# cd /usr/src/asterisk-11.3.0/
# ./configure && make menuselect && make && make install && make samples && make config
Run this command if you’re installing Asterisk on a 64-bit OS.
# cd /usr/src/asterisk-11.3.0/
# ./configure --libdir=/usr/lib64 && make menuselect && make && make install && make samples && make config
Following are the some Asterisk configuration files and their locations.
  1. /etc/asterisk/ – configuration files.
  2. /var/lib/asterisk/ – contains images, firmware, keys, sounds sample files.
  3. /usr/lib/asterisk/modules/ – contains all loadable modules.

4. Starting DAHDI and Asterisk Services

Enable the DAHDI and Asterisk services at system boot time.
# chkconfig dahdi on
# chkconfig asterisk on
Start the DAHDI and Asterisk.
# service dahdi start
# service asterisk start

5. Connecting to Asterisk CLI

Run the following command to connect to the Asterisk CLI.
# asterisk -rvvvvv

Asterisk 11.3.0, Copyright (C) 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 11.3.0 currently running on tecmint (pid = 1820)
tecmint*CLI>

6. Asterisk Console Commands

It’s similar to IOS. From Asterisk terminal anytime you can use ‘Tab key‘ or type ‘?‘ for help or command auto complete.
tecmint*CLI>
!              acl            ael            agent          agi            aoc            
calendar       cc
cdr            cel            channel        cli            confbridge     config         
console        core
data           database       devstate       dialplan       dnsmgr         dundi          
event          fax
features       file           group          hangup         help           http           
iax2           indication
local          logger         manager        mgcp           minivm         mixmonitor     
module         moh
no             originate      parkedcalls    phoneprov      presencestate  pri            
queue          realtime
reload         rtcp           rtp            say            sip            skinny         
stun           timing
udptl          ulimit         unistim        voicemail

7. Useful Commands from Asterisk CLI

  1. restart gracefully – Restart Asterisk gracefully.
  2. restart now – Restart immediately.
  3. restart when convenient – Restart Asterisk when call is empty.
  4. reload – Configuration reload.
  5. stop gracefully – Gracefully Asterisk shutdown.
  6. stop now – Shutdown immediately.
  7. stop when convenient – Shutdown Asterisk when call is empty.

8. Command Line Parameters

Following are the available command line parameters of Asterisk.
-h : Help. Run '/sbin/asterisk -h' to get a list of the available command line parameters.
-C <configfile>: Starts Asterisk with a different configuration file than the default /etc/asterisk/asterisk.conf.
-f : Foreground. Starts Asterisk but does not fork as a background daemon.
-c : Enables console mode. Starts Asterisk in the foreground (implies -f), with a console command line interface (CLI) that can be used to issue commands and view the state of the system.
-r : Remote console. Starts a CLI console which connects to an instance of Asterisk already running on this machine as a background daemon.
-R : Remote console. Starts a CLI console which connects to an instance of Asterisk already running on this machine as a background daemon and attempts to reconnect if disconnected.
-t : Record soundfiles in /var/tmp and move them where they belong after they are done.
-T : Display the time in "Mmm dd hh:mm:ss" format for each line of output to the CLI.
-n : Disable console colorization (for use with -c or -r)
-i: Prompt for cryptographic initialization passcodes at startup.
-p : Run as pseudo-realtime thread. Run with a real-time priority. (Whatever that means.)
-q : Quiet mode (supress output)
-v : Increase verbosity (multiple v's = more verbose)
-V : Display version number and exit.
-d : Enable extra debugging across all modules.
-g : Makes Asterisk dump core in the case of a segmentation violation.
-G <group> : Run as a group other than the caller.
-U <user> : Run as a user other than the caller
-x <cmd> : Execute command <cmd> (only valid with -r)

9. Reference Link

  1. http://www.asterisk.org/
Source : http://www.tecmint.com/how-to-install-asterisk-11-in-linux-distributions/

How to Install Asterisk-GUI

After I try to install asterisk on my previous writings, it seems so hard to configure with CLI. However i’m just a newbie…remember that. So, I’m trying to find an easy way to configure using ‘Asterisk-gui’. actually there are many third-party applications developed for asterisk, such as pbxware, asterisk now, freepbx, briker, etc. asterisk-gui is a web interface, it’s just like you have installing a trixbox on your own.
Here is step by step installation:
1. Go to your installation directory (for example: /usr/src), download the latest version:
[root@gembul ~]# cd /usr/src/
[root@gembul src]# svn checkout http://svn.digium.com/svn/asterisk-gui/trunk asterisk-gui

this is will create directory named asterisk-gui

2. Enter asterisk-gui directory, compile and install:
[root@gembul asterisk-gui]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for uname... /bin/uname
checking for gcc... gcc
##################################### skipped #####################################
configure: Package configured for:
configure: OS type : linux-gnu
configure: Host CPU : x86_64

[root@gembul asterisk-gui]# make && make install
##################################### skipped #####################################
+------- Asterisk-GUI Build Complete -------+
+ Asterisk-GUI has successfully been built, +
+ and can be installed by running: +
+ +
+ make install +
+-------------------------------------------+
+---- Asterisk GUI Installation Complete ---+
+ +
+ YOU MUST READ THE SECURITY DOCUMENT +
+ +
+ Asterisk-GUI has successfully been +
+ installed. +
+ +
+-------------------------------------------+
+ +
+ BEFORE THE GUI WILL WORK +
+ +
+ Before the GUI will run, you must perform +
+ some modifications to the Asterisk +
+ configuration files in accordance with +
+ the README file. When done, you can +
+ check your changes by doing: +
+ +
+ make checkconfig +
+ +
+-------------------------------------------+

3. Configure general parameters, I suggest to backup your default configuration first. and then modify manager.conf http.conf files:
[root@gembul asterisk]# cp -r /etc/asterisk /etc/asterisk.backup
[root@gembul asterisk]# vi /etc/asterisk/manager.conf

[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 0.0.0.0

[gembuls]
secret = your_password
permit=0.0.0.0/0.0.0.0
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,config,command,reporting,originate
[root@gembul asterisk]# vi /etc/asterisk/http.conf
[general]
enabled = yes
bindaddr = 0.0.0.0
bindport = 8088
prefix = gui
enablestatic = yes

4. Reload/restart your asterisk
[root@gembul asterisk]# asterisk -r
Asterisk 1.6.2.21, Copyright (C) 1999 - 2010 Digium, Inc. and others.
Created by Mark Spencer
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 1.6.2.21 currently running on gembul (pid = 3108)
Verbosity is at least 3
gembul*CLI>

or restart the asterisk:
[root@gembul asterisk]# /etc/init.d/asterisk restart
Stopping safe_asterisk: [ OK ]
Shutting down asterisk: [ OK ]
Starting asterisk: [ OK ]
[root@gembul asterisk]#

5. Open asterisk-gui on your browser with address:
http://localhost:8088/gui/static/config/index.html
source:
asterisk.org
sourceforge.net


nyolong seko : http://gembuls.wordpress.com/2011/12/28/how-to-install-asterisk-gui/

Tuesday 1 October 2013

RESET SAMSUNG ML-2240



Samsung ML-2240 setelah counter pagenya menunjukkan angka di atas 1800, maka printer ini akan blink yang disertai dengan berkedipnya lampu merah pada printer. Lampu merah tersebut menunjukkan bahwa toner telah habis. Walaupun toner sudah kita refill, namun lampu merah tersebut tidak bisa hilang.
reset samsung ml-2240
Hal ini mengakibatkan printer Samsung Ml-2240 ini tidak bisa ngeprint. Agar printer Samsung ML-2240 ini dapat berpungsi kembali, maka kita harus mereset ulang kembali counter page tersebut dengan cara manual menggunakan jumper atau dengan membeli alat chip. Untuk cara reset manual Samsung Ml-2240 menggunakan jumper akan kami jelaskan di sini.
Sebelum kita melakukan reset printer Samsung ML-2240, sebaiknya anda melakukan test printer untuk melihat OS Version dan hasil terakhir Toner Page Count dari printer Samsung ML-2240.


Cara test printer Samsung ML2240:
1. Hidupkan printer, dan tunggu sampai proses kalibrasi selesai
2. Pasang kertas 3 lembar, kemudian tekan tombol Resume selama 3 detik. Lepas tekanan pada tombol resume, dan printer melakukan test print.

3. Setelah selesai test print, perhatikan OS Version dari hasil test printer anda.
Ada beberapa tipe OS Version dari Samsung ML-2240 ini yang tidak dapat kita reset secara manual menggunakan jumper. Adapun tipe OS Version Samsung ML-2240 yang dapat di reset adalah :
1.01.00.68
1.01.00.70
1.01.00.72
1.01.00.76
1.01.00.77
1.01.00.78
semuanya bisa di reset pake jumper atau disolder.
Tapi kalo yang OS versi :
1.01.00.82
1.01.00.83
Masih belum bisa di reset pake jumper.
Langkah-langkah reset printer Samsung ML-2240
A. Peralatan yang dibutuhkan :
- Obeng plus (+), dan obeng minus (-)
- Kabel atau kawat kecil untuk jumper
B. Langkah-langkah reset printer Samsung ML-2240
- Lepas semua kabel printer (kabel power printer dan kabel data printer), dan pastikan switch printer dalam keadaan OFF
- Lepas dua buah baut yang ada pada bagian kiri dan kanan di belakang printer menggunakan obeng plus (+)

- Setelah kedua baut dilepas, dan soket pengunci dibuka, geser cover ke samping secara pelan-pelan.

- Lepas kipas pendingin yang menempel pada cover

- Akan terlihat dua buah mesin printer Samsung ML-2240, yaitu mesin power supply dan motherboard.
reset counter page
- Cari dan perhatikan IC EEPROM kaki 8 yang menempel pada mainboard printer Samsung ML-2240, yaitu ic U6 dengan nomor 93C66WP.

- Setelah IC U6 ditemukan, pasang dan hubungkan jumper atau kawat kecil pada ic kaki 1 dan 4
Kalau terbiasa menggunakan solder, solder aja kabel tersebut pada kaki 1 dan 4 agar anda tidak ribet memegangnya.
samsung ml-2240
- Setelah kaki 1 dan 4 pada ic dihubungkan, pasang kabel power, dan hidupkan printer.
- Tunggu beberapa saat hingga printer selesai kalibrasi dan lampu menunjukkan warna hijau
- Setelah lampu hijau, matikan printer, kemudian lepas kabel atau kawat yang menempel pada kaki 1 dan 4 IC EEPROM 93C66WP
- Tutup kembali cover belakang printer tersebut dan jangan lupa pasang dua buah baut skrup yang dilepas tadi.
Reset Samsung ML-2240 telah selesai dilakukan, dan printer beroperasi kembali.

Source : http://www.teknisiprinter.com/reset-samsung-ml2240.htm

Monday 16 September 2013

Increasing Java Memory



Hi All


This problem is resolved by adding  OPENFIRE_OPTS="-Xmx1512m"


in /etc/sysconfig/openfire file I restarted the services after that


Thanks a lot all of you for  your support  Now arround 1200 users are accessing this server from 3 different location in India


and IT is working nice


Thank you all

Source : http://community.igniterealtime.org/thread/30011

Friday 13 September 2013

Move MySQL Directory to Another Location

Lets say your MySQL data has fully utilized the disk space and you have another new hard disk specifically mounted for this purpose, you will need to migrate the data over to this new location. By default, MySQL will occupied following locations in the server:

    Data -/var/lib/mysql
    Config – /etc
    Log -/var/log


We will not migrate data in /etc or /log because it usually not required much space. I will use following variables:

    Server OS: CentOS 5.6 64bit
    Old MySQL data: /var/lib/mysql
    New MySQL data: /mnt/disk1/mysql


Warning: You MUST able to afford downtime on MySQL service to do this!

1. First of all, we need to make sure the service is stopped (if you are running cPanel, please disable MySQL monitoring under WHM > Service Manager > Untick ‘monitor’ for MySQL):

[root@centos ~]# service mysql stop

2. Make sure there is no MySQL services running on the server:

[root@centos ~]# ps aux | grep mysql | egrep -v 'grep'

3. Lets copy over the data directory. We are using rsync command so we can see the copy progress with estimate time remaining (this is really good for monitoring), and also preserve the permission and ownership of the MySQL directory:

[root@centos ~]# rsync -avpP /var/lib/mysql /mnt/disk1/mysql


4. Now we need to tell MySQL to look at new data directory. Open /etc/my.cnf via text editor and change following server options:

[mysqld]
......
datadir=/mnt/disk1/mysql
socket=/mnt/disk1/mysql/mysql.sock

......

5. Now lets start back the MySQL with this new settings:

[root@centos ~]# service mysql start


If everything are running back as expected, you can then delete the old /var/lib/mysql directory so you can save more free space.

Source : http://blog.secaserver.com/2011/07/move-mysql-directory-to-another-location/

====================XXXXXXXXXXXXXXXX========================

How to symlink /var/lib/mysql if /var mount becomes full


Most of you may already know how to do this, so forgive if this is too simple, but this may be helpful for some dedicated server owners whose /var mount (some hosts use separate partitions for /usr, /var, /home etc) has become full, which is usually do to large databases in /var/lib/mysql. There is usually plenty of room in /the /home partition. This will work on cPanel servers as well.

This simple tutorial lays out the steps involved to copy contents of /var/lib/mysql to /home and then symlink /var/lib/mysql to /home/mysql. Of course adjust accordingly if moving/symlinking to a different mount or directory.

1) Go to webpage that uses mysql to verify working pre-copy

2) Stop mysql service (I will usually also stop cpanel & http service just to be safe).

/etc/init.d/mysql stop
/etc/init.d/httpd stop
/etc/init.d/cpanel stop


3) Do the copy:

rsync -av /var/lib/mysql /home/


4) Verify copied folder same size as source with du:

du -sh /var/lib/mysql
du -sh /home/mysql


5) Move /var/lib/mysql to /home/mysql-bak (essentially removing /var/lib/mysql because the folder must not exist when symlink is created)

mkdir /home/mysql-bak
mv /var/lib/mysql /home/mysql-bak/


6) Create symlink:

ln -s /home/mysql /var/lib/mysql

7) Verify the symlink is correct when listing the contents of new symlinked /var/lib/mysql (you can refer to the rsync copy to make sure the paths are the same - they should be)

8) Restart mysql, httpd, cpanel

9) Verify mysql-reliant webpage is loading without issue

10) You should now have freed up space on /var. Verify with 'df -h'
 
Source : http://www.webhostingtalk.com/showthread.php?t=1086919

Friday 6 September 2013

Setting PPoE Internet Speedy pada modem ADSL D-Link DSL-526B

Modem adsl 526B adalah modem adsl untuk akses internet mempunyai 1 port RJ-45,RJ,11
modem berpenampilan kecil tetapi berkemampuan luar biasa. Tapi sayang agak sedikit rewel untuk daerah yang listriknya ga stabil
langkah pertama
untuk menseting atau mengkonfigurasi modem saya akan memasang seperti di bawah ini:
topologinya yaitu
kabel telp(line internet)        —-> lubang konektor rJ-11 (pada modem)
PC                                            —-> lubang konektor RJ-45 (LAN) pada modem
langkah kedua
saya menggunakan pc/komputer jadi, sebaiknya local area network/ pada tcp ipnya harap dibuat dhcp, agar dapat mengenali ip modem(untuk di atas windows xp ipv sebaiknya di aktifkan dhcpnya)
kenapa alasan local area connectionnya di buat dhcp karena supaya ip saya akan menjadi satu group dengan ip modem sehingga dapat melanjutkan ke konfigurasi selanjutnya.
bisanya ip bawaan modem dari pabrik akan bernilai 192.168.0.1 atau 192.168.1.1
===========================================================
default ip modem 192.168.1.1
karena local area connection saya dhcp maka nilai ip saya akan bernila 192.168.1.(1-254)
langkah ketiga
Buka browser kemudian mengetikan di adress 192.168.1.11
Masukan  username dan password
default
username =admin
password  =admin
kemudian muncul gambar dibawah ini

kemudian pilih advanced setup kemudian klik lalu akan muncul tampilah dibawah ini

lalu ikuti gambar lalu klik next

kemudian masukan username yang di dapat dari telkom speedy kemudian diikuti dengan “@telkom.net”
Contoh : 1234567890@telkom.net
Lalu masukan password
Untuk PPoE service name, boleh diisi apa aja
(username dan password speedy diperoleh oleh setiap pelanggan internet speedy)

ikuti gambar kemudian klik next

ikuti gambar lalu klik next

kemudian save
dan konfigurasi selesai, tandanya sudah bisa internet bila anda terkoneksi bilamana pada gambar pertama ada IP speedy anda dan DNS speedy anda ditampilkan.
Jika belum tampil seperti gambar no. 1, cobalah login dulu di website http://www.telkomspeedy.com
Untuk berlangganan kalau internet speedy telp ke 147 , cara itu cara terakhir bilamana masih tidak bisa koneksi internet.

Wednesday 4 September 2013

Change the default MySQL data directory with SELinux enabled

This is a short article that explains how you change the default MySQL data directory and adjust SELinux to account for the changes. The article assumes that you’re running either RHEL, CentOS, Scientific Linux or Fedora with SELinux enabled. This works with the most recent EL (6.2) version.
We’ll be doing this in the following order.
  • Stopping the MySQL server
  • Create a new data directory and move the content from the old data directory
  • Correct the MySQL configuration file
  • Adjust SELinux parameters to accept our new change
  • Starting the MySQL server

Stopping the MySQL server

# service mysqld stop

Create a new data diretory and move the content from the old one

Creating a new data directory

# mkdir /srv/mysql/
# chown mysql:mysql /srv/mysql

Moving the original data files

 # mv /var/lib/mysql/* /srv/mysql/

Correct the MySQL configuration file

Edit the my.cnf file for your distribution. In my example it’s located in the /etc/mysql/ directory. RHEL/CentOS/Scientific Linux put the my.cnf file directly in /etc by default.
# nano /etc/mysql/my.cnf
Change
datadir=/var/lib/mysql
to
datadir=/srv/mysql
and
socket=/var/lib/mysql/mysql.sock
to
socket=/srv/mysql/mysql.sock
and save the file.

Adjust SELinux parameters to accept our new change

Should the following command output “Permissive” or “Disabled” then you may skip the details for SELinux.
# getenforce
Run the semanage command to add a context mapping for /srv/mysql.
# semanage fcontext -a -t mysqld_db_t "/srv/mysql(/.*)?"
Now use the restorecon command to apply this context mapping to the running system.
# restorecon -Rv /srv/mysql

Starting the MySQL server

# service mysqld start

Verifying access and connectivity

$ mysql -u root -p
mysql> show databases;
If this is working, you’re up and running. Should you get a message that says

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
then add the following to your /etc/my.cnf
[client]
socket = /srv/mysql/mysql.sock
Optionally you can just use
$ mysql -u root -p --protocol tcp
to avoid connecting via the socket.

Source : http://crashmag.net/change-the-default-mysql-data-directory-with-selinux-enabled

Web server on centos 6.3

Here is a quick how to guide on setting up a web server on Centos 6.3Run this script…

sudo yum update -y
sudo yum install httpd -y
sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli php-gd mysql -y
sudo yum install mysql-server -y
sudo yum install openssh-clients -y
sudo yum install wget -y
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
 
 
# Once installed you should see some additional repo definitions under the /etc/yum.repos.d directory. #

ls -1 /etc/yum.repos.d/epel* /etc/yum.repos.d/remi.repo
 
 
# You should see:
/etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel-testing.repo
/etc/yum.repos.d/remi.repo
 
 
# Enable the remi repository #
The remi repository provides a variety of up-to-date packages that are useful or are a requirement for many popular web-based services. That means it generally is not a bad idea to enable the remi repositories by default.
First, open the /etc/yum.repos.d/remi.repo repository file using a text editor of your choice:

sudo vi /etc/yum.repos.d/remi.repo
 
 
# Edit the [remi] portion of the file so that the enabled option is set to 1. This will enable the remi repository.#

name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority
 
 
# Install mcrypt #
sudo yum -y install php-mcrypt
 
 
# Add username and password for phpmyadmin #
sudo adduser phpmyadmin
sudo passwd phpmyadmin
 
 
# Allowing HTTP and HTTPS through the firewall #
Run following command:
sudo vi /etc/sysconfig/iptables
Then add these two lines after the entry allowing port 22:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
Then run:
sudo service iptables restart
 
 
# adjusting apache config #
sudo vi /etc/httpd/conf/httpd.conf
 
 
# Scroll all the way down the the bottom of the Config file by pressing G (Shift + g) then press “a” so you can start manipulating the file.

# paste the following 4 lines and adjust the document root and the ip address
DocumentRoot /var/www/html
ServerName 1.2.3.4

# Sroll up until you find #
DirectoryIndex and replace with the following line:
DirectoryIndex index.html index.php index.sh default.jsp


# make sure DocumentRoot is set to
/var/etc/html


# Remove # infront of NameVirtualHost
the press “Esc” and then type ZZ (two capital Z’s)


# Finally, start the Apache server using the command:
sudo service httpd start


# Configuring MySQL #
#run:
sudo service mysqld start
/usr/bin/mysql_secure_installation

# Run through the wizard answering the questions to setup MySQL
# installing phpmyadmin
cd /var/www/html
sudo wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.3.9.1/phpMyAdmin-3.3.9.1-all-languages.tar.gz
tar -xzvf phpMyAdmin-3.3.9.1-all-languages.tar.gz -C /var/www/html
sudo mv phpMyAdmin-3.3.9.1-all-languages phpmyadmin
sudo rm -rf phpMyAdmin-3.3.9.1-all-languages.tar.gz
cd /var/www/html
sudo chown phpmyadmin.apache phpmyadmin/
cd /var/www/html/phpmyadmin/
sudo mkdir config
sudo chmod o+rw config
sudo cp config.sample.inc.php config/config.inc.php
sudo chmod o+w config/config.inc.php
sudo service httpd restart


# configuring PHPmyadmin #
# edit the phpmyadmin config file by running the following command:
sudo vi /var/www/html/phpmyadmin/config/config.inc.php


# Near the top of the file you will see this line:#
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */


# All you need to do here is enter a random string of characters between the quotation marks. #
# Scroll down to the /* Server Parameters */ section, and change
$cfg['Servers'][$i]['extension'] = ‘mysql’;
to
$cfg['Servers'][$i]['extension'] = ‘mysqli’;


# Scroll down a bit further and you will find the /* User for advanced features */ section. Leave the control user and the control password commented out, as we will not need them, and uncomment all of the other lines starting with $cfg in this section and the one below it. Save your changes by pressing Esc and entering :wp. Change directory back to the phpmyadmin config folder. ###


# Then run the following commands #
cd /var/www/html/phpmyadmin/config
sudo cp config.inc.php ..
cd ..
sudo rm -rf config
 
 
# Then download create_tables.sql
After you have downloaded the file, log in to phpMyAdmin if you aren’t already logged in and go to the import tab. Select the create_tables.sql file from your Downloads directory and click Go. The script will be run and the tables will be created. If the error does not disappear, log out of phpMyAdmin and log back in and it should disappear.


# moving Mysql database to new server #
mysqldump -u username -password databasename > dump.txt

mysql -u username -password databasename < dump.txt


# Setting up NTP Sync#
Run:
sudo yum install ntp -y
sudo /sbin/chkconfig ntpd on
sudo /etc/init.d/ntpd start
If you want to be able to send email from your contact forms please make sure that you are allowed through your firewall and it helps if you are on a static IP address:
setsebool -P httpd_can_sendmail 1
Please leave a comment if this article has helped you! Thanks and enjoy!

Source : http://www.parktec.com/2013/02/web-server-on-centos-6-3/

Thursday 29 August 2013

Kupas Tuntas SSH Tunneling

SSH Tunneling adalah teknik yang wajib dikuasai hacker. Teknik ini sangat cocok dipakai sebagai backdoor dari  dunia luar langsung menembus ke dalam “behind enemy lines” melewati semua firewall, IDS, IPS atau apapun itu di perbatasan. Dalam artikel ini saya juga menjelaskan bagaimana melakukan chaining tunnel, yaitu menyambung tunnel dengan tunnel lain.

Apa itu Tunneling?
Secara sederhana tunneling berarti mengirimkan data melalui koneksi lain yang sudah terbentuk. Kalau anda buka situs internet banking, pasti anda akan membukanya dengan URL berawalan “https”, yang sejatinya adalah data dalam protokol HTTP yang dikirimkan melalui koneksi dengan protokol SSL, atau “HTTP over SSL”, dalam bahasa gaulnya berarti HTTP digendong sama SSL.
SSH dan SSL adalah dua contoh tunneling protocol, keduanya bisa dipakai untuk menggendong data dalam protokol apa saja (tidak hanya http). Hanya bedanya adalah pada SSL dibutuhkan public key certificate dalam format X.509 yang perlu diverifikasi melalui Certificate Authority resmi. SSH tidak memerlukan public key certificate, sehingga lebih sederhana dan lebih mudah dipakai.

Protocol Encapsulation
Dalam kasus https, data dalam protokol HTTP di-enkapsulasi (dibungkus) dalam protokol SSL sebagai payload. Enkapsulasi juga terjadi dalam layer model TCP/IP, yaitu data pada layer yang lebih atas menjadi payload dan di-enkapsulasi dengan protokol pada layer di bawahnya.
Anda tentu tahu boneka lucu terbuat dari kayu dari Rusia bernama Matryoshka. Keunikan boneka ini adalah boneka yang berukuran kecil bisa dimasukkan ke dalam boneka yang lebih besar, dan boneka yang lebih besar juga bisa dimasukkan ke dalam boneka yang lebih besar lagi hingga pada akhirnya hanya ada satu boneka saja yang paling besar. Bila boneka yang paling besar itu dibuka, maka di dalamnya akan ada satu boneka yang lebih kecil, bila boneka tersebut dibuka, maka akan ditemukan boneka lagi yang lebih kecil, demikian seterusnya hingga boneka yang terkecil.
Gambar di bawah ini sangat tepat menggambarkan apa itu protocol encapsulation.

Gambar di atas menggambarkan bagaimana data ketika dikirim dienkapsulasi dan dikirimkan melalui protokol yang berada pada layer di bawahnya. Pada gambar di atas bisa dikatakan bahwa email message tersebut dikirimkan dalam bentuk paket SMTP over TCP over IP over Ethernet. Jadi pada akhirnya semua data tersebut akan terkirim dalam bentuk paket ethernet.
Dalam ilustrasi boneka matryoshka, pesan email adalah boneka matryoshka terkecil. Boneka ini dimasukkan dalam boneka matryoshka SMTP yang ukurannya lebih besar, kemudian boneka matryoshka SMTP ini dimasukkan dalam boneka matryoshka TCP, kemudian boneka matryoshka TCP ini dimasukkan dalam boneka matryoshka IP, dan akhirnya dimasukkan ke dalam boneka matryoshka ethernet yang berukuran paling besar.
Jadi boneka matryoshka yang diterima lawan biacara adalah boneka matryoshka yang terbesar. Bila boneka ini dibuka, di dalamnya ada boneka Matryoshka IP yang lebih kecil, dan bila boneka ini juga dibuka, di dalamnya ada boneka matryoshka TCP yang semakin kecil ukurannya. Bila boneka matryoshka TCP ini dibuka, di dalamnya ada boneka matryoshka SMTP yang didalamnya ada matryoshka email message. Email message adalah boneka matryoshka terkecil.

Port Forwarding
Port forwarding atau port mapping pengalihan (redirection) koneksi dari suatu IP:Port ke IP:Port yang lain.  Ini artinya adalah semua koneksi yang ditujukan ke IP:Port asal akan dialihkan ke IP:Port tujuan seolah-olah client sedang menghubungi IP:Port tujuan secara langsung.
Contoh: bila kita definisikan port forwarding 127.0.0.1:8080 dipetakan ke 192.168.10.10:80, artinya bila browser di arahkan ke url http://127.0.0.1:8080, maka request HTTP tersebut akan diteruskan ke 192.168.10.10:80. Jadi walaupun pada localhost (127.0.0.1) port 8080 tidak ada web server, namun web browser bisa membuka web pada url http://localhost:8080.
Gambar di bawah ini adalah contoh port forwarding dari web nakahara-informatics.com.
Pada port forwarding tersebut, didefinisikan sehingga klien dari dunia luar bisa mengakses service yang ada pada jaringan internal. Port forwarding yang didefinisikan adalah:
  • 64.130.31.59:10004 –> 192.168.1.103:22
  • Artinya untuk SSH ke host 192.168.1.103, maka client harus ssh ke IP 64.130.31.59 port 10004.
  • 64.130.31.59:10001 –> 192.168.1.100:22
  • Artinya untuk SSH ke host 192.168.1.100, maka client harus ssh ke IP 64.130.31.59 port 10001.
  • 64.130.31.59:8080 –> 192.168.1.102:80
  • Artinya untuk mengakses halaman web di host 192.168.1.102, maka url yang harus dibuka di browser adalah http://64.130.31.59:8080
Port forwarding pada ssh, mirip dengan port forwarding pada gambar di atas, namun ada sedikit perbedaan. Pada port forward gambar di atas, titik koneksi masuk dan keluar sama, artinya koneksi masuk ke IP dan port tertentu, dan koneksi tersebut akan diforward ke tempat lain dari titik yang sama juga. Sedangkan port forwarding pada ssh, titik keluarnya berbeda dengan titik masuknya. Agar lebih jelas, silakan lihat gambar di bawah ini.
Pada gambar di atas pada bagian atas, koneksi yang masuk di titik masuk, diforward ke tujuan dari titik itu juga. Ini adalah tipikal port forwarding di router/proxy. Sedangkan pada gambar di bawahnya, koneksi yang masuk di titik masuk, diforward ke tujuan dari titik lain di ujung sebelah kanan. Kotak panjang yang menghubungkan dua titik berwarna oranye tersebut menggambarkan koneksi ssh. Koneksi yang masuk akan diforward dari ujung koneksi ssh, bukan dari titik masuknya.

Konsep SSH Tunneling
SSH adalah protokol yang multiguna, selain untuk menggantikan telnet, SSH juga mendukung fitur tunneling, port forwarding, download/upload file (Secure FTP), SOCKS proxy dsb. Semua fitur tersebut dibungkus dengan enkripsi sehingga data yang lewat melalui protokol ini aman dari jangkauan hacker.
Dalam ssh tunneling, data yang dikirimkan melalui koneksi ssh akan di-enkapsulasi (dibungkus) dalam paket SSH seperti pada gambar di bawah ini.
Selain enkapsulasi paket, dalam ssh tunnel juga dibutuhkan port forwarding. Port forwarding dalam SSH tunnel ada 3 jenis:
  • Local Port Forwarding
  • Remote Port Forwarding
  • Dynamic Port Forwarding
Perhatikan gambar di bawah ini untuk memahami perbedaan antara local port forwarding dan remote port forwarding.
Dari gambar di atas jelas terlihat bahwa perbedaan antara local dan remote port forwarding.
  • Pada local port forwarding, komputer yang bertindak sebagai ssh client akan menjadi titik masuk koneksi yang akan diforward dan komputer yang bertindak sebagai ssh server menjadi titik keluar. Jadi koneksi yang masuk ke titik masuk di komputer ssh client akan diforward ke tujuan dari komputer ssh server. Gambar di bawah ini ilustrasi lain dari ssh local port forwarding.

  • Pada remote port forwarding, komputer yang bertindak sebagai ssh server akan menjadi titik masuk koneksi yang akan diforward dan komputer yang bertindak sebagai ssh client menjadi titik keluar. Jadi koneksi yang masuk ke titik masuk di komputer ssh server akan diforward ke tujuan dari komputer ssh client. Gambar di bawah ini ilustrasi lain dari ssh remote port forwarding.
Jadi yang perlu diingat dalam perbedaan antara local dan remote port forwarding adalah posisi titik masuk koneksi yang akan diforward. Bila titik masuknya ada di komputer yang berperan sebagai ssh client, maka itu adalah local port forwarding, namun bila titik masuknya di komputer ssh server, maka itu adalah remote port forwarding.
Dalam bahasa sederhananya, disebut local karena dari sudut pandang ssh client, titik masuknya ada di localhost, dan disebut remote karena titik masuknya bukan di localhost, tapi di komputer ujung sana.

Static vs Dynamic Port Forwarding
Sebenarnya dynamic port forwarding termasuk local port forwarding juga karena pada dynamic port forwarding, titik masuk koneksi yang akan diforward berada di komputer yang berperan sebagai ssh client. Namun pada local dan remote port forwarding biasa (static), IP address dan port asal dan tujuan harus disetting dulu sebelum bisa dipakai, jadi sifatnya statis.
(static) local port forwarding
Gambar di atas adalah (static) local port forwarding biasa. Pada local port forwarding biasa (static), setiap pemetaan port asal dan IP:port tujuannya harus disetting satu per satu. Jadi terlihat pada gambar di atas, bila ada 3 tujuan yang ingin dihubungi, maka 3 pemetaan port asal dan IP:port tujuan harus disetting semua sebelum bisa dipakai.
Pada gambar di atas terlihat di ssh client ada 3 port yang LISTEN (3 bulatan merah di sisi ssh client)  untuk 3 tujuan yang berbeda. Perlu dicatat juga bahwa ketiga pemetaan port forwarding tersebut dilakukan di atas satu koneksi ssh yang sama (multiple port forwarding on single ssh conection).
dynamic (local) port forwarding
Sedangkan pada dynamic (local) port  forwarding, kita tidak perlu menentukan pemetaan port asal dan IP:tujuan untuk setiap tujuan. Kita hanya perlu menentukan port berapa yang akan LISTEN di localhost (di komputer ssh client), dan semua aplikasi bisa memanfaatkan port tersebut sebagai proxy ke tujuan manapun dengan protokol SOCKS (SOCKS proxy). Berbeda dengan gambar sebelumnya, pada dynamic port forwarding di sisi ssh client hanya ada satu port yang LISTEN (hanya ada satu bulatan merah).

Multiple Port Forwarding on Single SSH Connection
Walaupun jarang dipakai, namun sebenarnya ssh mendukung banyak port forwarding dalam satu koneksi ssh. Kalau kita membutuhkan 3 local port forwarding dan 4 remote port forwarding, kita tidak perlu membuat 7 koneksi ssh, cukup satu koneksi ssh saja.
multi port forwarding on a single ssh connection
Gambar di atas memperlihatkan ilustrasi multi port forwarding pada satu koneksi ssh yang sama. Dalam satu koneksi ssh tersebut port forwarding yang dibuat adalah:
  • Panah berwarna hitam paling atas adalah local port forwarding.
  • Panah berwarna biru dan biru gelap di tengah adalah dynamic port forwarding.
  • Panah berwarna hijau paling bawah adalah remote port forwarding.
Daripada membuat 3 koneksi ssh untuk masing-masing port forwarding, jauh lebih sederhana dan praktis membuat multi port forwarding pada satu koneksi ssh.

Membuat Local Port Forwarding
Sekarang setelah memahami konseptualnya, kita langsung praktek bagaimana membuat ssh tunnel dengan putty di Windows dan command line ssh di Linux.Command untuk membuat local port forwarding secara umum adalah:
ssh -L localport:servertujuan:porttujuan user@ssh_server
Contohnya adalah:
ssh -L 8888:www.kompas.com:80 admin@serverku.com
Perintah di atas akan membuat semua koneksi ke port 8888 di localhost, dialihkan ke www.kompas.com port 80 melalui serverku.com. Titik masuknya adalah localhost:8888 dan titik keluarnya adalah serverku.com. Bila kita membuka browser ke URL http://localhost:8888, request HTTP tersebut akan sampai di www.kompas.com:80 melalui serverku.com, artinya dari sudut pandang www.kompas.com koneksi berasal dari serverku.com, bukan dari komputer yang menjalankan perintah tersebut. Dalam log web server www.kompas.com, IP address visitor adalah ip address serverku.com, bukan ip address komputer yang menjalankan perintah tersebut.
Kalau dalam windows, kita bisa gunakan putty.exe untuk membuat local port forwarding tunnel. Gambar di bawah ini adalah setting untuk forward koneksi localhost:8888 ke www.kompas.com:80. Caranya adalah dengan memasukkan 8888 ke dalam field “Source port”, dan memasukkan www.kompas.com:80 ke dalam field “Destination”. Setelah itu klik “Add”. Anda bisa menambahkan port forwarding yang lain sebanyak yang anda butuhkan dengan mengulang cara yang sama lalu klik “Add” lagi.


Membuat Remote Port Forwarding
Command untuk membuat remote port forwarding di Linux secara umum adalah:
ssh -R remoteport:servertujuan:porttujuan user@ssh_server
Contohnya adalah:
ssh -R 8080:192.168.1.1:80 admin@serverku.com
Perintah di atas akan membuat setiap koneksi ke serverku.com:8080 akan dialihkan ke 192.168.1.1 melalui komputer yang menjalankan perintah tersebut. Pada log server tujuan (192.168.1.1:80) yang terlihat dari koneksi yang masuk bukan ip address serverku.com. Server 192.168.1.1:80 akan melihat koneksi berasal dari komputer yang menjalankan perintah di tersebut (komputer ssh client).
Kalau dengan putty caranya masukkan 9999 ke dalam kolom “Source port”, kemudian masukkan 192.168.1.1:80 sebagai kolom “Destination”, lalu klik Add. Anda bisa menambahkan banyak port forwarding dalam satu koneksi ssh, dengan cara yang sama, lalu klik Add sebanyak yang anda butuhkan.

Remote port forwarding ini sangat cocok dipakai sebagai backdoor. Bila seorang hacker telah berhasil menyusup hingga “behind enemy lines”, dia bisa membuat remote port forwarding tunnel dari “behind enemy lines” ke server di luar milik hacker. Ini artinya hacker telah membuat terowongan, dengan pintu masuk di luar, dan pintu keluar di “behind enemy lines”. Ingat pada Remote port forwarding, titik/pintu masuk adalah di sisi ssh server, dan titik/pintu keluar di ssh sisi client. Dengan memakai terowongan ini, hacker bisa masuk melalui pintu di servernya sendiri yang berada di luar, dan secara otomatis hacker tersebut masuk ke “behind enemy lines” karena pintu keluar dari terowongan ini ada di “behind enemy lines”.

Chaining Tunnel
Terkadang ketika melakukan penetrasi, di dunia nyata keadaan tidaklah semulus dan seindah teori atau dalam lab. Firewall seringkali membuat kita tidak bisa bebas membuat koneksi ke server yang kita inginkan. Dalam situasi seperti ini kita harus berputar-putar melalu beberapa server, sampai kita bisa mencapai server target.
Perhatikan gambar di atas, target yang akan diserang hacker adalah server D.D.D.D port 3389, yaitu Remote Desktop connection, hacker ingin melakukan remote desktop komputer tersebut. Namun server D hanya bisa diakses oleh server C, dan server C hanya bisa diakses dari A. Hacker sudah menguasai penuh server A dan C, bagaimana caranya hacker tersebut bisa remote desktop ke D ?
Tujuan akhirnya adalah hacker ingin koneksi ke localhost:9999 di laptop backtracknya, akan diforward ke D.D.D.D:3389. Jadi nanti dia tinggal menjalankan RDP client dengan memasukkan localhost:9999, dan dia otomatis akan terkoneksi ke RDP di server D. Sebagai info tambahan, komputer A dan C adalah linux dengan ssh service diaktifkan.
Mari kita coba membuat semua tunnel ini purely hanya dengan ssh.
1. Buat port forwarding localhost:9999 –> C.C.C.C:8888 via A.A.A.A.
Hacker menjalankan ssh client di backtracknya untuk membuat koneksi ke ssh server A.A.A.A. Dalam koneksi ssh ini, dia membuat local port forwarding 9999:C.C.C.C:8888, yang artinya adalah koneksi ke port 9999 di backtrack si hacker akan diforward ke C.C.C.C:8888 via A.A.A.A.
2. Buat port forwarding C.C.C.C:8888 –> D.D.D.D:3389 via C.C.C.C
Di komputer C, hacker membuat koneksi ssh ke localhost (ke C itu sendiri). Dalam koneksi ssh ke diri sendiri ini dia membuat local port forwarding 8888:D.D.D.D:3389. Artinya adalah koneksi ke C.C.C.C:8888 akan diforward ke D.D.D.D:3389 (via C.C.C.C itu sendiri).
Kita membuat 2 tunnel, yang pertama adalah tunnel dengan pintu masuk di backtrack hacker dan pintu keluar di A.A.A.A. Tunnel kedua adalah denngan pintu masuk dan pintu keluar di C juga.
Pada tunnel pertama, koneksi ke pintu masuk di backtrack hacker (localhost:9999), akan diforward ke C.C.C.C:8888 via A.A.A.A Sedangkan pada server C.C.C.C sudah dibuat port forwarding sehingga semua koneksi yang masuk ke C.C.C.C:8888 akan diforward menuju D.D.D.D:3389.
Jadi akhirnya nanti alurnya adalah:
localhost:9999 –> C.C.C.C:8888 –> D.D.D.D:3389


Gambar di atas menunjukkan chain tunnel yang dibuat. Koneksi ke localhost:9999 akan diteruskan ke C.C.C.C:888 dan koneksi ke C.C.C.C:8888 akan diteruskan ke D.D.D.D:3389. Jadi sama artinya dengan koneksi ke localhost:9999 diteruskan ke D.D.D.D:3389.

Source : http://www.ilmuhacking.com/how-to/kupas-tuntas-ssh-tunneling/

Mempercepat Koneksi dengan ssh Tunnel

Abis liat-liat google akhirnya nemu ssh tunnel. Saya akan mencoba untuk mempercepat koneksi kita dengan ssh tunel.

ssh-tunnel
Syarat-syarat yang diperlukan :
1. Memiliki account ke SSH Server
2. SSH server support tunnel
3. Komputer anda memiliki SSH client
4. Koneksi Internet di SSH Server lebih kencang
5. SANGAT DISARANKAN server SSH terletak pada jalur IIX.

Kita akan mencoba di 2 sistem operasi. Saya pilih windows dan linux. Saya akan mengulas dari windows terlebih dahulu.


A. Percobaan yang di sistem operasi windows Xp sp3, P3 800;

Memory 387; VGA 128 MB Nvidia Gefore 5400, seperti ini:

1. Siapkan putty (software buat konek ke ssh server). Silahkan minta sama mbah google untuk dapetin putty
2. Copy putty ke folder C:WINDOWS
3. Lalu, klik start pilih Run, atau bisa menggunakan tombol kombinasi windows + R, di keyboard.
4. Di run ketikkan:
putty -D port ssh -C userid@ip ssh server
tekan Enter <|
5. Tunggu beberapa saat sampai diminta untuk memasukkan password
6. Lalu masukkan kita masukkan password
7. Sekarang minimize aja putty nya
8. Lalu buka browser, saya akan menggunakan internet explorer 7
9. Selanjutnya klick tool > internet option > pilih tab connection >
pilih LAN setting > cek box pd proxy server > klick advanced >
hilangkan tanda cek bok pd “use same proxy server for all
protocols” > hapus semua settingan yg ada di colum HTTP,Secure,
FTP. > pada socks isikan : localhost portnya 22 > klick OK
10. Sekarang coba kita akan cek koneksi internetnya, masuk ke situs http://speedtest.net untuk mengecek speed, jika speednya bertambah dari yang kita punya maka berhasil, tapi kalau nggak nambah ya berarti gagal deh. :D

B. Percobaan pake linux:
Dari yang saya dapat dari si mbah google settingannya tidak jauh berbeda tapi tergantung dari browser yang dipakai. Mungkin perbedaannya di command aja.
Berikut langkahnya:
1. Buka terminal programnya atau dengan tombol kombinasi ALT+F2 > ketikkkan Konsole
2. Kemudian install putty nya. Kalo belom ada minta sama mbah google aja, minta yang untuk linux
3. Kalo udah diinstal putty nya. Berikutnya langsung konek pake ssh dengan cara ketikkan :
contoh ;
# ssh -D 22 -C  HNaccount at 202.250.32.12

Catatan
* -D : maksudnya untuk membuka socks proxy,
Dan SOCKS ini lah yang kita gunakan untuk tunneling.
-C : untuk compressi data yg lewat.
22 : port ssh yg digunakan ato yg terbuka untuk koneksi ssh Port nya nggak harus 22, bisa berapa aja sesuai setting ssh server nya.

* settingan itu hanya berlaku pada browser yg diset ajah :D, tidak mempengaruhi applikasi yg lain yg sedang berjalan. misal mirc, applikasi yg lain yg konek ke internet akan tetap menggunakan koneksi internet anda yg sudah ada, misal speedy seperti.
* jika browsing atau downlaod anda masih lemot berarti server ssh yg anda gunakan juga lemot juga :D

* koneksi akan terputus jika :
1. Aplikasi putty di close ato terminate karena hang.
2. Koneksi internet yg anda gunakan anda terputus
3. Atau server ssh yang anda gunakan mati atau terputus dari internet, karena kena ddos atau kena trojan atau emang dimatiin. :D atau anda ketahuan sama admin, karena account ssh anda ilegal, jadi anda ditendang dr server ssh. :D
4. Settingan pada browser di hapus. Atau di set ke deafult.
5. Komputer anda kena virus/trojan ato kena flood/ddos, shg tidak bisa konek ke internet dg baik.

* sebaiknya jgn sering sering gunain cara ini jika account ssh anda illegal, krn kemungkinan ketahuan yang punya atau admin server ssh, anda bisa kena banned /block, jadi nggak bisa konek lagi. Tapi nggak papa cari target aja lagi :D.
======================================================================
Beberapa hal yg mungkin terjadi menggunakan ssh tunnel ini, yaitu:
Mungkin browsing anda tidak bisa cepat sesaui dengan harapan, karena tergantung pada server ssh yang digunakan. Tetapi download ke server luar bisa lebih cepat. Atau sebaliknya
======================================================================




Mungkin hanya ini yang bisa saya share, semoga bermanfaat untuk teman-teman semua.

Source : http://adhie70.blogdetik.com/mempercepat-koneksi-dengan-ssh-tunnel/

Wednesday 28 August 2013

Backup and Restore MySQL Database Using mysqldump

mysqldump is an effective tool to backup MySQL database. It creates a *.sql file with DROP table, CREATE table and INSERT into sql-statements of the source database. To restore the database,  execute the *.sql file on destination database.  For MyISAM, use mysqlhotcopy method that we explained earlier, as it is faster for MyISAM tables.

Using mysqldump, you can backup a local database and restore it on a remote database at the same time, using a single command. In this article, let us review several practical examples on how to use mysqldump to backup and restore.

For the impatient, here is the quick snippet of how backup and restore MySQL database using mysqldump:


backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql

How To Backup MySQL database

1. Backup a single database:


This example takes a backup of sugarcrm database and dumps the output to sugarcrm.sql

# mysqldump -u root -ptmppassword sugarcrm > sugarcrm.sql

# mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

The sugarcrm.sql will contain drop table, create table and insert command for all the tables in the sugarcrm database. Following is a partial output of sugarcrm.sql, showing the dump information of accounts_contacts table:
--
-- Table structure for table `accounts_contacts`
--

DROP TABLE IF EXISTS `accounts_contacts`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `accounts_contacts` (
`id` varchar(36) NOT NULL,
`contact_id` varchar(36) default NULL,
`account_id` varchar(36) default NULL,
`date_modified` datetime default NULL,
`deleted` tinyint(1) NOT NULL default '0',
PRIMARY KEY  (`id`),
KEY `idx_account_contact` (`account_id`,`contact_id`),
KEY `idx_contid_del_accid` (`contact_id`,`deleted`,`account_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Dumping data for table `accounts_contacts`
--

LOCK TABLES `accounts_contacts` WRITE;
/*!40000 ALTER TABLE `accounts_contacts` DISABLE KEYS */;
INSERT INTO `accounts_contacts` VALUES ('6ff90374-26d1-5fd8-b844-4873b2e42091',
'11ba0239-c7cf-e87e-e266-4873b218a3f9','503a06a8-0650-6fdd-22ae-4873b245ae53',
'2008-07-23 05:24:30',1),
('83126e77-eeda-f335-dc1b-4873bc805541','7c525b1c-8a11-d803-94a5-4873bc4ff7d2',
'80a6add6-81ed-0266-6db5-4873bc54bfb5','2008-07-23 05:24:30',1),
('4e800b97-c09f-7896-d3d7-48751d81d5ee','f241c222-b91a-d7a9-f355-48751d6bc0f9',
'27060688-1f44-9f10-bdc4-48751db40009','2008-07-23 05:24:30',1),
('c94917ea-3664-8430-e003-487be0817f41','c564b7f3-2923-30b5-4861-487be0f70cb3',
'c71eff65-b76b-cbb0-d31a-487be06e4e0b','2008-07-23 05:24:30',1),
('7dab11e1-64d3-ea6a-c62c-487ce17e4e41','79d6f6e5-50e5-9b2b-034b-487ce1dae5af',
'7b886f23-571b-595b-19dd-487ce1eee867','2008-07-23 05:24:30',1);
/*!40000 ALTER TABLE `accounts_contacts` ENABLE KEYS */;
UNLOCK TABLES;

2. Backup multiple databases:

If you want to backup multiple databases, first identify the databases that you want to backup using the show databases as shown below:

# mysql -u root -ptmppassword

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bugs               |
| mysql              |
| sugarcr            |
+--------------------+
4 rows in set (0.00 sec)

For example, if you want to take backup of both sugarcrm and bugs database, execute the mysqldump as shown below:

# mysqldump -u root -ptmppassword --databases bugs sugarcrm > bugs_sugarcrm.sql

Verify the bugs_sugarcrm.sql dumpfile contains both the database backup.
# grep -i "Current database:" /tmp/bugs_sugarcrm.sql
-- Current Database: `mysql`
-- Current Database: `sugarcrm`

3. Backup all the databases:

The following example takes a backup of  all the database of the MySQL instance.
# mysqldump -u root -ptmppassword --all-databases > /tmp/all-database.sql

4. Backup a specific table:

In this example, we backup only the accounts_contacts table from sugarcrm database.
# mysqldump -u root -ptmppassword sugarcrm accounts_contacts \
      > /tmp/sugarcrm_accounts_contacts.sql

4. Different mysqldump group options:

  • –opt is a group option, which is same as –add-drop-table, –add-locks, –create-options, –quick, –extended-insert, –lock-tables, –set-charset, and –disable-keys. opt is enabled by default, disable with –skip-opt.
  • –compact is a group option, which gives less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options –skip-add-drop-table –no-set-names –skip-disable-keys –skip-add-locks

How To Restore MySQL database

1. Restore a database


In this example, to restore the sugarcrm database, execute mysql with < as shown below. When you are restoring the dumpfilename.sql on a remote database, make sure to create the sugarcrm database before you can perform the restore.
# mysql -u root -ptmppassword

mysql> create database sugarcrm;
Query OK, 1 row affected (0.02 sec)

# mysql -u root -ptmppassword sugarcrm < /tmp/sugarcrm.sql

# mysql -u root -p[root_password] [database_name] < dumpfilename.sql

2. Backup a local database and restore to remote server using single command:

This is a sleek option, if you want to keep a read-only database on the remote-server, which is a copy of the master database on local-server. The example below will backup the sugarcrm database on the local-server and restore it as sugarcrm1 database on the remote-server. Please note that you should first create the sugarcrm1 database on the remote-server before executing the following command.
[local-server]# mysqldump -u root -ptmppassword sugarcrm | mysql \
                 -u root -ptmppassword --host=remote-server -C sugarcrm1
[Note: There are two -- (hyphen) in front of host]
If you liked this article, please bookmark it on del.icio.us and Stumble it.

Source :  http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/