Tuesday, November 23, 2010

How to install Linux / UNIX *.tar.gz tarball files

Q. I’m new to Linux. Over few days I found lots software distributed as .tar.gz file. How do I install tar.gz files under Linux?

A. tar.gz also known as tarball, an archive format for electronic data and software. Most Linux tarball contains a source code for software. If you are new to Linux I recommend using apt-get, rpm and yum command to install all binary packages.

Tarballs are a group of files in one file. Tarball files have the extension .tar.gz, .tgz or .tar.bz2. Most open source software use tarballs to distribute programs/source codes.

dpkg -l | grep gcc -->> kiem tra gcc install trên server
apt-get install gcc --> install gcc

# 1: Uncompress tarball

To uncompress them, execute the following command(s) depending on the extension:
$ tar zxf file.tar.gz
$ tar zxf file.tgz
$ tar jxf file.tar.bz2
$ tar jxf file.tbz2

Now change directory
$ ls
$ cd path-to-software/

# 2: Build and install software

Generally you need to type 3 commands as follows for building and compiling software:
# ./configure
# make
# make install

Where,

  • ./configure will configure the software to ensure your system has the necessary functionality and libraries to successfully compile the package
  • make will compile all the source files into executable binaries.
  • Finally, make install will install the binaries and any supporting files into the appropriate locations.

# 3: Read INSTALL / README file

Each tarball comes with installation and build instructions. Open INSTALL or README file for more information:
$ vi INSTALL

Saturday, November 20, 2010

Backup on Ubuntu (Samba or Windows Share)

Intro
These notes are my reminder notes on how to use rsync for backup with Samba or Windows shares on your LAN.

Installing Backup Tools
The following tools are needed:
  • Samba file system (smbfs)
  • Grapical interface for rsync (grsync)
Install the tools with:
sudo apt-get install smbfs grsync

"Map" remote share
Create folder for mounting remote share:
mkdir /home/username/smb
mkdir /home/username/smb/backup


Backup process
Step1: Mount remote share:
smbmount //samba_server_name/samba_share /home/username/smb/backup -o username=samba_username,password=samba_password

Step2: Synchronize folders
run Grsync, by click on Applications->Internet->Grsync


This happened to be working great for me. If you want to backup the whole home folder be careful to mount your samba share somewhere else (not as subfolder within home). Grsync is nice front GUI for rsync.
I am using this setup to perform daily backups of my Documents folder to the remote Samba share. Grsync can be used with a local hard drive or USB key without need to mount remote samba share.

Friday, November 19, 2010

Kiểm tra cấu hình phần cứng

Inside the /proc directory, you’ll see two types of content — numbered directories, and system information files.

/proc is not a real file system, it is a virtual file system. For example, if you do ls -l /proc/stat, you’ll notice that it has a size of 0 bytes, but if you do “cat /proc/stat”, you’ll see some content inside the file.

Several Linux commands access the information from /proc, and displays in a certain format.

1. /proc Directories with names as numbers

Do a ls -l /proc, and you’ll see lot of directories with just numbers. These numbers represents the process ids, the files inside this numbered directory corresponds to the process with that particular PID.

Following are the important files located under each numbered directory (for each process):

  • cmdline – command line of the command.
  • environ – environment variables.
  • fd – Contains the file descriptors which is linked to the appropriate files.
  • limits – Contains the information about the specific limits to the process.
  • mounts – mount related information

Following are the important links under each numbered directory (for each process):

  • cwd – Link to current working directory of the process.
  • exe – Link to executable of the process.
  • root – Link to the root directory of the process.

2. /proc Files about the system information

Following are some files which are available under /proc, that contains system information such as cpuinfo, meminfo, loadavg.

  • /proc/cpuinfo – information about CPU,
  • /proc/meminfo – information about memory,
  • /proc/loadvg – load average,
  • /proc/partitions – partition related information,
  • /proc/version – linux version

Some Linux commands read the information from this /proc files and displays it. For example, free command, reads the memory information from /proc/meminfo file, formats it, and displays it.

