Apache ssl self-signed.

Create Certificate============
#mkdir sslwork#cd sslwork

First we need to generate your own key by using openssl utility.

#openssl genrsa -des3 -out server.key 1024

you will be prompted to enter password or pass phrase of this key remember it because, it need in future.Now you have to create a Certificate Signing Request (CSR) from the key that just generated.

# openssl req -new -key server.key -out server.csr

For this step you have to give your name and Fully Qualified Domain Name (FQDN). Make sure you enter your FQDN for the "Common Name" for example if certificate is for https://www.thaibloger.com/ then you CommonName Should be www.thaibloger.com
now your certificate is ready to be signed. The following steps are to self-sign the certificate, but if you want other CA sign, you have to pay money. Some CA such as Verisign or Thawte.

# openssl x509 -req -days 3650 -in /root/server.csr -signkey server.key -out server.crt

Ok, your certificate is signed adn valid for 3650 days. You need to copy the files to appropriate directory for Apache.

# cp server.key /usr/local/etc/apache/ssl.key/
# cp server.crt /usr/local/etc/apache/ssl.crt/

after all step you have to config apache to use ssl. In apache 2 it's config file in extra/httpd-ssl.conf, by uncomment line.

# Secure (SSL/TLS) connectionsInclude
etc/apache22/extra/httpd-ssl.conf

Then go to edit the file point key file and cert file with correct path

SSLCertificateFile /usr/local/etc/apache22/ssl.cert/server.crt
SSLCertificateKeyFile /usr/local/etc/apache22/ssl.key/server.key

When restart the server with ssl apache will prompt you and ask for password of you private key because RSA private key is kept in encrypted format. You can eliminate password prompt but it not secure, by commands of openssl.

# cd /usr/local/etc/apache/ssl.key
# cp server.key server.key.orig
# openssl rsa -in server.key.orig -out server.key

then restart apache cheer!!

webmin >> installed

@comment Insert PLIST.lib-webmin here
===================================
To reconfigure webmin you shouldrun the following command as root:
${LOCALBASE}/lib/webmin/setup.sh
You won't have to perform this stepafter every webmin upgrade.
Since 1.150_2, to run webmin fromstartup, add webmin_enable="YES"in your /etc/rc.conf.
===================================

just have install webmin

after install have to run setup.sh once.
then add webmin_enable="YES" into /etc/rc.conf << if you don't do this you will can not start webmin

to start webmin use
Usage: /usr/local/etc/rc.d/webmin [fast|force|one](start|stop|restart|rcvar|status|poll)

Opencms Job Schedule

In opencms there are job scheduler that we can schedule opencms to run jobs by schedule it in style UNIX cron job. To create a job you have to write a piece of java code that implements I_CmsScheduleJob, and override method public String launch(CmsObject arg0, Map arg1).

--------------------------------------------------------------------------------------------
package com.thaibloger.utils;
import java.util.Date;
import org.opencms.scheduler.*;

public class TestSchedule implements I_CmsScheduledJob {
public String launch(CmsObject arg0, Map arg1) throws Exception {
// TODO Auto-generated method stub
System.out.println("xxxxxxxxx JOBs : "+ new Date());
return null;
}

}
---------------------------------------------------------------------------------------------

Then put the class in to your opencms WEB-INF/classes or pack it as .jar then put it in WEB-INF/libs of opencms, now restart.

In opencms console Administration view > Scheduled Jobs Management, create a job then specific the java class to run job set schedule by select cron expression.

then activate it, Vola ... that's all.

for more infomation about cron expression you can find it here, more information opencms use Quartz to implement jobschedule.



Fix BIND load master file master/local.rev not found

Notice this in your logs?

named[18681]: starting BIND 9.3.0 -c /etc/namedb/
named.confnamed[18681]: command channel listening on 127.0.0.1#953
named[18681]: command channel listening on ::1#953
named[18681]: zone 0.0.127.IN-ADDR.ARPA/IN: loading master file master/localhost.rev: file not found
named[18681]: zone 1.0.etc...IP6.ARPA/IN: loading master file master/localhost-v6.rev: file not found
named[18681]: zone 1.0.etc...IP6.INT/IN: loading master file master/localhost-v6.rev: file not found

Did you RTFM?
Not to worry, this is easy to fix:

hostname# cd /etc/namedb
hostname# sh make-localhost

from http://www.chrisburgess.com.au/fixing-binds-loading-master-file-masterlocalhostrev-file-not-found-error-message/

Apache2 + Tomcat5.5 + JK on FreeBSD

After serveral time that I try to config Apache to serve jsp, servelet i got fail.
Yesterday I try it again and WoooLa success.... , so i want to share and write
it as my memo..

Before begin i suggest that you already familiar with FreeBSD alittle at least
you should able to install program such as Apache, Tomcat, and JK from ports.
So, in this howto you should already installed Apache2.2, Tomcat5.5 and mod_jk
already, then I will write only howto config the things work.

How to
In configuration file of Apache you have to uncomment the line that load mod_jk

/usr/local/etc/apache22/httpd.conf
LoadModule jk_module libexec/apache22/mod_jk.so # un comment this line

and then you have to told Apache to know that where it can find the configuration of
mod_jk by add a line that include mod_jk.conf at the last line of httpd.conf

Include /usr/local/tomcat5.5/conf/jk/mod_jk.conf

then.... where is mod_jk.conf ??
mod_jk.conf and worker.properties are the configuration file for mod_jk that after
you installed mod_jk the files appear in /usr/local/etc/apache22/ as a sample file
mod_jk.conf.sample and worker.properties.sample then you should copy and rename
it to /usr/local/tomcat5.5/conf/jk/mod_jk.conf and worker.properties.

In mod_jk.config
# Replace jsp-hostname with the hostname of your JSP server, as
# specified in workers.properties.
#

JkWorkersFile /usr/local/tomcat5.5/conf/jk/workers.properties
JkLogFile /var/log/jk.log
JkShmFile /var/log/jk-runtime-status
JkLogLevel error
# Sample JkMounts. Replace these with the paths you would
# like to mount from your JSP server.
JkMount /*.jsp jsp-hostname
JkMount /servlet/* jsp-hostname
JkMount /examples/* jsp-hostname



======
in workers.properties

# Incredibly simple workers.properties file, intended for connecting
# to one host, via AJP13. See the tomcat documentation for
# information on more exotic configuration options.
#
# Change jsp-hostname to the hostname of your JSP server.
#
worker.list=jsp-hostname
worker.jsp-hostname.port=8009
worker.jsp-hostname.host=jsp-hostname
worker.jsp-hostname.type=ajp13
worker.jsp-hostname.lbfactor=1

in workers.properties and mod_jk.conf change jsp-hostname to your hostname
for example change it to localhost

restart apache and tomcat then test it.
it should work properly now.

ณ.บัด NOW! Kasikorn still use OpenCMS!

Kasikorn bank still using OpenCMS... 11/07/2007

Just wanna told you, that was my implemention, Thanks for OpenCms an one good open source cms.
:)

อะไรเอ่ย..มีก็ทุกข์ ไม่มีก็ทุกข์

....

ขอพอดีๆ เป็นมั๊ย

ความพอดี...ก็อย่างนี้
ขออะไรที่มันพอดีๆ แบบว่า ให้เอาใจทำได้ อย่าให้มาก..กูก็เหนื่อยเป็น
ช่วยเหลือ...ช่วยได้ อยากช่วยถ้ากูช่วยได้ กูช่วยอะไรไม่ได้ ขอให้กูช่วย
กูก็รับฟัง พอฟังแล้วกูก็จะขัดใจ เพราะว่ากูช่วยไม่ได้ ทำให้กูเป็นทุกข์

สาดเอ๊ย...ขอจบเท่านี้แหละ

Apache 2 autoindex customization.

Autoindex คืออะไรวะ?

ปกติ index ของ folder ใน web มันมีสองแบบคือ
1. เรา(คนทำเว็บ)เขียน ขึ้นมาเองแล้วตั้งชื่อไฟล์นั้นๆ ให้ตรงกับที่กำหนดไว้ใน DirectoryIndex directive
ปกติไฟล์นี้ชื่อว่า index.html, default.html หรืออะไรก็ตามที่ตรงกับที่กำหนดไว้ใน DirectoryIndex directive
2. ก็มาจาก การ listing generated โดย server ซึ่งในส่วนนี้จะมี directive ที่ควบคุมรูปแบบของ listing นี้
เช่น The AddIcon, AddIconByEncoding and AddIconByType ใช้เพื่อกำหนด icons ในการ list ไฟล์ สำหรับ
ไฟล์ประเภทต่างๆ สำหรับแต่ละรายการที่แสดง icon แรกที่ตรงกับทีกำหนดจะถูกใช้ ส่วนนี้ควบคุมโดย
mod_autoindex.

อันนี้เหมาะกับ พวกขี้เกียจ แต่ต้องการให้ autindex listing ดูดีนิดหน่อย
หรืออย่างผม สามารถเอา google adsence ใส่เข้าไปใน listing นี้ได้ด้วยนะจะบอก!!!

แล้วทำยังไงถึงจะ enable มันได้

อันแรกเลย ไปที่ httpd.conf แล้ว search หา autoindex ถ้าเจอ LoadModule autoindex_module โดน comment
อยู่ก็ ไปเอา comment ออกซะ
จาก >>>> #LoadModule autoindex_module modules/mod_autoindex.so
เป็น >>>> LoadModule autoindex_module modules/mod_autoindex.so

พอลองไป refresh webdir ที่เป็น autoindex อยู่ก็จะเห็นว่า >>> มันยังหน้าตาเหมือนเดิม (เกาหัว) ตูลืมอะไรหว่า??
อ่อ... ลืมครับยังต้อง uncomment อีกบรรทัดนึง Include conf/extra/httpd-autoindex.conf (ใน apache 2 มันแยก
config ไว้หลายๆ ไฟล์แล้วใน httpd.conf ก็จะมี include อย่างนี้หลายๆ อัน!! )

# Fancy directory listings
Include conf/extra/httpd-autoindex.conf


หลังจากนี้ก็ refreh webdir ของเราอีกที ก็จะเห็นหน้าตา autoindex ที่ fancy ขึ้น มี icons มีไฟล์ไซต์ ตามที่กำหนดใน
http-autoindex.conf

ส่วนว่าต้องการเห็นอะไรบ้างก็ไปดูเอกสารกันเองนะกรั๊บ...ตาม link
http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html

อ่อ...จะใส่ adsence ลงใน autoindex ก็ไป edit ไฟล์ Header.html นะครับเอา code adsence ใส่เข้าไปใน header.html
แล้้วลองดูผลกันเอาเอง :)

อาดิโอส...อรุณสวัสดิ์ครับผม

Change Ant version in NetBeans easy.

NetBeans IDE 6.0 Preview (M9, build 070502)

NetBeans IDE 6.0 M9 come with Ant build tool version 1.7, which syntaxs of build file maybe different with Ant version 1.6. When I use NetBeans with default Ant(1.7) build Nutch i got error.

D:\javas\NBeansProject6\nutch\build.xml:61: Specify at least one source--a file or resource collection.BUILD FAILED (total time: 0 seconds)

I'm too lazy to correct the build.xml to correct the problem, so i go to change Ant version to elder one (v.1.6) and try to build it again. then I got .....BUILD SUCCESSFUL (total time: 16 seconds)

------------------------
To change Ant goto >
Tools > Options > Miscellaneous > Ant > Ant Home

Change Ant Home to ant version that you prefer. Easy?

Computer security basics

Computer security basics
It's useful to understand what computer security protects against, the respective defense mechanisms, and the different terminologies associated with it. 

Threats
Threats -- attacks against computer security -- can be broadly categorized as:

Secrecy attacks: Attempts to steal confidential information either by exploiting weaknesses in cryptographic algorithms or by other means. 
Integrity attacks: Attempts to alter information with some selfish or malicious intent. Integrity attacks, it should be noted, can also be accidental. 
Availability attacks: Attempts to disrupt a system's normal operations. Availability attacks are also referred to by the recently popularized term, denial of service (DoS) attacks. 



Several attacks fall into one or more of the categories mentioned above. Examples include:

A brute force attack typically involves searching every key until the right one unlocks the door. While that may seem like an expensive operation, in reality it is possible to preen the search using specialized tools. 
A Trojan horse attack involves planting an enemy as an insider in such a way that it's not apparently noticeable. A computer virus serves as a common Trojan horse example. 
A person-in-the-middle attack intercepts communication between two parties without their knowledge. They assume that they're communicating normally. 



Other attacks include: birthday attack, dictionary attack, meet-in-the-middle attack, and so on. (For a more comprehensive discussion, see Bruce Schneier's Applied Cryptography in Resources.) 

Protections
To shield against security threats, there are a variety of protection mechanisms. Historically, defense mechanisms have involved erecting some sort of a wall or boundary, commonly referred to as a perimeter defense.

Firewalls, a fairly successful example of perimeter defense, separate internal (private) and external (public) networks, and provide a central point of control for a corporate policy. However, firewalls increasingly allow select forms of traffic -- HTTP for example -- to cross over. 

A virtual private network (VPN), which provides the same security level as a private network while still using a shared network, serves as another protection example. 

Cryptography
Cryptography and cryptanalysis, its related field, concerns itself with the design and analysis of algorithms for encrypting and decrypting information. We'll discuss cryptography's vital relationship to security in the sections below. 

Confidentiality
Confidentiality is the process of protecting data from unauthorized use or users. Simply put, it means that only the intended recipient of a message can make sense of it. 

If you're exchanging sensitive information with someone else, you want to be absolutely sure that only the intended recipient of the message can make sense of the message and, in the eventuality that it falls into wrong hands, the message becomes effectively useless. Confidentiality is accomplished by some form of cryptographic technique. 

Authentication
The authentication process confirms the user's identity. The user could be a software entity or a human. A principal is the party whose identity is verified. Associated with a principal is a set of credentials. Usually, authentication confirms identity by some secret information -- a password, for example -- known only to the user and the authenticator. Beyond passwords, more sophisticated security schemes employ advanced techniques such as smart cards or biometrics (finger printing, retinal scans, and so on) for authentication. 

Once authentication is established, access to the user (or generally principal) is governed by the access control mechanisms in force. 

Kerberos -- based on keys and encryption -- demonstrates an early authentication technology. It uses timestamps -- sessions remain valid for a defined time period -- to achieve that. To work properly, Kerberos fundamentally assumes that the clocks in a distributed system are synchronized. 

Public key infrastructure (PKI), discussed in sections below, represents a more general authentication solution. 

The Java Authentication and Authorization Service (JAAS) framework supplements the Java 2 platform with user-based authentication and access control capabilities. JAAS is a standard extension to the Java 2 Software Development Kit, v 1.3. 

Integrity
Let's say that you sent an electronic check. When the bank ultimately receives the check, it needs to be sure that the payment amount has not been tampered, a security concept known as integrity. 

Nonrepudiation
In the electronic check scenario outlined above, if you indeed sent the check, there ought to be no way you can deny it. Nonrepudiation provides undeniable evidence of actions such as proof of origin of data to the recipient or receipt of data to the sender. 

Auditing and logs
Keeping a record of resource access that was granted or denied might be useful for audit purposes later. To that end, auditing and logs serve the useful purposes of preventing a break-in or analyzing a break-in post mortem. 

Policy and access control
A security policy focuses on controlling access to protected data. It's important that the security enforcing mechanisms should be flexible enough to enforce the policy. That is referred to as keeping the policy separate from the mechanism. While that decision might be based on authorizing access to a resource based on the identity of principal, it is often easier to administer access control based on roles. Each principal is mapped to a unique role for the purposes of access control. It is often implemented as a list or matrix enumerating the access that different users/roles have to the different protected resources.  

Benchmarks Game : Safari 3 Claimed, It's performance better IE7 and Firefox


Several days ago Apple had released  Safari browser platform on window, Steve Jobs the CEO and Apple marketing claim that Safari browser performance advantages over IE nad Firefox. Truely I never know Safari before but my friends that us Mac os told me that, So i download Safari and found that the browser still beta version. After install it's no problem to run the browser but i very upset with it's performance, that surely form my experience that it's slower than IE7 and firefox exactly.
Serveral days later, there have some benchmark form Wired Blogs that show performance of Safari3 is slower than IE7 and Firefox. They had tested by use Safari, Firefox and IE7 open Google Mail's login page, login to the mail until Google Mail index page appeared with 50 message and all graphics and message status indicators, lunch Google Calendar and display two subscripbed calendars.


Result is Firefox is fastest and IE7 is still better than Safari.

This benchmark form http://blog.wired.com/monkeybites/2007/06/wired_news_benc.html

Apple's Safari browser now for Windows



Apple launched a version of its Safari web browser for Windows-based PCs on Monday, pitting it against Microsoft's Internet Explorer and Mozilla's Firefox.
"What we've got here is the most innovative browser in the world and the most powerful browser in the world," said Apple CEO Steve Jobs said during his keynote speech at the company's Worldwide Developers Conference.
Safari, which was released a few years ago for Apple's Macintosh computers, has captured about 5 per cent of the world's market share for internet browsers with more than 18 million users, Jobs said.
Internet Explorer is the predominant browser with a 78 per cent share, while Firefox has rapidly climbed to gain about 15 per cent of the market, he said. Like the other web browsers, Safari is available as a free download.
Jobs claimed Safari performs twice as fast as its competitors.




Build for iPhone
Never one to disappoint his audience, the iconic chief executive - in his final highlight of his 1 1/2 hour speech - also pulled out an iPhone and told the thousands of developers before him that the highly anticipated hybrid smart phone and iPod will run Safari.
That means, Jobs said, that any application meant to run on the Safari browser for Macs would also be fully accessible and compatible with the iPhone.
Jobs also announced that Apple is opening the core of its iPhone to independent developers, giving them a way to have customised programs ready when the devices hit the market June 29.
"You can begin building your iPhone applications today. We are very excited about this," Jobs said.
The announcement was met with cheers from developers that had been pressuring the Cupertino, California-based company for a way to tailor applications to iPhones.
"You can build custom applications for the iPhone that have the look and feel of the phone," Jobs told the crowd.
"You can build fantastic applications for iPhone. I can't wait to run all the applications you're going to build."


Harry Potter games for Macs
US computer game giant Electronic Arts has announced that it is tailoring a new Harry Potter game and other titles for Apple's Macintosh computers.
"The only thing better than living on a Mac is living in Hogwarts," EA's chief creative officer Bing Gordon said as he demonstrated the Potter game at the opening of Apple's Worldwide Developers Conference in San Francisco.
On a large screen behind the stage where Gordon stood with Jobs, an animated Potter cast spells and made candles float in the Great Hall of Hogwarts School of Witchcraft and Wizardry made famous in the best-selling series of books by J.K. Rowling.
Harry Potter and the Order of the Phoenix for Macintosh computers, powered by Intel chips, will be released in July along with EA titles Battlefield 2142, Command and Conquer, and Need for Speed Carbon, according to Gordon.

A sample Google MAP web

Serveral days ago i have regist Google map and try to use the map in my homepage.

In this page http://www.thaibloger.com/guides/chumphon/chumporn_guide.html.
This page is guideline to travel Chumphon Islands National Park of Thailand.
For now Information in the page still be thai language, i hope to update it soon,
But not too soon. Because my English is not quite good.

About Iframes and it's restriction...

What is Iframe??
Iframe or Inline Frames is an new element of html document that allow you to load html files inth and existing document.
What browser support iframe?
IE4+, Netscape6+, Firefox, Mozilla, Opera and other modern browsers all support iframes.

An External html document can be loaded into iframe without disrupting the rest of the document. Styling and Scripting in iframe can be manipulate properties in the iframe itself as original html document. The document style does not inherit from containing document.
JavaScript can be used to communicate betaween document in iframe and containing document.

Note
When you try to access properties of document that loaded into iframe, make sure that the document loaded into iframe come from same domain, else you got "permission denied".
....event it's the sub domain you still got "permission denied".

Next.. article I will show some example of scripting with iframe..

Netbeans and Thai language

Netbeans and Thai language
Netbeans and Thailanguage, Output window.

Serveral days ago..I have a little test on Netbean 5.5
In netbean 5.5 create and application for test whit some "Hello world" but in Thai
"สวัสดีชาวโลก"

---------------------------------------------
public class Main {
public static void main(String[] args) {
System.out.println("สวัสดีชาวโลก");
}
}
---------------------------------------------

then build project i got this error.

---------------------------------------------
Compiling 1 source file to D:\javas\projects\test\build\classesD:\javas\projects\test\src\test\Main.java:28: unmappable character for encoding Cp1252
System.out.println("สวัสดีชาวโล�");
1 errorBUILD FAILED (total time: 0 seconds)
---------------------------------------------


What that!! Um that because default JVM default property "file.encoding" is Cp1252
from http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
windows-1252 Cp1252 is--> Windows Latin-1
you can check it by printout property by --> System.getProperty("file.encoding");

then how i can solve the problem???
Ans Menu Tools>Options>advanced options>java soucrces>default encoding
set it to UTF8

then compile again you should got BUILD SUCCESSFUL

but
when you run it in netbeans. You will got
สวัสดีชาวโล�
some special font that you can't read in Thai....What da Heck???

Ans netbeans default output use UTF8 then how to fix this?
from project>right click>properties>Run
put this -Dfile.encoding=TIS620 in to Vm Options
then run again.... You still got ÊÇÑÊ´ÕªÒÇâÅ¡ copy it to notepad you should read this
text..??

because
Output window of netbeans cannot set font to other than it default font Monospaced.

สุดเซ็ง ใน Netbean 6 ที่กำลังจะออกก็ยังไม่ได้แก้ตรงนี้ วันนี้เข้าไป request feature นี้แล้ว
แต่ไม่รู้มันจะทำให้หรือเปล่า?? จะแก้เองก็เกรงใจ ไว้ว่างๆ แล้วค่อยมาดูแล้วกัน สุดเซ็ง.
จบข่าว.....

Netbeans 5.5 Can't even set font in output window

After try to explore how to set font in Output window of Netbeans.
I Found that I can't set Netbeans output window font.

Why i have to change output window's font?
Because i have to use other language on output window for testing.

I hope that next version Netbeans 6 would have this feature.!

Using Jakarta Jmeter through Proxy

Using Jakarta Jmeter through Proxy
to config Jmeter to send request through proxy..in startup script "jmeter.bat" or "jmeter" shell script you should set paramterat last line.

-Dhttp.proxyHost=yourproxy -Dhttp.proxyPort=80

then your script may look like this

%JM_START% %JM_LAUNCH% %JVM_ARGS% %ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" -Dhttp.proxyHost=yourproxy -Dhttp.proxyPort=80 %JMETER_CMD_LINE_ARGS%