Halaman

Kamis, 31 Juli 2014

How to Configure TFTPD

How to setup TFTP server on Debian

Step 1: Installation of tftpd package (server) and client
aptitude install tftpd
aptitude install tftp

Step 2: Creating Directory and setting permission
mkdir /tftpboot
chmod 777 /tftpboot
chown imran.imran /tftpboot

Step 3: Checking and editing(if required) the /etc/inetd.conf
Correct the location of director from /srv/tftp to /tftpboot

tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot

Don't forget to restart.
It is is tricky to restart the tftpd, you have to restart inetd, but in Debian it is openbsd-inetd
cd /etc/init.d
./openbsd-inetd restart

Step 4: Testing
Type following
tftp 127.0.0.1
tftp>

Step 5: Security

you can edit /etc/hosts.allow and /etc/hosts.deny for restriction.

That's it.

Further doc

http://www.debianhelp.co.uk/tftp.htm
http://www.onlamp.com/pub/a/bsd/2003/06/05/FreeBSD_Basics.htm

Indo Doc

http://blog.ub.ac.id/hnachan/2010/12/08/protokol-tftp-trivial-file-transfer-protocol/
http://www.php.indah.web.id/2012/03/inetd-xinetd-daemon-socket-jaringan.html

Make TFTP

TFTP (Trivial File Transfer Protocol), a simple form of the File Transfer Protocol (FTP). TFTP uses the User Datagram Protocol (UDP)and provides no security features. It is often used by servers to boot diskless workstations, X-terminals, and to backup routers configurations files.

To install it in Debian or ubuntu:

#apt-get install tftpd tftp
edit /etc/xinetd.d/tftp file, if file doesnt exist create one.
service tftp

{

disable = no

socket_type = dgram

protocol = udp

wait = yes

user = root

server = /usr/sbin/in.tftpd

server_args = -s /tftpboot

per_source = 11

cps = 100 2

flags = IPv4

}
Create a directory called tftpboot in root
#mkdir /tftpboot
Change mode of the directory
#chmod 777 tftpboot
Restart xnetd
#/etc/inid.d/xinetd restart
Now test your connections
#tftp 192.168.10.10
Telnet to your cisco router and start backing up your configuration files.

Reference :
http://shirwa.wordpress.com/2007/11/15/backing-cisco-configuration-file-using-tftpd-in-linux/
http://linux.die.net/man/8/tftpd
http://www.tek-tips.com/viewthread.cfm?qid=532990
http://superuser.com/questions/670503/cant-create-new-files-on-tftp-server

Kamis, 24 Juli 2014

RSYSLOG with Cisco router

To setup RSYSLOG with Cisco router, we need to first install the packet on the linux by entering apt-get install rsyslog.
After installing the package, we will then proceed to configure the configuration by opening /etc/rsyslog.conf.
Uncomment # provides UDP syslog reception $ModLoad imudp $UDPServerRun 514 and then add local7.*   /var/log/cisco to the configuration.
Lastly, add $AllowedSender UDP, 127.0.0.1, (ip address) to the end of the configuration file. Restart the service by service rsyslog restart. Create the log file in /var/log/ by entering touch cisco.

For the router, enable logging by entering logging host (linux ip address) sequence-num-session in the global configuration mode.sequence- num-session (Optional) Includes a session sequence number tag in the syslog message. logging trap (1-7) to filter out the priority of the logs.
Generate some logging traffic and verify if the logging is sucessful or not by opening the log file created in /var/log/cisco.
Cisco log reference : http://www.cisco.com/c/en/us/td/docs/ios/netmgmt/command/reference/nm_book/nm_09.html#wp1082864

Jumat, 11 Juli 2014

Installing Nagios Core monitoring system (client and server)


The monitoring server
1. Install Nagios Core and dependancies
apt-get install nagios3 nagios-nrpe-plugin

2. Create the admin user
htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin

3. Create a host to monitor (pico /etc/nagios3/conf.d/server1.cfg)
define host {
use generic-host
host_name server1
alias server1
address 192.168.1.3
}
define service {
use generic-service
host_name server1
service_description Disk Space
check_command check_all_disks!20%!10%
}
define service {
use generic-service
host_name server1
service_description Current Users
check_command check_users!20!50
}
define service {
use generic-service
host_name server1
service_description Total Processes
check_command check_procs!250!400
}
define service {
use generic-service
host_name server1
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0
}

Replace server1 with the actual hostname of the server being monitored and the IP address to correct one.
This configuration will allow you to monitor the disk usage, active users, number of processes and the cpu load of a single server. Configuring host groups and other services are outside the scope of this article.
4. Restart Nagios
/etc/init.d/nagios3 restart

4. Enter the webadmin by opening this location in a web browser: http://yourserver/nagios3
Clients monitored by the monitoring server
1. Install the Nagios NRPE (Nagios Remote Plugin Executor)
apt-get install nagios-nrpe-server

2. Allow the monitoring server to connect to this NRPE (pico /etc/nagios/nrpe.cfg)
allowed_hosts=192.168.1.2

Replace 192.168.1.2 with the IP address of the monitoring server.
NRPE listens for connections on TCP port 5666 so make sure your firewall allows connections to that port from the monitoring server.
3. Restart NRPE
/etc/init.d/nagios-nrpe-server restart

Source : http://www.debiantutorials.com/installing-nagios-core-monitoring-system-client-and-server/

Simple SNMPD Server Configuration

apt-get install snmp snmpd
 

pico /etc/snmp/snmpd.conf

agentAddress udp:161,udp6:[::1]:161
rocommunity linux

sysLocation    cyber_building_indonesia
sysContact     nasohi@ciptandani.net


/etc/init.d/snmpd restart


snmpwalk localhost -c linux -v1

Referensi :
http://www.debianhelp.co.uk/snmp.htm
https://wiki.debian.org/SNMP
http://www.laub-home.de/wiki/SNMP_Installation_und_Konfiguration_%28Debian/Ubuntu%29

Selasa, 13 Mei 2014

FTP Passive Mode

Untuk kebutuhan normal, seperti umumnya FTP server, VSFTPD akan listen di port 21. Dan setelah semua settingan normal sudah dilakukan, FTP server sudah bisa diakses oleh sembarang FTP client tanpa masalah.
Akan tetapi, berbeda dg kebanyakan server2 lain seperti Email, Web, dll. yg dapat berjalan dg normal di belakang firewall menggunakan NAT, maka VSFTPD tidak dapat berjalan normal apabila ia berada di belakang firewall menggunakan NAT. Untuk ini harus ditambahkan setting pada file konfigurasi VSFTPD agar dapat berjalan pada passive mode, kemudian menyesuaikan setting NAT pada firewall. Caranya adalah dengan mengaktifkan mode passive mode di VSFTPD.
Sebagai contoh, penempatan sebuah FTP server yg diletakkan pada area DMZ di belakang firewall yg mana ia dapat diakses dari jaringan luar dan dalam, secara mendasar akan berbentuk sbb :
Internet (External)
||
||
Firewall ====== DMZ FTP Server
||
||
Internal (LAN)
Bila FTP Server dalam posisi DMZ seperti dalam gambar, maka agar FTP Server dapat diakses dari Internet maupun LAN, maka yg harus dilakukan sbb :
1. Aktifkan passive mode pada konfigurasi VSFTPD di server FTP
2.
Setting port range tertentu untuk passive mode (mis : 50000-51000)
3.
Tambahkan rule baru di firewall –> outbound/inbound ke/dari FTP Server dan port forwarding (NAT) ke FTP Server
Detailnya sbb :

Buka file /etc/vsftpd/vsftpd.conf, lalu tambahkan di bagian bawah:
# Aktifkan mode passive FTP
pasv_enable=YES

# Setting port range misalnya 50000 s/d 51000
pasv_max_port=51000
pasv_min_port=50000

# Aktifkan port range
port_enable=YES
Tambahkan rule baru di Firewall :
1. Pass Inbound rule to allow TCP 21 dari External to DMZ FTP Server
2.
Pass Outbound rule to allow TCP 50000-51000 dari DMZ FTP Server to External
3.
Pass Inbound rule to allow TCP 50000-51000 dari External to DMZ FTP Server
4.
Pass Inbound rule to allow TCP 21 dari Internal LAN to DMZ FTP Server
5.
Pass Outbound rule to allow TCP 50000-51000 dari DMZ FTP Server to Internal LAN
6.
Pass Inbound rule to allow TCP 50000-51000 dari Internal LAN to DMZ FTP Server
Tambahkan port forwarding (NAT) di firewall :
1. External IP publik to DMZ FTP Server pada port 21
2.
External IP publik to DMZ FTP Server pada port 50000-51000
3.
Internal IP LAN to DMZ FTP Server pada port 21
4.
Internal IP LAN to DMZ FTP Server pada port 50000-51000
Maka sekarang VSFTPD sudah dapat diakses dari Internet dg IP publik maupun dari LAN dg IP private menggunakan NAT. Contoh setting di atas adalah secara basic pada device firewall secara umum. Anda dapat merubah/menambah sesuai dg kebutuhan.