To learn more about the individual /proc files, do “man 5 FILENAME”.

  • /proc/cmdline – Kernel command line
  • /proc/cpuinfo – Information about the processors.
  • /proc/devices – List of device drivers configured into the currently running kernel.
  • /proc/dma – Shows which DMA channels are being used at the moment.
  • /proc/fb – Frame Buffer devices.
  • /proc/filesystems – File systems supported by the kernel.
  • /proc/interrupts – Number of interrupts per IRQ on architecture.
  • /proc/iomem – This file shows the current map of the system’s memory for its various devices
  • /proc/ioports – provides a list of currently registered port regions used for input or output communication with a device
  • /proc/loadavg – Contains load average of the system
    The first three columns measure CPU utilization of the last 1, 5, and 10 minute periods.
    The fourth column shows the number of currently running processes and the total number of processes.
    The last column displays the last process ID used.
  • /proc/locks – Displays the files currently locked by the kernel
    Sample line:
    1: POSIX ADVISORY WRITE 14375 08:03:114727 0 EOF
  • /proc/meminfo – Current utilization of primary memory on the system
  • /proc/misc – This file lists miscellaneous drivers registered on the miscellaneous major device, which is number 10
  • /proc/modules – Displays a list of all modules that have been loaded by the system
  • /proc/mounts – This file provides a quick list of all mounts in use by the system
  • /proc/partitions – Very detailed information on the various partitions currently available to the system
  • /proc/pci – Full listing of every PCI device on your system
  • /proc/stat – Keeps track of a variety of different statistics about the system since it was last restarted
  • /proc/swap – Measures swap space and its utilization
  • /proc/uptime – Contains information about uptime of the system
  • /proc/version – Version of the Linux kernel, gcc, name of the Linux flavor installed.

How to Fix Memory Leaks in Java

http://olex.openlogic.com/wazi/2009/how-to-fix-memory-leaks-in-java/

Wednesday, November 17, 2010

Top Ten Sources of IT Security Best Practices

This 'Top Ten' list is intended to promote and publicize the existence of best practice standards, frameworks and guidelines for IT security. Most of the best practices are published by international organizations and governmental entities. Although there is some overlap, the perspectives on IT security, risk and controls vary considerably.

At Continental Audit Services (www.continentalaudit.com), our team of IT auditors is constantly assessing IT risks, reviewing controls and making recommendations. The selection of best practice standards and frameworks is integral to our audit process. We have seen how best practices are implemented in the real world sometimes in contrast to the theory and concepts found in published documentation.

This 'Top Ten' list is intended to be used as a reference for IT auditors, security practitioners, risk managers, compliance professionals, IT administrators, software developers and the broad range of IT professionals. We hope to add value to the overall IT professional community.

1. Best practice source: Control Objectives for Information and related Technology (COBIT)

Description: Generally accepted best practices, processes, measures and indicators for IT governance and control.

Website: http://www.isaca.org

2. Best practice source: ISO/IEC 27001 IT Security techniques -- Information security management systems

Description: Comprehensive management system for information security focused on IT risk and controls.

Website: http://www.iso.org

3. Best practice source: Center for Internet Security (CIS) Benchmarks

Description: Best practice standards and benchmarks to control IT risks. The focus is on technical security benchmarks, configurations and metrics.

Website: http://cisecurity.org

4. Best practice source: Open Web Application Security Project (OWASP)

Description: Web and application security best practices and tools.

Website: http://www.owasp.org

5. Best practice source: US Department of Defense, Security Technical Implementation Guides (STIGs)
Description: Technical configuration standards developed and used by the US Department of Defense. Covers a wide range of technologies.

Website: http://iase.disa.mil/stigs/index.html

6. Best practice source: US National Security Agency (NSA) Guides

Description: Technical security configuration guides developed and used by the US National Security Agency covering a wide range of technologies.

Website: http://www.nsa.gov/ia/guidance/security_configuration_guides/

7. Best practice source: US Federal Financial Institutions Examination Council's (FFIEC)

Description: Series of 'booklets' covering wide range of technologies and designed for federal auditors to assess compliance with best practices.

Website: http://www.ffiec.gov

8. Best practice source: US National Institute of Standards and Technology (NIST), Computer Security Division, Special Publications (SPs)

Description: Series of publications on security guidelines designed for a wide range of technologies.

Website: http://csrc.nist.gov/publications/PubsSPs.html

9. Best practice source: Committee of Sponsoring Organizations of the Treadway Commission (COSO) Framework

Description: Internal control and risk management framework used in compliance with Sarbanes-Oxley Act of 2002.

Website: http://www.coso.org

10. Best practice source: Information Technology Infrastructure Library (ITIL)

Description: Comprehensive set of best practices for IT services management (problem, change, configuration, incident management), development and operations. Published by UK Office of Government Commerce.

Website: http://www.itil-officialsite.com

Friday, November 12, 2010

Ngăn ngừa social engineering, trojan, đánh cắp mật khẩu

- Cách an toàn nhất có lẽ là nên tạo một máy ảo (chạy vmware hoặc virtualbox) hoàn toàn chỉ dùng để thực hiện việc đăng nhập vào những trang mình cho là quan trọng. Tuyệt đối không dùng máy ảo này để duyệt web thông thường hoặc check mail. Thông tin cần thiết có thể được chuyển từ máy thật vào máy ảo một cách dễ dàng và có chọn lựa để tránh lây nhiễm viruses.

- Ngoài ra, tập thói quen sử dụng 2 trình duyệt khác nhau song song để tránh bị phishing và bị chôm sessions. Một trình duyệt (ví dụ như Firefox) dùng để duyệt những trang quen thuộc, một trình duyệt khác (ví dụ như Chrome) để cắt và dán những đường dẫn đến các trang web không quen thuộc. Bằng cách này, các phương pháp phishing sẽ được giảm thiểu tối đa (vì một trình duyệt như Chrome không hề đăng nhập ở đâu thì chẳng có gì để chôm hết).

- Tận dụng tối đa các plug-ins quan trọng trên Firefox (như noscript, noads....) để giảm thiểu khả năng bị thâm nhập xuyên qua web layer. Nếu được, nên cài hẳn một máy (hoặc máy ảo) chạy bằng hệ điều hành Linux để dùng. Máy chạy Windows chỉ để chơi game nội bộ.

- Cài chương trình antivirus và thường xuyên cập nhật "virus def", đừng lơ là chuyện này. Nếu được, nên tận dụng một firewall nào đó để gia tăng bảo vệ máy, đặc biệt firewall có đủ khả năng kiểm soát cả "inbound" và "outbound" traffic để cho phép những truy cập được ra vào ở những cổng (ví dụ như 80, 443, 110, 25) và ứng dụng nhất định nào đó mà thôi.

- Tuyệt đối không nên dùng cracked software (kể cả pdf) bởi vì đa số viruses và trojans đi theo đường này.

- Tuyệt đối không viếng những trang web lạ (và có dạng tên miền khó đọc hoặc nhại tên miền một trang nào đó phổ biến).

- Sử dụng một ứng dụng bảo mật như "filecrypt" để lưu các thông tin quan trong và nhạy cảm trong đó để tránh bị đánh cắp.

- Sử dụng một ứng dụng như "KeepPass" để lưu các mật khẩu và khi cần đăng nhập, dùng biện pháp "cut & paste" password hoặc viếng địa chỉ cần đăng nhập trực tiếp từ "keepass". Mật khẩu sẽ được nạp tự động xuyên qua bô nhớ của máy. Biện pháp này vô hiệu hóa khả năng bị keylog và bị chôm mật khẩu.

Wednesday, November 10, 2010

Site to Site VPN Checkpoint to ASA

I have been dealing with tones of Site to Site VPN troubleshooting; most of it Checkpoint to Cisco ASA
Here is some of the error message I have seen and here is what does it mean :

"Encryption failure, decrypted methods did not match rule" >There are overlapping encryption domains.

"Received notification from peer: no proposal chosen." > VPN settings do not match on both ends. It could mean there is a subnet negotiation mismatch.

"Cannot identify peer for encrypted connection." > NAT is not applied properly.

"Encryption failure: packet is dropped as there is no valid SA." > Packet is corrupted before the reach the other VPN peer.

"Encryption failure: clear text packet should be encrypted or clear text packet received within an encrypted packet." > The IP address and subnet mask are incorrect in the general tab of the firewall topology tab or the VPN is terminating to the wrong interface.

"Encryption Failure: Packet was decrypted, but policy says connection should not be decrypted." > Check the VPN domains on the topology tab of the VPN objects.