Disable SELINUX

| Monday, May 24, 2010

Here is the way to disable selinux:

1-Edit /etc/selinux/config and set the SELINUX variable to 'disabled'
2-Use the setenforce command to disable on-the-fly

With solution 1, your changes are permanent but only effective if you reboot the machine.

With solution 2, your changes are NOT permanent but effective immediately.

Hope this clears it up :-).

taken from : http://www.linuxquestions.org

SE Linux

| Friday, May 07, 2010

Install SE Linux

# apt-get install selinux-basics selinux-policy-default
# reboot
# nano /etc/default/rcS
edit FSCKFIX=yes
# nano /etc/cron.daily/mlocate (digunakan agar locate database tidak berjalan terus)
tambahkan exit 0 pd baris ke 2

Jika sudah selesai ketikkan :
# check-selinux-installation
# rm /var/run/motd
# ln -s /etc/motd.baru /etc/motd

Security Linux

| Thursday, May 06, 2010

1. Matikan dan buang service2 yang tidak perlu.
bisa install rcconf u/ mengatur startup.
dan apt-get remove packagegakpenting

2. Edit partisi, matikan eksekusi untuk partisi dimana user menaruh data (terutama web server)

3. Ubah file descriptor di sysctl.conf
your file descriptor must be beyond 65535

4. Upgrade ke kernel paling baru.

5. Atur firewall se secure mungkin. Allow port yang diperlukan saja.

6. Atur akses login user.

7. Sebisa mungkin jangan gunakan default port.

8. Disable root login from remote

9. Edit motd.

10. Coba main2 dgn sysctl.conf (beware, resiko ditanggung sendiri).

11. Secure kan service2 dan option pada program yg terinstall, misalnya : my.cnf, php.ini, httpd.conf, ftp.conf, snmpd.conf named.conf

12. Install tool pendukung monitoring :
- snmpd, ifstat, iptraf, snort, lsof, htop, deborphan, mtr, nikto. well why do i forget other tool in this critical moment..

Nanti ditambahkan kalau ada lagi.

Thx to cakri n google. u;re all da best.

mencari Package tidak perlu

|

# apt-get install deborphan
# deborphan -sz
# apt-get remove namapackage
atau
# apt-get remove --purge $(deborphan)
atau bisa juga
# orphaner
perintah di atas ada tampilan grafisnya ;)

Cisco2an

| Thursday, April 29, 2010

# sh run
# conf term
# int Fastethernet0/1
# [config] ip address 10.10.10.1 255.255.255.240 secondary
# exit
# exit
# copy run start


# sh vlan
# conf term
# int Fastethernet0/1
dst2.. lali..

postingan ini hanya buat nyubie yg belajar cisco tanpa arah

PureFTPd di Linux.

| Wednesday, March 31, 2010

Hari ini nyoba install via tarball, yg q jadikan eksperimen adalah pureftpd.

1. Download Source
wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.29.tar.gz
2. Ekstrak
tar -xzvf pure-ftpd-1.0.29.tar.gz
3. masuk ke directory hasil ekstrak
4. ./configure

Nah lo..koq pas configure error. :(
Ternyata compiler gak support, jadi harus install dulu

apt-get install gcc
apt-get install g++

Ulangi lagi deh configurenya, kemudian lanjutkan dgn perintah make && make install

kelanjutannya ada di postingan ini

Bagi yang compile dgn support mysql coba install dulu mysql-devel
apt-get mysql-devel

Install Snmpd..

| Thursday, March 25, 2010

Install snmpd cara praktis aja ya..
# apt-get install snmpd (linux)
# pkg_add -rv net-snmpd (fbsd)

Stl itu copy file konfigurasi :
# cp /etc/snmp/snmpd.conf.orig /etc/snmp/snmpd.conf (linux)
# cp /usr/local/share/snmpd/snmpd.conf.example /usr/local/share/snmpd/snmpd.conf (bsd)

Edit /etc/snmp/snmpd.conf :
com2sec local localhost public
com2sec local ipmrtgserver public

Edit /etc/default/snmpd : (freebsd ga perlu proses ini)
remove ip 127.0.0.1

Restart snmp : /etc/init.d/snmpd restart

disable telnet inetd

|

Ketik perintah berikut :

# /usr/sbin/update-inetd --disable telnet

Manage startup service

|

Untuk meremove service di linux sewaktu startup ada bbrp cara :

1. # update-rc.d -f NAMASERVICE remove
contoh :
# update-rc.d -f exim4 remove

2. Install rrconf
# apt-get install rcconf
tunggu proses selesai, ketik :
# rcconf

Tinggal check/uncheck yg ga perlu aja, kayak msconfig gitu..

Kalo di FreeBSD, tinggal cek aja isi /etc/rc.conf atau cek didirectory /usr/local/etc/rc.d

Wokeh.. selamat berbahagia..

bunuh semua!!

| Friday, March 19, 2010

Cara membunuh/kill semua proses pada suatu daemon adl sbb :

ps -ax | grep "/usr/local/sbin/httpd" | awk '{print $1}' | xargs kill

atau kalau mau lihat process owner idnya

ps -aux | grep "/usr/local/sbin/httpd" | awk '{print $2}' | xargs kill


nb : bedanya cuman di awk row nya aja..

bigmem Vs PAE

| Thursday, March 18, 2010

Memory anda lebih dari 4GB? tapi tidak terdeteksi semua?
Apa pasal?

Hal ini dikarenakan OS yg terinstall 32bit dan kernel bigmem (di linux) atau PAE (di FreeBSD) belum diaktifkan.

Untuk FreeBSD ada 2 cara :
1. tambahkan baris berikut di file kernel anda dan compile ulang
options PAE
menambahkan baris tersebut akan menyebabkan beberapa driver tidak disupport, jadi perlu dipertimbangkan apakah driver dipakai atau tidak.

2. Cara kedua adalah dengan cara install ulang dgn ISO AMD64.

Untuk Debian coba langkah berikut.

- Install lshw untuk cek memori real anda
# apt-get install lshw
# lshw -C memory
# dpkg --get-selections | grep bigmem
# apt-get install linux-image-2.6.26.2-686-bigmem

Cek hasil instalasi kernel dgn perintah berikut :
# dpkg --get-selections | grep bigmem
linux-image-2.6.26.2-686-bigmem install

Untuk menu booting lihat dulu
# grep "Debian GNU" /boot/grub/menu.lst | nl -v0

Sesuaikan menu kernel dgn nomer default boot.

mounting...

| Wednesday, March 17, 2010

kalo tiba2 fbsd ngadat n masuk mountroot, gimana donk ?
1. perhatikan kabel HD yg terpasang apakah sudah di set primary?
2. perhatikan jumper HD, sbg master atau slave wkt instalasi.

Kalau sistem msk single mode dan hanya read only mode. Sedangkan kita butuh ngedit /etc/fstab buat ngedit mount pointnya, caranya sbb :

mount -t ufs rw /dev/ad0s1a / (mounting root, nm partisi sesuiakan)

sunlink

| Thursday, November 26, 2009

Sunlink bukan merk sabun cuci maupun shampo..
Sunlink di freebsd digunakan untuk memblok delete permission dgn kata lain smua user tidak bisa menghapus file yg telah di sunlink.

Perintahnya :
# chflags sunlink ojodidel.txt

Untuk menonaktifkan sunlink sbb :

# chflags nosunlink ojodidel.txt

Mengenal beberapa Unix tool.

| Thursday, November 05, 2009

1. Sed
Sed adalah stream editor. Pada dasarnya digunakan untuk manipulasi text.

Perintah dasar.

sed [-lrn] [-e 'sedscript'] [file1 file2 ...]

-l : line buffered
-r : extended regex
-n silences default output

Paling males kan baca perintah dasar? soalnya saya blm paham kalau ngga ada contohnya :P.

% echo "Hello there foo" | sed -e 's/foo/bar/'
Hello there bar

nah.. paham kan? perintah diatas dpt digunakan untuk mereplace foo menjadi bar

saya mencoba perintah berikut dan berhasil
# more limit | sed -e 's/fxp1/rl0/' >> limitbaru
perintah diatas adalah membaca file dgn nama limit dan mereplace semua kata yg mengandung fxp1 menjadi rl0 dan hasilnya disimpan dalam file limitbaru

Perintah sed juga bisa berfungsi seperti grep.

% sed -ne '/FreeBSD/p' /etc/motd
FreeBSD 6.2-PRERELEASE (FOO) #0: Sat Nov 11 00:12:52 EST 2006
Welcome to FreeBSD!

Dapat digunakan juga untuk melihat header mail.
% cat mymail \
| sed -ne '/^[A-Za-z0-9]/ { x; /^Received: /{p;}; }; /^[A-Za-z0-9]/!H'
Received: from localhost (localhost [127.0.0.1])
by whitefox.csh.rit.edu (Postfix) with ESMTP id 731F81145C
for ; Sat, 19 May 2007 01:19:30 -0400 (EDT)
Received: from whitefox.csh.rit.edu ([127.0.0.1])
by localhost (whitefox.csh.rit.edu [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id EURHKUeHSrao for ;
Sat, 19 May 2007 01:19:16 -0400 (EDT)

2. cut
Cut digunakan untuk memotong bbrp bagian dr data.

Perintah dasar

cut [-d delim -f range] [-c range] [-b range]

% echo "one,two,three,four" | cut -d"," -f 1,3
one,three

yang tdk bisa dieksekusi oleh cut

% echo "one two three" | cut -d' ' -f 2

% echo "one two three" | awk '{print $2}'
two

3. awk
awk merupakan filter tool pada scripting

Perintah dasar
awk [-F] [awk_script]

awk mempunyai 2 konsep data spyt pd input file yaitu field dan record

record adalah seluruh baris, pemisah antar record adl baris baru

field adalah kata2, pemisahnya adalah spasi atau tab. default pemisahnya adalah spasi tapi bs juga sebuah karakter atau regular expression.

pattern : [condition_expressions] { [action_expressions] }
% fstat | sed -e 1d \
| awk '{a[$1]++} END { for (i in a) { print i, a[i] } }' \
| sort -nk2
smmsp 8
_dhcp 11
www 45
root 328
jls 482

Show file yg tdk kosong
% ls -l | awk '$5 > 0'

Show log antar 10 May dan 20 May
% cat *.log | awk '$1 == "May" && ($2 >= 10 && $2 <= 20)'

Show ip dari perintah host
% host www.google.com | awk '/has address/ { print $4 }'

Sulit sekali memahami perintah awk ini..
Tapi emang powerfull bgt..

4. xarg
xarg digunakan untuk mengambil argumen dan digunakan untuk menjalakan program.

Perintah dasar
xargs [flags] [command [args]]

# delete png file
% find ./i/ -name '*.png' | xargs rm


% cat /tmp/somehosts \
| xargs -P10 -I"HOST" -n1 sh -c 'ssh HOST uptime | sed -e "s/^/HOST: /"'


Tiba2 koq laper.. :(
Sampe sini aja dulu...


Taken : semicomplete.com

cara reset mikrotik

| Tuesday, November 03, 2009

Teman2 sempat pusing mikirin ada perangkat mikrotik warisan tapi lupa passwordnya. Dari googling ada cara ribet yaitu install ulang OS nya via kabel dan butuh software ini itu [lupa].

Tapi hal itu takkan pernah terjadi setelah nemu postingan di forum berikut :


look above: this little hole is JP1, Stick a screwdriver in it while booting (to short-circuit it) and it will reset the config.

thx a lot to http://forum.mikrotik.com

Cara eksport dan import database mysql di unix based

| Thursday, October 29, 2009



Cara untuk eksport database mysql via console bisa dilakukan sbb :

# mysqldump -uusernya -ppasswordnya master > backup.sql

Perintah diatas akan melakukan export data pada database master kedalam file backup.sql

Sedangkan cara untuk import database sbb:

# mysqldump -uusernya -ppasswordnya dbbaru backup.sql

Namun jika database yang di import besar ratusan MB dpt digunakan cara sbb :

# mysql -u root -p
# use dbbaru;
# source /home/aku/backup.sql

Yatta!!.. berhasil.. berhasil.. alhamdulillah...moga2 saja bisa untuk backup database sampe satu GB huehue..

upgrade Freebsd dari release ke stable dengan cvsup

| Wednesday, October 28, 2009

Berikut langkah2 untuk upgrade Freebsd stable

# whereis cvsup-without-gui
cvsup-without-gui: /usr/ports/net/cvsup-without-gui
# cd /usr/ports/net/cvsup-without-gui
# make install clean

Setelah selesai copy kedua file cvsup ke directory /etc

#cp /usr/share/examples/cvsup/ports-supfile /etc
#cp /usr/share/examples/cvsup/stable-supfile /etc

Edit kedua file tsb dan pada baris
default host=
isi dengan cvsup.freebsd.or.id atau cari server cvsup terdekat

kemudian jalankan perintah
# cd /etc
# cvsup -g -L 2 ports-supfile && cvsup -g -L 2 stable-supfile
# cd /usr/src
# make buildworld
# make buildkernel KERNCONF=namakernel
# make installkernel KERNCONF=namakernel
# shutdown -r now (untuk reboot)
# cd /usr/src
# make installworld
# uname -a

FreeBSD ns1.xxx.xxx.id 7.2-STABLE FreeBSD 7.2-STABLE #0: Wed Oct 28 09:58:36 UTC 2009 ainur@xxx.xxx.id

install apache 22 + SSL

| Tuesday, September 08, 2009

# cd /usr/ports/www/apache22
# make install clean

# mkdir /usr/local/etc/apache22/ssl.key
# mkdir /usr/local/etc/apache22/ssl.crt
# chmod 0700 /usr/local/etc/apache22/ssl.key
# chmod 0700 /usr/local/etc/apache22/ssl.crt

# cd /root
# openssl genrsa -des3 -out server.key 1024

# openssl req -new -key server.key -out server.csr

# openssl x509 -req -days 365 -in /root/server.csr -signkey /root/server.key -out /root/server.crt

# cp /root/server.key /usr/local/etc/apache22/ssl.key/
# cp /root/server.crt /usr/local/etc/apache22/ssl.crt/

# chmod 0400 /usr/local/etc/apache22/ssl.key/server.key
# chmod 0400 /usr/local/etc/apache22/ssl.crt/server.crt

# cd /usr/local/etc/apache22/extra
# vi httpd-ssl.conf

Isikan httpd-ssl.conf sbb :

Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl

# Pass Phrase Dialog:
# Configure the pass phrase gathering process.
# The filtering dialog program (`builtin' is a internal
# terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog builtin

# Inter-Process Session Cache:
# Configure the SSL Session Cache: First the mechanism
# to use and second the expiring timeout (in seconds).
#SSLSessionCache "dbm:/var/run/ssl_scache"
SSLSessionCache "shmcb:/var/run/ssl_scache(512000)"
SSLSessionCacheTimeout 300

# Semaphore:
# Configure the path to the mutual exclusion semaphore the
# SSL engine uses internally for inter-process synchronization.
SSLMutex "file:/var/run/ssl_mutex"

##
## SSL Virtual Host Context
##



# General setup for the virtual host
DocumentRoot "/usr/local/www/apache22/data"
ServerName www.example.com:443
ServerAdmin you@example.com
ErrorLog "/var/log/httpd-error.log"
TransferLog "/var/log/httpd-access.log"

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. Keep
# in mind that if you have both an RSA and a DSA certificate you
# can configure both in parallel (to also allow the use of DSA
# ciphers, etc.)
SSLCertificateFile "/usr/local/etc/apache22/ssl.crt/server.crt"
#SSLCertificateFile "/usr/local/etc/apache22/server-dsa.crt"

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile "/usr/local/etc/apache22/ssl.key/server.key"
#SSLCertificateKeyFile "/usr/local/etc/apache22/server-dsa.key"

# Server Certificate Chain:
# Point SSLCertificateChainFile at a file containing the
# concatenation of PEM encoded CA certificates which form the
# certificate chain for the server certificate. Alternatively
# the referenced file can be the same as SSLCertificateFile
# when the CA certificates are directly appended to the server
# certificate for convinience.
#SSLCertificateChainFile "/usr/local/etc/apache22/server-ca.crt"

# Certificate Authority (CA):
# Set the CA certificate verification path where to find CA
# certificates for client authentication or alternatively one
# huge file containing all of them (file must be PEM encoded)
# Note: Inside SSLCACertificatePath you need hash symlinks
# to point to the certificate files. Use the provided
# Makefile to update the hash symlinks after changes.
#SSLCACertificatePath "/usr/local/etc/apache22/ssl.crt"
#SSLCACertificateFile "/usr/local/etc/apache22/ssl.crt/ca-bundle.crt"

SSLOptions +StdEnvVars


SSLOptions +StdEnvVars

BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

# Per-Server Logging:
# The home of a custom SSL log file. Use this when you want a
# compact non-error SSL logfile on a virtual host basis.
CustomLog "/var/log/httpd-ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"


Supaya tiap kali start apache tdk ditanya password, lakukan sbb :
cd /usr/local/etc/apache22/ssl.key/
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key

pasang hd ke2 d freebsd

| Monday, August 10, 2009

Kemarin hd router utama ko. Manggil bootloader aja trus mandek..
Wah pdhal byk data penting. Akhirnya aq psg aja jadi secondary d fbsdku yg lain.
Nah..mslhnya adl msh lom dkenali partisinya. Coba edit fstabnya.

Mengenal dot-file di *NIX system

| Thursday, February 19, 2009

Pasti pernah tau kan dot-file. Ya, yang biasanya ada di home directory (/home/namauser).File tersebut adalah file konfigurasi untuk mengatur setting dari program Unix/Linux seperti shell (bash/ksh/sh), vi (file editor) dan aplikasi lainnya.

File konfigurasi untuk sistem *NIX biasanya disimpan di /etc atau di /usr/local/etc. Tiap aplikasi mempunyai format yang unik, user bisa saja meletakkan file konfigurasi tidak sesuai dengan defaultnya tapi ke directory lain. Untuk menyembunyikan file konfigurasi dari listing normal (ls), maka file/directory bisa diprefik (awalan) dot (titik).

Untuk melihat dot-file bisa digunakan perintah ls -a atau kalau di FreeBSD cukup memakai ll atau kalau mau lebih singkat bisa dengan perintah ls -ld .*

diterjemahkan scr bebas dari : www.cyberciti.biz