Tuesday, July 13, 2010

How to disable wget

SkyHi @ Tuesday, July 13, 2010
wget is one of the largest threats for your server security. A single abuser that gains access to wget can download and run any script that he wants, totally compromising your server.



It is highly recommended that you allow only root to use wget and you restrict all other users from it.



1. Login to your server as root

2. Run the fallowing command



chmod 0700 /usr/bin/wget



Please note that disabling wget might cause some scripts to stop working. A known problem is that Fantastico will stop updating after this. The solution is pretty easy…

Before you disable wget make sure that you do a copy of it with the initial permissions. You can use any name that you want, the following is just an example:



cp /usr/bin/wget /usr/bin/wget_secret





In the Fantastico configuration input the location to wget as:



/usr/bin/wget_secret



If for some reason you you want to revert the change you simply have to do:



chmod 0711 /usr/bin/wget

=================================================================

I make it a habbit on my systems to chmod 700 some of the keyfiles
like wget, netstat. Also a good idea to set your /tmp to noexec.



dropby23




there are alot of ways to get a file in the server i am ussualy using
this one

chmod 750 /usr/bin/rcp

chmod 750 /usr/bin/wget

chmod 750 /usr/bin/lynx

chmod 750 /usr/bin/links

chmod 750 /usr/bin/scp

chmod 750 /usr/bin/nc

chmod 750 /usr/bin/elinks

chmod 750 /usr/bin/curl

rm -rf /etc/httpd/proxy/

chmod 000 /var/mail/vbox

rm -rf /usr/local/apache/proxy

chmod 700 /usr/bin/lwp-*

chmod 750 /usr/bin/GET

chmod 750 /usr/bin/curl



HostGeekZ




Install LES, which will chmod/chattr most of these binarys for you.

REFERENCES
http://www.cyberls.com/forum/showthread.php?tid=440
http://forums.theplanet.com/lofiversion/index.php/t81289.html


Outlook 2003 freezing

SkyHi @ Tuesday, July 13, 2010
click on start => run => type outlook /safe and press Ok.

check outlook in this mode.

click on tools => options => other => advanced options => click on com addins and list the addins you have

REFERENCES
http://www.techsupportforum.com/microsoft-support/microsoft-office-support/287117-outlook-2003-freezing.html

Saturday, July 10, 2010

installing postfix and dovecot maildir

SkyHi @ Saturday, July 10, 2010
:: what is
- postfix ??
- dovecot ??

:: installing postfix and dovecot on opensuse
[ linux: ~ ]# zypper in postfix dovecot

:: configuration postfix email
[ linux: ~ ]# vi /etc/postfix/main.cf
#
# configuration some like this:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550


debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = maildrop
html_directory = /usr/share/doc/packages/postfix/html
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/packages/postfix/samples
readme_directory = /usr/share/doc/packages/postfix/README_FILE
inet_protocols = all
biff = no


myhostname = mail.blackonsole.org
mydomain = blackonsole.org
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks_style = host
home_mailbox = Maildir/
virtual_mailbox_domains = hash:/etc/postfix/virtual
virtual_mailbox_maps = hash:/etc/postfix/virtual
alias_maps = hash:/etc/aliases


smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_use_tls = yes
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_tls_key_file = /etc/ssl/smtpd.pem
smtpd_tls_cert_file = /etc/ssl/smtpd.pem
smtpd_tls_CAfile = /etc/ssl/smtpd.pem
tls_random_source = dev:/dev/urandom
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination,permit

:: make cert
[ linux: postfix ]# cd /etc/ssl/
[ linux: ssl ]# openssl req -new -x509 -nodes -out smtpd.pem -keyout smtpd.pem -days 3650

:: configure dovecot
[ linux: ~ ]# vi /etc/dovecot/dovecot.conf
#
# change on this configuration:

protocols = imap imaps pop3
disable_plaintext_auth = no
ssl = no
auth_debug = yes
auth default {
mechanisms = plain login
passdb pam {
}
passdb shadow {
}
userdb passwd {
}

socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}

:: starting postfix and dovecot
[ linux: ~ ]# /etc/init.d/postfix start
[ linux: ~ ]# /etc/init.d/dovecot start

:: links
+ googlelinux
+ wowtutorial
http://www.blackonsole.org/2010/06/install-postfix-dovecot.html

Linux: Subnet (CIDR) Calculator Netmask

SkyHi @ Saturday, July 10, 2010

I'm new to networking and need help with network settings. I'm looking for a tool for calculating available host address ranges with CIDR using Linux command prompt. How do I use subnet calculator under Linux or UNIX?

Linux comes with various IP subnet calculator that will help you with network settings. Once such program is Sipcalc which is an ip subnet calculator. You can install it as follows under Debian or Ubuntu Linux:
$ sudo apt-get update
$ sudo apt-get install sipcalc

Sample outputs:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
sipcalc
0 upgraded, 1 newly installed, 0 to remove and 51 not upgraded.
Need to get 30.6kB of archives.
After this operation, 123kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ lucid/universe sipcalc 1.1.4-2 [30.6kB]
Fetched 30.6kB in 2s (15.1kB/s)
Selecting previously deselected package sipcalc.
(Reading database ... 203411 files and directories currently installed.)
Unpacking sipcalc (from .../sipcalc_1.1.4-2_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for doc-base ...
Processing 1 added doc-base file(s)...
Registering documents with scrollkeeper...
Setting up sipcalc (1.1.4-2) ...

How Do I Calculate Subnets?

$ sipcalc 192.168.1.0/24
Sample outputs:

-[ipv4 : 192.168.1.0/24] - 0

[CIDR]
Host address - 192.168.1.0
Host address (decimal) - 3232235776
Host address (hex) - C0A80100
Network address - 192.168.1.0
Network mask - 255.255.255.0
Network mask (bits) - 24
Network mask (hex) - FFFFFF00
Broadcast address - 192.168.1.255
Cisco wildcard - 0.0.0.255
Addresses in network - 256
Network range - 192.168.1.0 - 192.168.1.255
Usable range - 192.168.1.1 - 192.168.1.254

The above will provide network start & stop range, wildcard, mask and other information. You can calculate 192.168.1.0/24 subnet as follows
$ sipcalc 192.168.1.5/24

Interface Specific Calculation

Instead of taking address information from the shell command line arg sipcalc can obtain relevant information by looking at a specified interface on the system. In this example, get information for eth0 interface:
$ sipcalc eth0
Sample outputs:

-[int-ipv4 : eth0] - 0

[CIDR]
Host address - 192.168.3.254
Host address (decimal) - 3232236542
Host address (hex) - C0A803FE
Network address - 192.168.3.0
Network mask - 255.255.255.0
Network mask (bits) - 24
Network mask (hex) - FFFFFF00
Broadcast address - 192.168.3.255
Cisco wildcard - 0.0.0.255
Addresses in network - 256
Network range - 192.168.3.0 - 192.168.3.255
Usable range - 192.168.3.1 - 192.168.3.254

whatmask Program

Whatmask is a small C program that will help you with network settings. Download and compile it as follows:
$ cd /tmp
$ wget http://downloads.laffeycomputer.com/current_builds/whatmask/whatmask-1.2.tar.gz
$ tar -zxvf whatmask-1.2.tar.gz
$ cd whatmask-1.2/
$ ./configure
$ make
$ sudo make install

You can use it as follows to find out usable ip address with /29:
$ whatmask /29
Sample outputs:

---------------------------------------------
TCP/IP SUBNET MASK EQUIVALENTS
---------------------------------------------
CIDR = .....................: /29
Netmask = ..................: 255.255.255.248
Netmask (hex) = ............: 0xfffffff8
Wildcard Bits = ............: 0.0.0.7
Usable IP Addresses = ......: 6

OR
$ whatmask 202.54.1.2/27
Sample outputs:

------------------------------------------------
TCP/IP NETWORK INFORMATION
------------------------------------------------
IP Entered = ..................: 202.54.1.2
CIDR = ........................: /27
Netmask = .....................: 255.255.255.224
Netmask (hex) = ...............: 0xffffffe0
Wildcard Bits = ...............: 0.0.0.31
------------------------------------------------
Network Address = .............: 202.54.1.0
Broadcast Address = ...........: 202.54.1.31
Usable IP Addresses = .........: 30
First Usable IP Address = .....: 202.54.1.1

Last Usable IP Address = ......: 202.54.1.30

Download software featured in this faq:




REFERENCES
http://www.laffeycomputer.com/whatmask.html
http://www.cyberciti.biz/faq/linux-subnet-calculator-cidr/
http://www.blackonsole.org/2010/07/ip-subnet-calc-with-whatmask.html


Friday, July 9, 2010

SolutionBase: Strengthen network defenses by using a DMZ

SkyHi @ Friday, July 09, 2010
Takeaway: Nations seperate armies through the use of a DMZ, or demilitarized zone. You can seperate your network and users from the threats faced on the Internet by deploying a DMZ as well. Here's what you need to know about how a DMZ works.

The concept of the DMZ, like many other network security
concepts, was borrowed from military terminology. Geopolitically, a
demilitarized zone (DMZ) is an area that runs between two territories that are
hostile to one another or two opposing forces' battle lines. The term was first
widely used to refer to the strip of land that cuts across the Korean peninsula
and separates the North from the South. In computer networking, the DMZ
likewise provides a buffer zone that separates an internal network from the often
hostile territory of the Internet. Sometimes it's called a "screened
subnet" or a "perimeter network," but the purpose remains the
same.





In this article, we'll look at how the DMZ works and
different security architectures for building DMZs. In the second article of
this two-part article, we'll talk about what computers should (and shouldn't)
be placed in the DMZ and how to monitor DMZ activity.





How the DMZ Works



Unlike the geopolitical DMZ, a DMZ network is not a no-man's
land that belongs to nobody. When you create a DMZ for your organization, it
belongs to you and is under your control. However, it is an isolated network
that's separate from your corporate LAN (the "internal" network). The
DMZ uses IP addresses belonging to a different network ID.





If you think of the internal network as the "trusted"
network and the external public network (the Internet) as the "untrusted"
network, you can think of the DMZ as a "semi-trusted" area. It's not
as secured as the LAN, but because it is behind a firewall, neither is it as
non-secure as the Internet. You can also think of the DMZ as a "liaison
network" that can communicate with both the Internet and the LAN while
sitting between the two, as illustrated by Figure A.









Figure A

The DMZ sits between the "hostile" Internet and the internal
corporate network


What does this accomplish? You can place computers that need
to communicate directly with the Internet (public servers) in the DMZ instead
of on your internal network. They will be protected by the outer firewall,
although they are still at risk simply because they have direct contact with
Internet computers. Because the DMZ is only "semi-secure," it's
easier to hack a computer in the DMZ than on the internal network. The good
news is that if a DMZ computer does get hacked, it doesn't compromise the
security of the internal network, because it's on a completely separate,
isolated network.





Why put any computers in this riskier network? Let's take an
example: in order to do its job (make your Web site available to members of the
public), your Web server has to be accessible to the Internet. But having a
server on your network that's accessible from the Internet puts the entire
network at risk. There are three ways to reduce that risk:






  • You could pay
    a hosting company to host your Web sites on their machines and network.
    However, this gives you less control over your Web servers.

  • You could host the public servers on the
    firewall computer. However, best security practices say the firewall computer
    should be dedicated solely to act as a firewall (this reduces the chances of
    the firewall being compromised), and practically speaking, this would impair
    the firewall's performance. Besides, if you have a firewall appliance running a
    proprietary OS, you won't be able to install other services on it.

  • The third solution is to put the public Web
    servers on a separate, isolated network: the DMZ.








Creating a DMZ Infrastructure



The DMZ is created by two basic components: IP addresses and
firewalls. Remember that two important characteristics of the DMZ are:






  1. It has a different network ID from the internal
    network

  2. It is separated from both the Internet and the
    internal network by a firewall






IP Addressing Scheme



A DMZ can use either public or private IP addresses,
depending on its architecture and firewall configuration. If you use public
addresses, you'll usually need to subnet the IP address block that you have
assigned to you by your ISP, so that you have two separate network IDs. One of
the network IDs will be used for the external interface of your firewall and
the other will be used for the DMZ network.





When you subnet your IP address block, you must configure
your router to know how to get to the DMZ subnet.





You can create a DMZ within the same network ID that you use
for your internal network, by using Virtual
LAN (VLAN) tagging.
This is a method of partitioning traffic that shares a
common switch, by creating virtual local area networks as described in IEEE
standard 802.1q. This specification creates a standard way of tagging Ethernet
frames with information about VLAN membership.





If you use private IP addresses for the DMZ, you'll need a
Network Address Translation (NAT) device to translate the private addresses to
a public address at the Internet edge. Some firewalls provide address
translation.





Whether to choose a NAT relationship or a routed
relationship between the Internet and the DMZ depends on the applications you
need to support, as some applications don't work well with NAT.





DMZ Firewalls



When we say that a firewall must separate the DMZ from both
the internal LAN and the Internet, that doesn't necessarily mean you have to
buy two firewalls. If you have a "three legged firewall" (one with at
least three network interfaces), the same firewall can serve both functions. On
the other hand, there are reasons you might want to use two separate firewalls
(a front end and a back end firewall) to create the DMZ.





Figure A above illustrates a DMZ that uses two firewalls,
called a back to back DMZ. An
advantage of this configuration is that you can put a fast packet filtering
firewall/router at the front end (the Internet edge) to increase performance of
your public servers, and place a slower application layer filtering (ALF)
firewall at the back end (next to the corporate LAN) to provide more protection
to the internal network without negatively impacting performance for your
public servers. Each firewall in this configuration has two interfaces. The
front end firewall has an external interface to the Internet and an internal
interface to the DMZ, whereas the backend firewall has an external interface to
the DMZ and an internal interface to the corporate LAN.





When you use a single firewall to create a DMZ, it's called
a trihomed DMZ. That's because the
firewall computer or appliance has interfaces to three separate networks:






  1. The internal interface to the trusted network
    (the internal LAN)

  2. The external interface to the untrusted network
    (the public Internet)

  3. The interface to the semi-trusted network (the
    DMZ)




The trihomed DMZ looks like Figure B.









Figure B

A trihomed DMZ uses a "three legged" firewall to create separate
networks


Even if you use a single trihomed firewall to protect both
the DMZ and the internal network, you should be able to configure separate
rules for evaluating traffic depending on its origin and destination. That is,
there should be separate rules for:






  • Incoming traffic from the Internet to the DMZ

  • Incoming traffic from the DMZ to the internal
    LAN
  • Incoming traffic from the Internet to the
    internal network
  • Outgoing traffic from the internal network to
    the DMZ
  • Outgoing traffic from the internal network to
    the Internet
  • Outgoing traffic from the DMZ to the Internet




The DMZ actually reduces the complexity of filtering
traffic, because you can have one rule for all the computers in the DMZ. If you
were hosting the public servers on the internal network, you would need to
configure different rules for each hosting server, and you would have to "publish"
each server to allow it to be accessed from the Internet.





You'll probably want to block traffic from the Internet to
the internal computers. You should also restrict traffic from the DMZ to the
internal network, as well as traffic from the Internet to the DMZ. Allow only
the traffic that is necessary for your users to access the resources they need.
This means using the "principle of least privilege" in that your
default is to start by denying all traffic and then allowing protocols and
opening ports on a "need to know" basis.





Vendor Support for DMZs



Major hardware and software vendors support the DMZ concept
in their products. Cisco routers have multiple LAN ports, one of which is
designated as a DMZ port, and the IOS operating system uses Port Address
Translation (PAT) to allow traffic to be routed to multiple servers with a
single IP address destination. As the name implies, it uses port numbers (such
as 80 for the Web server and 25 for the mail server) to distinguish between the
multiple servers. This allows you to have multiple public servers without
paying for multiple public IP addresses.





Many firewall appliances, such as the SonicWall, come with
three Ethernet ports: a LAN port (to connect to the internal network), a WAN
port (to connect to the Internet) and a DMZ port (to connect to the network
housing your public servers).





Microsoft's ISA Server 2004's multi-networking feature
allows you to connect the ISA Server firewall to as many networks as you wish,
limited only by the number of network interface cards you can install in the
machine. No network is automatically "trusted" in the new ISA model,
so you configure security according to the needs of the particular network.





Common DMZ Security Architectures



A DMZ is considered by many to be a "wide open" network,
much like the geopolitical DMZ where you risk being shot anytime you set foot
inside it. However, all DMZs are not created equal when it comes to the
security architecture. Even when you place computers in the DMZ, there are
still ways to protect them. The level of security within the DMZ also depends
on the nature of the servers that are placed there. We can divide DMZs into two
security categories:





  1. DMZs designed for unauthenticated or anonymous
    access
  2. DMZs designed for authenticated access




If you have a Web server that you want everybody on the
Internet to be able to access, (such as a Web presence advertising your
company), you'll have to allow anonymous access. You can't easily provide
authentication credentials to every stranger who happens upon your site.
However, if your Internet-facing servers on the DMZ are used by partners,
customers, or employees working off-site, you can require authentication to
access them. This makes it more difficult for a hacker to gain access.





The DMZ Honeynet



There is a special use for the anonymous DMZ that's being
more popular: creating a "honeynet." This is a network that consists
of one or more "honeypot" computers that are designed to lure hackers
--either so they can be caught or tracked, or to divert them from the network's
real resources. Unlike with other DMZs, you actually want this network to be compromised.





Often the computers on the honeynet are virtual machines
that are all installed on a single physical machine, and intrusion detection
systems and other monitoring systems are put in place to gather information
about the hackers' techniques, tactics and identities.





Host Security on the DMZ



Because the DMZ is a less secure network than the internal
network, host security is even more important for the computers that are "out
there." The servers on your DMZ should be hardened as much as possible
(while maintaining their accessibility to those who need to access them). This
means:





  • All unnecessary services should be disabled.
  • Necessary services should be run with the lowest
    privileges possible.
  • Strong passwords or passphrases should be used.
  • Unnecessary user accounts should be deleted or
    disabled and default accounts should be disguised by renaming, changing the
    description, etc.
  • Systems should have the latest security updates
    and patches applied.
  • Security logging should be enabled (and you
    should check the logs frequently!)




The Evolution of the DMZ



The definition of "DMZ" is becoming broader, as
more uses are found for these "semi-trusted" networks. Today's
networks are complex, and security specialists are beginning to realize that
the concept of the network "edge" or "perimeter" is
outdated; an enterprise network has multiple perimeters. Thus, DMZs may be
appropriate at places other than at the edge of the Internet, and large
networks can benefit from having multiple DMZs.


REFERENCES
http://articles.techrepublic.com.com/5100-22_11-5756029.html

Thursday, July 8, 2010

Why do I get the message "(killed lost mailbox lock)" user=... host=...?

SkyHi @ Thursday, July 08, 2010


Solution
The traditional UNIX mailbox format or MMDF format is only allows one session to have the mailbox open read/write at a time. So, the email server assumes that if a second session attempts to open the mailbox, that means that the first session is probably owned by an abandoned client. The common scenario here is a user who leaves his client running at the office, and then tries to read his mail from home. Through an internal mechanism called kiss of death, the second session requests the first session to kill itself. When the first session receives the "kiss of death", it issues the "Killed (lost mailbox lock)" syslog message and terminates. The second session then seizes read/write access, and becomes the new "first" session.



Certain poorly-designed clients routinely open multiple sessions to the same mailbox; the users of those clients tend to get this message a lot.



Another cause of this message is a background "check for new mail" task which does its work by opening a POP session to server every few seconds. They do this because POP doesn't have a way to announce new mail.

REFERENCE
http://www.alphaone-tech.com/tech-support/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=67

Linux command: What is my IP? (Public IP address)

SkyHi @ Thursday, July 08, 2010
Lots of times you need to determine your public IP address, if you are using Linux operating system to power your PC, you may use some good console commands to guess your public IP address.

Using wget

wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$/

Using curl

curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

curl -s http://whatismyip.org/

Using Lynx

lynx -dump checkip.dyndns.org

lynx -dump www.whatismyip.com | grep 'Your IP'

As you can see, there are a lot of ways to check your Public IP address using console commands in Linux.

Of course you can always open a browser and enter any of those URIs and check there.


REFERENCES
http://www.go2linux.org/what-is-my-public-ip-address-with-linux