Block access via htaccess

Mar, 11 -- Categories: Linux

order allow,deny
deny from 127.0.0.1
allow from all

This will refuse all GET and POST requests made by IP address 127.0.0.1, an error message is shown instead.

To block multiple IP addresses, list them one per line.

order allow,deny
deny from 127.0.0.1
deny from 127.0.0.2
deny from 127.0.0.3
allow from all

You can also block an entire IP block/range. Here we will not specify the last octet in the .htaccess file.

deny from 127.0.0

This will refuse access for any user with an address in the 127.0.0.0 to 127.0.0.255 range.

Instead of using numeric addresses, domain names (and subdomain names) can be used to ban users.

deny from isp_name.com

It bans users with a remote hostname ending in isp_name.com. This would stop all users connected to the internet via isp_name.com from viewing your site.

Using .htaccess to block an entire range or name is likely to lock out innocent users. Use with caution.

free an ip/host from fail2ban

Mar, 7 -- Categories: Linux

Check your rules
iptables -L

iptables -D your_jail -s your_ip_address -j DROP

iptables -D fail2ban-SSH -s 192.168.1.1 -j DROP

[webmin-iptables]
enabled = true
filter = webmin-auth
action = iptables[name=webmin, port=10000, protocol=tcp]
sendmail-whois[name=WEBMIN, dest=example@example.com, sender=example@example.com]
logpath = /var/log/secure

Modify the two instances of example@example.com with the destination and sender email address. This jail will monitor attempted logins to the Webmin user interface, which runs on port 10000, and if there are to many, issue a ban on the IP address. The email address supplied in dest= will receive an email saying the ban as been issued. If you moved your install of Webmin to run on something other than port 10000, change the port= value as appropriate.

network install create/mount iso

Feb, 14 -- Categories: Linux

create iso from dvd:
dd if=/dev/dvd of=/var/www/html/centos/CENTOS5.iso

mount iso “into” an accessible directory
mount -o loop /var/www/html/centos/CENTOS5.iso /var/www/html/centos/src/

make an iso from a directory
mkisofs -o /path/to/directory.iso /path/to/directory/

AS-3 TextFieldAutoSize

Feb, 10 -- Categories: Actionscript

label_txt.autoSize = TextFieldAutoSize.NONE — The default. No resizing.

label_txt.autoSize = TextFieldAutoSize.LEFT — Will automatically resize the textfield and left-align the text.

label_txt.autoSize = TextFieldAutoSize.CENTER — Will automatically resize the textfield and center the text.

label_txt.autoSize = TextFieldAutoSize.RIGHT — Will automatically resize the textfield and right-align the text.

NOW=$(date +”%b-%d-%y-%H-%M”)

#back everything up
tar -czvf /home/user/archives/$NOW.tgz /home/user/htdocs
mysqldump –user=user –password=XXXXX –opt some_database > /home/user/archives/some_database.$NOW.sql

#get the new content
scp -r user@example.com:/home/vhosts/user/htdocs/* /home/remotefiles/htdocs
mysqldump -h remotedata.com –user=user –password=XXXXX somedatabase | mysql -h localhost –user=user –password=XXXXX some_database

yum install bind bind-utils bind-libs bind-chroot caching-nameserver system-config-bind

Open the file /var/named/chroot/etc/named.conf and add the following lines to the global options section:

forwarders { xxx.xxx.xxx.xxx; xxx.xxx.xxx.xxx; }; #IP of upstream ISP nameserver(s)
forward only; #rely completely on our upstream nameservers

if named.conf doesn’t exist and it didn’t on mine run system-config-bind it will create it.

chmod 644 named.conf

Check the syntax using the named-checkconf utility provided by the bind RPM:
named-checkconf named.conf

Modify the /etc/resolv.conf file to the following:
nameserver 127.0.0.1

If you are running a DHCP server on your router make sure your /etc/resolv.conf file does not get overwritten whenever your DHCP lease is renewed. To prevent this from happening, modify /etc/sysconfig/network-scripts/ifcfg-eth0 (replace eth0 with your network interface if different) and make sure the following settings are set:

BOOTPROTO=dhcp
PEERDNS=no
TYPE=Ethernet

Go ahead and start the nameserver as root and configure to start in runlevels 2-5:
service named start
chkconfig named on

If you are running a firewall on the nameserver system, make sure clients have access to port 53. An example iptables rule for the 192.168.15.0/24 subnet would be:

iptables -A INPUT -s 192.168.15.0/24 -p udp –dport 53 -j ACCEPT

service iptables save

#!/bin/bash
#
# iptables example configuration script
#
# Flush all current rules from iptables
#
iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of
the system
#
iptables -A INPUT -p tcp –dport 22 -j ACCEPT
#
# Set default policies for INPUT, FORWARD and OUTPUT chains
#
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
#
# Set access for localhost
#
iptables -A INPUT -i lo -j ACCEPT
#
# Accept packets belonging to established and related connections
#
iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
#
# Save settings
#
/sbin/service iptables save
#
# List rules
#
iptables -L -v

Create a file in your home folder (or wherever you want) called eclipsefix.sh – open it and add the following lines:

export GDK_NATIVE_WINDOWS=true
/opt/eclipse/eclipse

then

chmod +x ~/eclipsefix.sh

got this from

http://mou.me.uk/2009/10/31/fixing-eclipse-in-ubuntu-9-10-karmic-koala/

Actually the real question would be why would you want to do that? Well it a long story and I didn’t have many other options but here’s how I did it.

First a shell script that looks something like this:

#!/bin/bash

filename="needed.xml"
pathto="userdirectory/datadirectory/"
hostname="123.123.123.123"
username="username"
password="password"

cd /directory/where/the/file/goes/
ftp -n $hostname < quote USER $username
quote PASS $password

binary
cd $pathto
get $filename
quit
EOF

cool... then a cron job that calls that code every 10 minutes:

*/10 * * * * /home/user/diectory/mygetfile.sh