Posted by admin on Thursday May 26, 2011
Filed under :Linux
An SSL certificate contains the information about issuer, valid dates, subject and other cryptic information. The openssl x509 subcommand may be used to retrieve those information from a SSL certificate.
# The “-text” option will output full breadth of certificate information.
bash# openssl x509 -text -in server.crt
# The “-issuer” option will show issuer.
bash# openssl x509 -noout -in server.crt -issuer
# The “-subject” option will show Organizational information.
bash# openssl x509 -noout -in server.crt -subject
# The “-dates” option will show valid dates
bash# openssl x509 -noout -in server.crt -dates
# “-hash” and “-fingerprints” may also be used conjunction with other options.
bash# openssl x509 -noout -in server.crt -hash -fingerprint -issuer
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :Linux, Networking
To disable responses to a ICMP ping request, the following two kernel parameters can be added to the /etc/sysctl.conf file.
# Disable ping response
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_echo_ignore_all = 1
To apply the changes, perform the following command.
# sysctl -p
To make it one time change, run the following command.
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :SQL
SQL*Plus is a command-line application that allows you to manage virtually every facet of the Oracle database. This article may be viewed as FAQs on SQL*Plus.
Before using SQL*Plus, there are a number of environment setting that you may want to configure. To toggle any of those settings, use the SET command shown below.
% sqlplus username
Enter Password: *****
SQL> SHOW ALL
SQL> SET {setting} ON/OFF
To turn on SQL query results to the terminal, set the following environment variable.
SQL> SET SERVEROUTPUT ON
If you expect your query to return a lot of data, use ‘SET PAUSE ON’ to scroll results one page at a time.
SQL > SET PAUSE ON
SQL > SET PAUSE “MORE…”
SQL*Plus stores last statement in a buffer, which may be edited or modified with the following commands:
– List command buffer
SQL> list
– Change old value with new to a buffered SQL statement
SQL> c/old/new
– Append text to a buffered SQL statement
SQL> a/more text …
– Execute the statement stored in a buffer
SQL> /
– To save buffered SQL statement in a file
SQL> SAVE FILE {filename}
– To execute commands from a file
SQL> START {filename}
OR
SQL> @{filename}
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :SQL
The Oracle export (exp) and import (imp) utilities are used to perform logical database backup and recovery, which allow you to write data into an operating system file and read back into the Oracle database. They are also used to move Oracle schema and data from one machine to another, or one database to another.
The exp/imp utilities use an Oracle proprietary binary file format and can thus only be used between Oracle databases. One cannot export data and expect to import it into a non-Oracle database.
Different versions of the import utility is upwards compatible. This means that one can take an export file created from an old export version, and import it using a later version of the import utility. Oracle also ships some previous catexpX.sql (X=Oracle Version) scripts that can be executed as user SYS enabling older imp/exp versions to work (for backwards compatibility). For example, one can run $ORACLE_HOME/rdbms/admin/catexp7.sql on an Oracle 8 database to allow the Oracle 7.3 exp/imp utilities to run against an Oracle 8 database.
EXPORT
Exporting an ORACLE database object is controlled by command-line parameters. To get familiar with EXPORT parameters, type the following in the SQL*Plus prompt:
exp help=y
Oracle EXPORT utility may be used in three ways:
- Interactive Mode: Simply type exp in command-line and answere the questions.
- With command-line parameters: exp <userid /password> <parameter>=<value>,<parameter>=<value>,…
- With parameters passed from a file: exp <userid /password> parfile=<filename>
IMPORT
Like EXPORT, the IMPORT utility is controlled by parameters. To get help with these parameters type: imp help=y
Using IMPORT utility is similar to using EXPORT utility as described above.
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :Linux, Perl
Documentation http://spamassassin.apache.org/
1. Install spamassassin on the server
# yum install spamassassin
2. Install required perl CPAN modules
# perl -MCPAN -e shell
cpan> install Digest::SHA1
cpan> install HTML::Parser
cpan> Install option perl modules…
2. Edit spamassassin configuration in /etc/mail/spamassassin/local.cf .
# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)
report_safe 0
# Enable the Bayes system
use_bayes 1
# Enable Bayes auto-learning
bayes_auto_learn 1
# Enable or disable network checks
skip_rbl_checks 0
use_razor2 1
use_dcc 1
use_pyzor 1
# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_languages all
# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales all
3. Tell procmail to run spamc on everyone’s mail. Add these to /etc/procmailrc :
DROPPRIVS=yes
:0fw
| /usr/bin/spamc
4. Restart spamassassin
# service restart spamassassin
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :Linux
When starting httpd service, the following error message appears and the service failed to start.
# service httpd start
Starting httpd: (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
Unable to open logs
The error message means that when httpd tried to start, some other process was already listening on 443. To see what other processes are using port 443, the following two commands may be used:
# netstat -A inet -lnp
# lsof -i tcp:443
Using the commands shown above, find a process that is listening on port 443 and kill that process. And, restart the http daemon.
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :SQL
Local Variable Declaration
DECLARE @X INT
DECLARE @A INT, @B INT, @C CHAR(10)
A local variable is initially assigned a NULL value. A value can be assigned to a local variable by using the SET or SELECT statement.
DECLARE @X INT
SET @X = 1
SELECT @X = COUNT(*) FROM db.dbo.books
IF … ELSE statement
DECLARE @X INT
SET @X = 1
IF @X = 1 PRINT ‘X is 1′
ELSE PRINT ‘X is NOT 1′
use Northwind
IF db_name() = ‘Northwind’
BEGIN
PRINT ‘Using Northwind Database’
PRINT ‘Second Statement’
END
WHILE Statement
DECLARE @C INT
SET @C = 0
WHILE @C < 2
BEGIN
PRINT ‘C is ‘ + cast(@C as CHAR)
SET @C = @C + 1
END
BREAK and CONTINUE statements
The BREAK statement exits out of the inner most WHILE loop, and the CONTINUE statement skips executing the rest of the statements between the CONTINUE and the END statement of the current loop.
WHILE TRUE
BEGIN
BREAK
END
WHILE (@I <10)
BEGIN
PRINT ‘I is ‘ + @I
IF (@I >3) CONTINUE
END
GOTO Statement
WHILE TRUE
BEGIN
GOTO ONE
END
ONE:
PRINT ‘Out of the Loop’
CASE Statement
The CASE statement allows you to replace a column value with a different value based on the original value. For example, a table column named gender may contain a value 0 representing female, and 1 representing male. The CASE statement allows you to translate value 0 to ‘Female’ and 1 to ‘Male’.
SELECT Name,
CASE
when gender = 0 then ‘Female’
when gender = 1 then ‘Male’
else ‘Unknown’
END as “Gender”
from db.dbo.Customer
Create Table/ Drop Table
create table MYTABLE (id int, name varchar(10), value varchar(100))
drop table MYTABLE
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :Windows
Microsoft has an unsupported virtual CD-ROM software for FREE. To download, use the link below:
Download Microsoft Virtual CD Control Panel
Readme for Virtual CD-ROM Control Panel v2.0.1.1
THIS TOOL IS UNSUPPORT BY MICROSOFT PRODUCT SUPPORT SERVICES
System Requirements
===================
- Windows XP Home or Windows XP Professional
Installation instructions
=========================
1. Copy VCdRom.sys to your %systemroot%\system32\drivers folder.
2. Execute VCdControlTool.exe
3. Click “Driver control”
4. If the “Install Driver” button is available, click it. Navigate to the %systemroot%\system32\drivers folder, select VCdRom.sys, and click Open.
5. Click “Start”
6. Click OK
7. Click “Add Drive” to add a drive to the drive list. Ensure that the drive added is not a local drive. If it is, continue to click “Add Drive” until an unused drive letter is available.
8. Select an unused drive letter from the drive list and click “Mount”.
9. Navigate to the image file, select it, and click “OK”. UNC naming conventions should not be used, however mapped network drives should be OK.
You may now use the drive letter as if it were a local CD-ROM device. When you are finished you may unmount, stop, and remove the driver from memory using the driver control.
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :Apache, Linux
Mass virtual hosting using mod_vhost_alias or mod_rewrite module simplifies pattern-based virtual hosting. However, there is a major problem if your virtual host application makes use of the DOCUMENT_ROOT environment variable. According to the Apache documentation, the mod_vhost_alias does NOT correctly sets the DOCUMENT_ROOT variable and hence pontentially break PHP web applications that makes use of this environment variable. It seems that one logical thing to do is to use the VirtualDocumentRoot to map DOCUMENT_ROOT variable, but current mod_vhost_alias does NOT implement this function and it is very unlikely that it will any time soon.
To best way to solve this problem is to applying a patch for mod_vhost_alias.c, which is written by a person with an email address (cbs[at]cts.ucla.edu) that dynamically sets DOCUMENT_ROOT environment variable. The behavior is controlled by setting SetVirtualDocumentRoot to “on” or “yes”. The original patch can be found apache bugzilla. To apply the patch, you’ll have to rebuild the version of apache you’re running. There is no easy way to rebuild mod_vhost_alias module only.
1. To rebuild apache, you’ll need a source RPM for your platform. We’re running Fedora Core 1, so we’ve downloaded the version from Fedora Legacy. RPM Find provides binary and source RPMs for various platforms.
2. Install source RPM by running, rpm -i httpd-2.0.x.y.z.tar.gz. Where x.y.z is the version of Apache you are installing. The source RPM will be installed in the rpm source directory. For redhat (and Fedora), the location of source rpm is /usr/src/redhat.
3. The next step is to modify the mod_vhost_alias.c as specified in the patch above, and rebuild the binaries. To get the mod_vhost_alias.c file, you’ll need to untar httpd-2.0.x.y.z.tar file locaated in the /usr/src/redhat/SOURCE directory. Extract the tar archive in the temporary directory, and edit the mod_vhost_alias.c file located in the ./httpd-2.0.x/modules/mappers directory.
4. After modifying the mod_vhost_alias.c file, tar up the file and place it in the /usr/src/redhat/SOURCE folder. The new file replaces the old httpd-2.0.x.y.z.tar file.
5. Now, we need to rebuild a binary rpm. However, there are several development rpms that are needed to successfully compile the httpd RPM. There are a few dependencies that you’ll have to resolve by installing a dozen or so rpms. You may retrieve those necessary rpms from the same place where you downloaded source rpm (step 1).
# cd /usr/src/redhat/SPECS
# rpmbuild -bb httpd.spec
6. Upon successfully rebuilding the Apache, extract the mod_vhost_alias.so file from the binary RPM. We only need to replace the mod_vhost_alias.so located in the /usr/lib/httpd/modules directory, and there is no reason to reinstall binary RPM. To extract a file from the RPM, use the rpm2cpio command below.
# cd /tmp
# rpm2cpio /usr/src/redhat/RPMS/i386/httpd-2.0.x.y.z.legacy.i386.rpm | cpio -d -i
# mv /tmp/usr/lib/httpd/modules/mod_vhost_alias.so /usr/lib/httpd/modules
You may wish to make a back of the mod_vhost_alias.so file before overwriting the original. You’ll need to add SetVirtualDocumentRoot on in the httpd.conf file, and restart the apache.
Did you like this? Share it:
Posted by admin on Thursday May 26, 2011
Filed under :Windows
By default, Microsoft Exchange Server 2003 Out-of-Office replies to the Internet is disabled. This is done to disallow Out-of-Office auto-replies to be sent outside of the organization to prevent outsider to learn when users are out of the office.
To enable Out-Of-Office replies to the Internet:
1. On the Exchange Server machine, go to Start – Programs – Microsoft Exchange – Systems Manager.
2. Double click Global Settings, and then click Internet Message Formats.
3. In the Details pane, right-click a domain name, and then click Properties. The default SMTP domain is “*”.
4. In the Properties box, click the Advanced tab, and then click to select the Out of office responses check box. This enables Out-of-Office responses to the Internet for the selected domain.
Did you like this? Share it: