Showing posts with label tukang nggame linux. Show all posts
Showing posts with label tukang nggame linux. Show all posts

Wednesday, August 5, 2009

Tukang nggame tips. Many ways to perform backups automatically mysql databasee, and can even in the automatic transfer it to the other srver also, here is one of them. This is very simple and just for dummy. :d
SERVER I.
Buat file dump.sh
#!/bin/bash

TheDATE=`date +%Y-%m-%d_`
W=`date +%A`
jamscript=`date +%Hh%Mm`
myfiles="mywebdb_"$TheDATE"_"$jamscript"_"$W".sql"

cd /var/www/bekap

/usr/bin/mysqldump -u myuser --all --password=mypassword mywebdb > $myfiles

if [ -e $myfiles ]; then
gzip -c $myfiles > $myfiles".gz"
fi

if [ -e $myfiles ]; then
rm -f $myfiles
fi

exit 0


Run the script at 06:00 and 18:00.
#chmod 755 dump.sh
#crontab -e
00 6 * * * /home/arisnb/dump.sh
00 18 * * * /home/arisnb/dump.sh


Create a username and password for your web. Example username is arisnb and password mypassword.

#htpasswd -c /var/www/bekap/.htpasswd arisnb


Create a file /var/www/bekap/.htaccess

AuthName "Please Login !!!"
AuthUserFile /var/www/bekap/.htpasswd
Require valid-user


ads : Please support me at Stop Dreaming Start Action :d

SERVER II (BACKUP)
Create a script for download, example download.sh

#!/bin/bash

TheDATE=`date +%Y-%m-%d_`
W=`date +%A`
jamscript="`date +%Hh%Mm`"
myfiles="mywebdb_"$TheDATE"_06h00m_"$W".sql.gz"
myfiles2="mywebdb_"$TheDATE"_18h00m_"$W".sql.gz"

cd /home/arisnb/bekap

if [ "$jamscript" = "06h30m" ]; then
wget -c --http-user=arisnb --http-passwd=mypassword https://10.10.10.1/bekap/$myfiles --no-check-certificate
fi

if [ "$jamscript" = "18h30m" ]; then
wget -c --http-user=arisnb --http-passwd=mypassword https://10.10.10.1/bekap/$myfiles2 -no-check-certificate
fi

exit 0


Run the script at 06:30 and 18:30.
#chmod 755 download.sh
#crontab -e
00 6 * * * /home/arisnb/download.sh
00 18 * * * /home/arisnb/download.sh


Check the backups files at /home/arisnb/bekap directory.

ads: Don't forget support me at Stop Dreaming Start Action

Thursday, June 4, 2009

tukang nggame tips~The Address Resolution Protocol (ARP) is the method for finding a host's link layer (hardware) address. ARP is primarily used to translate IP addresses to Ethernet MAC addresses. Media Access Control address (MAC address) is a unique identifier assigned to most network adapters. This is example Ethernet  HWaddr/Mac Address 00:1c:11:19:c1:11

With GNU/Linux we can use a command line to manipulate the system ARP cache. The command is arp. Arp manipulates or displays the kernel's IPv4 network neighbour cache. It can add entries to the table, delete one or display the current content. ARP stands for Address Resolution Protocol, which is used to find the media access control address  of  a  network neighbour for a given IPv4 Address.

Howto use it ?
From manual page Linux we get a synopsis to use it :

SYNOPSIS
       arp [-vn] [-H type] [-i if] [-a] [hostname]

       arp [-v] [-i if] -d hostname [pub]

       arp [-v] [-H type] [-i if] -s hostname hw_addr [temp]

       arp [-v] [-H type] [-i if] -s hostname hw_addr [netmask nm] pub

       arp [-v] [-H type] [-i if] -Ds hostname ifname [netmask nm] pub

       arp [-vnD] [-H type] [-i if] -f [filename]

With that command we can define the client mac address with fix ip address and acquaint it to router.

CLIENT/COMPUTER 1,2..n (c1,c2,..cn) -------------ROUTER

c1 mac address 00:1c:11:19:c1:11 IP address  192.168.1.1
c1 mac address 00:1c:11:19:b1:12 IP address  192.168.1.2

with that arp Linux command


#/usr/sbin/arp -s 192.168.1.1     00:1c:11:19:c1:11
#/usr/sbin/arp -s 192.168.1.1     00:1c:11:19:b1:12

or we create a bash file, example arp.sh. That content


#!/bin/bash
#tukang nggame computer
/usr/sbin/arp -s 192.168.1.1     00:1c:11:19:c1:11
#John computer
/usr/sbin/arp -s 192.168.1.1     00:1c:11:19:b1:12

Then, change permision for execution.


#chmod  755 arp.sh

The running that file


#./arp.sh

What advantage that methode ?
Now, router have database mac address and IP Address every computer. So a network administrator manage the router more easy. Because client can't change their Mac address offhand, if they was changed mac address or IP address that same with router database, so their computer can connect to router. It useful if you combine apply with squid/proxy server.

tukang nggame Ref:

http://en.wikipedia.org/wiki/MAC_address

http://en.wikipedia.org/wiki/Address_Resolution_Protocol

Share this post :

Prev article :Tell Sory contest clip by tukang nggame

Wednesday, May 20, 2009

Tukang nggamer write this tips/tutorial for SEO Contest with keyword tukang nggame. I hope tukangnggame to be a winner as tukang nggamer for nggame.

tukang nggame Linux -If your Linux router run ssh service or the other service. And You will yoursef to access it. You can secure your GNU/Linux Debian router from everyone. How do it ? Simple.
Stop root user to remote your Linux router.
Edit /etc/ssh/sshd_config

PermitRootLogin no

Restart ssh services


#/etc/init.d/ssh restart
Restarting OpenBSD Secure Shell server: sshd.

And install denyhosts aplication

apt-get install denyhosts

Then edit /etc/denyhosts.conf

# DENY_THRESHOLD_INVALID: block each host after the number of failed login.
# attempts has exceeded this value. This value applies to invalid
# user login attempts (eg. non-existent user accounts)
#
DENY_THRESHOLD_INVALID = 5
#
##########################################################
# DENY_THRESHOLD_VALID: block each host after the number of failed.
# login attempts has exceeded this value. This value applies to valid
# user login attempts (eg. user accounts that exist in /etc/passwd) except
# for the "root" user
#
DENY_THRESHOLD_VALID = 10
#
##########################################################
#
# DENY_THRESHOLD_ROOT: block each host after the number of failed.
# login attempts has exceeded this value. This value applies to.
# "root" user login attempts only.
#
DENY_THRESHOLD_ROOT = 1
#
##########################################################
#
# DENY_THRESHOLD_RESTRICTED: block each host after the number of failed.
# login attempts has exceeded this value. This value applies to.
# usernames that appear in the WORK_DIR/restricted-usernames file only.
#
DENY_THRESHOLD_RESTRICTED = 1

# To block all services for the offending host:
#BLOCK_SERVICE = ALL
# To block only sshd:
BLOCK_SERVICE = sshd

#Email will report if there someone failed login
ADMIN_EMAIL = aris@nggames.com
SMTP_HOST = mail.nggames.com
SMTP_PORT = 25

SMTP_FROM = DenyHosts denyhosts-report@nggames.com
# SMTP_SUBJECT: you can specify the "Subject:" of messages sent
# by DenyHosts when it reports thwarted abuse attempts
SMTP_SUBJECT = DenyHosts Report

You can edit the other as you like. Then restart denyhosts services

# /etc/init.d/denyhosts restart
Restarting DenyHosts (warning).
Stopping DenyHosts: denyhosts.
Starting DenyHosts: denyhosts.

If the are user failed login as rule (DENY_THRESHOLD_INVALID), IP Address that user automate added in /etc/hosts.deny

example screenshoot:

sshd: 222.215.119.33
sshd: 203.158.221.21

But if we choice BLOCK_SERVICE = ALL


all: 222.215.119.33
all: 203.158.221.21

If your special IP (exp : 10.11.1.1 ) will not block at every time, add in /etc/hosts.allow


sshd:10.11.1.1

Bingo! Tukang Nggame congrate to you.

Share this post :

Prev article : The Winner by tukang nggame

Sunday, May 6, 2007

This just tips read ssh failed log with linux ala Tukang Nggame. With this comand we would know who failed login in our server/router. Simple.

Router:/# /bin/cat /var/log/auth.log |grep sshd:auth |grep failure |awk '{print $1"-" $2 "-" $3 "-->" $12 "->" $14 "->" $15}'

Follow result it

May-4-11:27:59-->tty=ssh->rhost=10.7.1.67->
May-5-14:53:02-->tty=ssh->rhost=10.7.1.199->
May-6-14:42:17-->tty=ssh->rhost=10.7.1.7->user=admin

You can save in .txt file, and can access with your web.

Router:/# /bin/cat /var/log/auth.log |grep sshd:auth |grep failure |awk '{print $1"-" $2 "-" $3 "-->" $12 "->" $14 "->" $15}' > /var/www/login-failed.txt

/var/www/ is your document root (web server). Than you can access url http://your-domain.com/login-failed.txt

Share this post :