Sumber tulisan ini dari website : http://www.riyadikh.com/?p=683

Sabtu, 03 Mei 2014

Koneksi SSH melalui SOCKS Proxy

Misalkan Anda mempunyai sebuah server di internet, katakanlah Host A, yang menjalankan servis SSH server pada port standar 22. Pada kondisi normal, Anda bisa bebas melakukan koneksi SSH ke Host A, tapi suatu ketika Anda sampai pada suatu keadaan dimana koneksi SSH tidak diperbolehkan dalam suatu jaringan tertentu (katakanlah di kampus), sang admin hanya memperbolehkan koneksi melalui HTTP Proxy dan beberapa servis lain (seperti SMTP, POP3, dan IMAP). Tapi disini saya tidak akan membahas koneksi SSH melalui HTTP Proxy (sudah banyak artikel yang membahas hal ini).
Yang akan kita bahas adalah bagaimana melakukan koneksi SSH melalui SOCKS Proxy. Tapi sebelumnya apa itu SOCKS Proxy?

Dari Wikipedia:
SOCKS is an Internet protocol that facilitates the routing of network packets between client–server applications via a proxy server. SOCKS performs at Layer 5 of the OSI model—the session layer (an intermediate layer between the presentation layer and the transport layer). Port 1080 is the registered port designated for the SOCKS server.
Disitu juga diberikan contoh kasus:
Bill wishes to communicate with Jane over the internet, but a firewall exists on his network between them and Bill is not authorized to communicate through it himself. Therefore, he connects to the SOCKS proxy on his network and sends to it information about the connection he wishes to make to Jane. The SOCKS proxy opens a connection through the firewall and facilitates the communication between Bill and Jane. For more information on the technical specifics of the SOCKS protocol, see the sections below.
Yang kurang lebih maksudnya adalah kita menggunakan perantara untuk melakukan koneksi, karena koneksi langsung tidak diperbolehkan. Misal: A dan B sebagai host client dan server yang ingin melakukan koneksi, dan C adalah SOCKS proxy. Tapi koneksi dari A ke B tidak diperbolehkan, sedangkan koneksi C ke B diperbolehkan. Nah, kita bisa menumpang koneksi dari C ke B, sehingga A bisa terhubung ke B.
OK, langsung saja kita praktekkan. Pertama-tama kita melakukan koneksi dari A ke C, dalam hal ini kita akan membuat SOCKS proxy menggunakan openSSH.
$ ssh -p993 -D localhost:4321 -l user hostC
Dalam hai ini saya melakukan SSH ke Host C melalui port 993, bukan port standar 22 karena memang di blok oleh admin, port 993 sebenarnya adalah servis IMAP, yang diperbolehkan oleh admin, jadi sebelumnya pastikan SSH server di Host C berjalan di port 993 atau bisa dual port 22 dan 993. Sebenarnya ini hanya akal-akalan saya untuk mengelabui admin saja :D
Sekarang kita mempunyai SOCKS Proxy di localhost port 4321. Tapi tunggu dulu, kenapa localhost? Bukankah SOCKS Proxy adalah Host C? Ya, lagi-lagi ini adalah akal-akalan saya, Anda tentu saja bisa menggunakan koneksi langsung ke Host C, tanpa melakukan binding/tunnel SSH terlebih dahulu, tapi yang menjadi masalah disini adalah saya juga tidak bisa melakukan koneksi SOCKS dari A ke C, lihat di atas, SOCKS Proxy menggunakan port 1080, yang tentu saja di blok oleh admin.
Selanjutnya tinggal menggunakan SOCKS Proxy tersebut untuk melakukan koneksi ke Host B. Tapi, untuk melakukan koneksi SSH melalui SOCKS Proxy kita membutuhkan bantuan program lain. Dalam hal ini yang sudah saya cobakan adalah nc dan connect, alternatif lain adalah connect-proxy, corkscrew tidak bisa digunakan karena belum/tidak mendukung SOCKS Proxy, hanya HTTP(s) Proxy.
$ ssh -o “ProxyCommand /usr/bin/nc -x localhost:4321 %h %p” -l user hostB
atau jika menggunakan program connect:
$ ssh -o “ProxyCommand /usr/bin/connect -S localhost:4321 %h %p” -l user hostB
Selamat ber-SSH ria :D
.
Referensi: