<< XML-RPC ¿¡¼­ SSL »ç¿ëÇϱâ >> ÀÛ¼ºÀÚ : ÀåÇüÈ­(hhjang97@venus.uos.ac.kr) ÀÛ¼ºÀÏ : 2002. 01. 30 ¼³Ä¡È¯°æ : Redhat 7.2 À߸øµÈÁ¡ÀÌ ÀÖÀ¸¸é ¸ÞÀϺ¸³»ÁÖ¼¼¿ä.!!!! ¼³Ä¡Çϱâ : ¼³Ä¡´Â ´ÙÀ½°ú °°ÀÌ ¼ø¼­·Î ÇÏ½Ã¸é µË´Ï´Ù. 1. HTTP ¸¦ ÀÌ¿ëÇÏ´Â °æ¿ì - DB ¼³Ä¡ : mysql - Apache ¼³Ä¡ : DSO ·Î ¼³Ä¡ÇÑ´Ù. - PHP ¼³Ä¡ : php-4.1.0 À» xml-rpc ¸¦ Áö¿øÇϵµ·Ï ¼³Ä¡ÇÑ´Ù. --with-xmlrpc ¿É¼ÇÀ» ÁÖ¸éµÈ´Ù. - Apache ¸¦ ½ÇÇà½ÃŲ´Ù. 2-1. HTTPS ¸¦ ÀÌ¿ëÇÏ´Â °æ¿ì(¾ÆÁ÷ Çغ¸Áö ¾Ê¾Ò´Ù. ±×³É Åë¹äÀ¸·Î ¼ø¼­¸¦ Á¤Çß´Ù. :) - DB ¼³Ä¡ : mysql - Apache + mod_ssl + PHP4 À» ¼³Ä¡ÇÑ´Ù. http://kldp.org/Translations/html/Apache+mod_ssl-KLDP/Apache+mod_ssl-KLDP.html - À§ Áß°£¿¡ cURL À» ¼³Ä¡ÇØ¾ß µÉ°ÍÀÌ´Ù. ¾ÆÁ÷ Çغ¸Áö ¾Ê¾Æ¼­ Àß ¸ð¸£°Ú´Ù. -.-;; - Apache ¸¦ ½ÇÇà½ÃŲ´Ù. 2-2. RPM À» ÀÌ¿ëÇؼ­ ½±°Ô ÇÏ´Â ¹æ¹ý - ´ÙÀ½ÀÇ RPM À» ¼³Ä¡ÇÏÀÚ. openssl °ú curl Àº º¸Åë ¼³Ä¡µÇ¾îÁ® ÀÖ´Ù. openssl-0.9.6b-8.i386.rpm : openssl ¼³Ä¡ openssl-devel-0.9.6b-8.i386.rpm curl-7.8-1.i386.rpm : cURL ¼³Ä¡ curl-devel-7.8-1.i386.rpm mysql-3.23.41-1.i386.rpm : MySQL ¼³Ä¡ mysqlclient9-3.23.22-6.i386.rpm mysql-devel-3.23.41-1.i386.rpm mysql-server-3.23.41-1.i386.rpm apache-1.3.20-16.i386.rpm : Apache ¼³Ä¡ apacheconf-0.8.1-1.noarch.rpm apache-devel-1.3.20-16.i386.rpm apache-manual-1.3.20-16.i386.rpm php-4.0.6-7.i386.rpm : PHP ¼³Ä¡ php-devel-4.0.6-7.i386.rpm php-ldap-4.0.6-7.i386.rpm php-manual-4.0.6-7.i386.rpm php-mysql-4.0.6-7.i386.rpm mod_ssl-2.8.4-9.i386.rpm : mod_ssl ¼³Ä¡ pspell-0.12.2-3.i386.rpm : ¼³Ä¡Áß°£¿¡ ÇÊ¿äÇÏ´Ù. 3. ¼³Ä¡ÈÄ XML-RPC for PHP ¼³Ä¡Çϱâ - xmlrpc1_02.tar.gz ¸¦ ´Ù¿î¹Þ´Â´Ù. http://sourceforge.net/project/showfiles.php?group_id=34455 - »ç¿ëÀ» ¿øÇÏ´Â µð·ºÅ丮¿¡ ¾ÐÃàÀ» Ǭ´Ù. 4. ¿¬½ÀÇϱ⠾Ʒ¡´Â ¼­¹ö¿Í Ŭ¶óÀ̾ðÆ® ¼Ò½º ÀÔ´Ï´Ù. client.html ¿¡ º¸½Ã¸é HTTP ¿Í HTTPS µÎ°³·Î Á¢¼ÓÀ» ÇÒ ¼ö ÀÖ°Ô Çß½À´Ï´Ù. ============================ client.html =============================== send($message); /* ## HTTPS ·Î Á¢¼ÓÇÑ´Ù. $server = new xmlrpc_client('/xmlrpc/server.html', 'xmlrpc.hostname', 443); // HTTPS // Send a message to the server. $message = new xmlrpcmsg('sample.sumAndDifference', array(new xmlrpcval(6, 'int'), new xmlrpcval(2, 'int'))); $result = $server->send($message, 0, 'https'); */ // Process the response. if (!$result) { print "

Could not connect to HTTP server.

"; } elseif ($result->faultCode()) { print "

XML-RPC Fault #" . $result->faultCode() . ": " . $result->faultString(); } else { $struct = $result->value(); $sumval = $struct->structmem('sum'); $sum = $sumval->scalarval(); $differenceval = $struct->structmem('difference'); $difference = $differenceval->scalarval(); print "

Sum: " . htmlentities($sum) . ", Difference: " . htmlentities($difference) . "

"; } ?> ============================ client.html =============================== ============================ server.html =============================== getParam(0); $x = $xval->scalarval(); $yval = $params->getParam(1); $y = $yval->scalarval(); // Build our response. $struct = array('sum' => new xmlrpcval($x * $y , 'int'), 'difference' => new xmlrpcval($x - $y, 'int')); return new xmlrpcresp(new xmlrpcval($struct, 'struct')); } // Declare our signature and provide some documentation. // (The PHP server supports remote introspection. Nifty!) $sumAndDifference_sig = array(array('struct', 'int', 'int')); $sumAndDifference_doc = 'Add and subtract two numbers'; new xmlrpc_server(array('sample.sumAndDifference' => array('function' => 'sumAndDifference', 'signature' => $sumAndDifference_sig, 'docstring' => $sumAndDifference_doc))); ?> ============================ server.html =============================== ###################### # ¿¡·¯ ###################### #### Error XML-RPC Fault #8: CURL error: Connection refused #### Ans URL : http://www.modssl.org/docs/2.8/ssl_faq.html How can I speak HTTPS manually for testing purposes? [L] While you usually just use $ telnet localhost 80 GET / HTTP/1.0 for simple testing the HTTP protocol of Apache, it's not such easy for HTTPS because of the SSL protocol between TCP and HTTP. But with the help of OpenSSL's s_client command you can do a similar check even for HTTPS: $ openssl s_client -connect localhost:443 -state -debug GET / HTTP/1.0 Before the actual HTTP response you receive detailed information about the SSL handshake. For a more general command line client which directly understands both the HTTP and HTTPS scheme, can perform GET and POST methods, can use a proxy, supports byte ranges, etc. you should have a look at nifty cURL tool. With it you can directly check if your Apache is running fine on Port 80 and 443 as following: $ curl http://localhost/ $ curl https://localhost/ #### Ans 2 1. /etc/hosts.deny ¿Í /etc/hosts.allow ¸¦ È®ÀÎÇÑ´Ù. 2. ipchains ¿¡¼­ Á¢¼ÓÀ» Çã°¡ÇÑ´Ù.