Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Monday, September 11, 2023

How to add datasource to reportserver.net?

Extracting from MySQL and PostgreSql database can be done via Reportserver.net. Other relational databases are also supported as of Reportserver.net version 4.

Configuration

Step 1: Login as administrator user

Step 2: In the menu choose "Datasources", then right click "Datasource Root" and right click to choose "Insert" ->"Relational Database".

Step 3: Enter the following and click "Apply"

  • Name
  • Description
  • Database
  • Username
  • Password
  • URL
The Permission tab provides better control for user to access.

Postgresql database URL

jdbc:postgresql://10.1.1.102/customers

MySQL database without SSL URL

jdbc:mysql://10.1.1.100:3306/customers?useSSL=false

MySQL database URL

jdbc:mysql://10.1.1.100:3306/customers


Details for other databases can be found at https://reportserver.net/en/guides/admin/chapters/Datasources/

Troubleshooting

Host 'host_name' is blocked in MySQL

Too many attempts made to the database can be caused by having or not having ssl. 
Solution:
Try to disable SSL protocol for the client.

Missing Relational Database Driver

Reportserver.net comes with several drivers. To customise datasource, 
Login as administrator and click "File System".
Click "Fileserver Root"->"etc"->"datasources"->"datasources".
Click on tab "Edit file".

It defaults to the following:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <datasource>
      <defaultDatasourceName>Demo Data</defaultDatasourceName>
      <!-- or access via ID -->
      <!-- <defaultDatasource>14</defaultDatasource> -->
   </datasource>
</configuration>


Wednesday, January 12, 2022

Howto redirect HTTP to HTTPS in Apache httpd

 Apache web server is an open source software (OSS) that is widely used on many sites even though there are a few newer web servers. 

HTTP request and response are transmitted over the network in plain text format. Anyone with a network sniffing tools or a man-in-the-middle (MitM) tool can easily intercept and read the information. Widely used internet search engine, Google began to use HTTPS as a search ranking signal in 2014. 

HTTPS request and response are transmitted using TLS or SSL, that encrypts the data travelling on the network. Those special tools are able to capture the data, but because it is encrypted, its of not much use to the average hackers and intruders. Using HTTPS provide advantages over HTTPS, such as;

  1. Data is encrypted, making it safer to transmit sensitive information over the network.
  2. Modern web browsers are better able to inform users if the site is safe in many aspects. Such as having a valid certificate or if data is coming from where its suppose to be instead of some unidentifiable source.
  3. Use of modern HTTP/2 protocol provide a better user experience, which includes improved site performance and security.
  4. Free wifi hotspots that tend to inject advertisements can be prevented.
  5. Web browsers can advice and prevent users from accessing data sensitive features such as geolocation, device motion and orientation if the site isn't HTTPS
Looking forward: 
  1. Legacy web browsers such as MS Internet Explorer do not have compatible SSL 2.0 and TLS 1.2. Which is why there is a need to disable its SSL 2.0 features when visiting HTTPS sites. (MS KB 2851628)
  2. Malware have started to ride on HTTPS encrypted features. Which means more advanced network monitoring tools are required to manage such malware.
In order to ensure web browsers are only using HTTPS, any request that is HTTP must be forwarded to a HTTP request. This is done with Apache httpd directive "Redirect".

E.g. where our host is harmonyshades.com.

Step 1: Edit Apache configuration file and include this. 

<VirtualHost *:80>
  ServerName harmonyshades.com
  
  Redirect / https://harmonyshades.com
</VirtualHost>

Step 2: Restart wen server

systemctl restart httpd

Test on a web browser. HTTP pages will automatically load HTTPS pages.


Thursday, May 9, 2019

Enhance Apache and Lighttpd on Centos Linux: increasing file descriptors limit

Centos Linux servers typically have the maximum file descriptors at 1024. Other Linux distributions may have the same settings, but what is this file descriptor and how to increase the value? Please use linux man pages to get further details of the commands in this document. These are information for educational purposes.


Some web servers that have to work harder, may need to multitask more than others. This is when there will be warnings in /var/log/messages related to

can't have more connections than fds/2:  1024 1024

or Apache error logs showing

ulimit:error setting limit(Operation not permitted)


Another situation is when a software runs into an infite loop of process, such that is increase resource usage until the server comes to a complete stand still. Causing no other users to have access to the server. On a production server, this would be a disaster. What is really affected by these limits? Its the application performances such as database and web servers that are under heavy usage. Typical linux terminal users wont really need to concern with the limits.


View limits
Users can view file limits with the command;

$ ulimit 
$ ulimit -aH

Value of unlimited is common for development servers.

To view limit for current BASH open files of the user;

$ ulimit -n

To view max user processes

$ ulimit -Hn
$ ulimit -u

To view limits of any running process, identify the process ID ($PID) then run command;
$ grep 'open files' /proc/{$PID}/limits

Replace {$PID} with the PID to be checked.

Any user can reduce their file descriptor limit. This is useful to test problematic applications. Example to reduce to 1024.

$ ulimit -u 1024


Configuration file sysctl
This sysctl.conf and files in /etc/sysctl.d is an interface that allows you to make changes to a running Linux kernel. This file is extensively configured to harden a production Centos Linux server. Example, to reboot the linux after a kernel panic, the following values is used;

kernel.panic=10

With /etc/sysctl.conf you can configure various Linux networking and system settings. To view current values;

$ sudo sysctl -A
$ sudo sysctl fs.file-max
fs.file-max = 994255


Centos Linux

Check the current value of the file descriptor
$ ulimit -aHS
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 39253
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

To view system configured default limit on file descriptors.

$ cat /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

*          soft    nproc     4096
root       soft    nproc     unlimited



Here, the plan is to increase limits to 65530.

Change the hard and soft limits in configuration file.

Edit /etc/security/limits.conf with these values. The * refers to any user.

* soft nproc 65535
* hard nproc 65535

* soft nofile 65535
* hard nofile 65535


In cases where the fs.file-max is below the 65535 value, then it can be set by editing /etc/sysctl.conf

fs.filemax = 65535

In both cases above, apply changes with the command;

$ sudo sysctl -p

Lighttpd


Edit /etc/lighttpd/lighttpd.conf

server.max-fds = 2048

Apache Httpd

The Centos, this document referring is with httpd version 2.4.6 (CentOS) and is using httpd compiled as preforked (non threaded).

Edit the file /etc/httpd/conf/httpd.conf

<IfModule prefork.c>
StartServers       4
MinSpareServers    3
MaxSpareServers   10
ServerLimit      256
MaxClients       256

MaxRequestsPerChild  10000
</IfModule>


Refer details at Apache.org

Selinux

When selinux is in mode Enforcing, it needs to allow changes. Check the status with

$ sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31


$ getsebool httpd_setrlimit
httpd_setrlimit --> off


Temporary turn it on, then later view the status again;

$ setsebool httpd_setrlimit on

To make this change permanent;

$ sudo setsebool -P httpd_setrlimit on

MYSQL database

Edit /usr/lib/systemd/system/mysqld.service

LimitNOFILE=65535
LimitNPROC=65535


Edit /etc/my.cnf

table_open_cache=65535
open_files_limit=65535



Apply the changes;

$ sudo systemctl daemon-reload
$ sudo systemctl restart mysqld.service


Thursday, August 30, 2018

Laravel, Swiftmailer and Uncaught Swift_TransportException

Writing PHP applications that deliver email notification helps to build a versatile system that uses the most basic communication media on the Internet. The Email.

Getting the Email out would require knowledge of the Email server in use to deliver 1 or thousands of email notifications. Common Email use SMTP, sendmail, postfix or a custom Transport implementation for corporate use. There are security and reliability concerns when passing to any Email server. Some of which include protection from email header injection attacks, MIME compliant, HTML/multipart emails, inline or embedded images.

Swift Mailer helps to handle most of these things. Why reinvent the wheel? In order to use it, the application should support PHP 7.0 or higher. Installation through Composer simplifies the whole process.

$ composer require "swiftmailer/swiftmailer:^6.0"

More details are found at Swift Mailer.

Purpose

Back to the original reason of this post. On a recent Laravel application, tested was carried out and checklist done on Centos Linux development server However when deployed to production Centos Linux server, email notification produced following error;

PHP Fatal error: Uncaught Swift_TransportException: Connection could not be established with host EMAILSERVER_NAME[Permission denied #13]

The full error is shown below.

[Thu Aug 30 14:35:54.225637 2018] [php7:error] [pid 18234] [client IPADDRESS:32852] PHP Fatal error: Uncaught Swift_TransportException: Connection could not be established with host EMAILSERVER_NAME[Permission denied #13] in /var/www/tboxmy/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:277\nStack trace:\n#0 /var/www/tboxmy/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(62): Swift_Transport_StreamBuffer->_establishSocketConnection()\n#1 /var/www/tboxmy/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(113): Swift_Transport_StreamBuffer->initialize(Array)\n#2 /var/www/tboxmy/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start()\n#3 /var/www/tboxmy/public/info/testemail.php(21): Swift_Mailer->send(Object(Swift_Message))\n#4 {main}\n thrown in /var/www/tboxmy/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 277 

 Solution

I am sure there are other possible ways to get this error, but in my case it was SELINUX. On the development selinux was on permissive and on production it was enforcing (quite strictly).

The next time this happens; here are the steps to take.

Determine selinux status and the booleans.

$ sestatus
. . .
$ getsebool httpd_can_sendmail
httpd_can_sendmail --> off
$ getsebool httpd_can_network_connect
httpd_can_network_connect --> off

Turn the permission to ON.

$ sudo setsebool -P httpd_can_sendmail 1
$ sudo setsebool -P httpd_can_network_connect 1

Restart the web server.
Done.

Thursday, October 6, 2016

Learning to code for kids

Here are 5 websites to start the young minds with coding. In no particular order;

Scratch 

Use of the famous programming blocks of different shape and colours to do coding. Adobe Flash is required for the web interface.

CodinGame

Use web interface to complete snippet of codes. This is not for the uninitiated. You have a choice of using the text editor Emacs, Vim or the standard IDE that supports several popular programming languages. This includes C, C++, Java, Go, Paskal, PHP, Python and Ruby. If you are looking to learn logics and algorithms, this is it.




Code Academy

Provides programming courses for free. Personal learning plan and quizzes with advisor are included in the paid subscription. Its starts off with learn to HTML and CSS.


Code.org

Place to learn coding with contribution from many difference sources. Some element of Scratch with specialised themes and gamification to learn coding. Lots of resources for lesson plans.
A sweet start would be Coding with Anna and Elsa.


Alice

Create 3D animations and learn programming for those familiar with the use of computers. This product of Carnegie Mellon University teaches C++, Java and C#.



Any of these made it to your your favourite sites?

Friday, August 7, 2015

What is OpenStack? Some Figures and statistics.

Cloud computing is still gaining some interest in public and private organisations. Many large organisations have shown interest and support for OpenStack as a software to deliver cloud platforms. With the source code to OpenStack freely accessible and welcomes community participation via the Foundation, it has also grown into an operating system of its own.

Recognition of the companies contributing to some parts of OpenStack include;
Those who are keen, should look up these developers to see how they contribute to the project.

There are some statistics that may be of interest at Openstack Activity Dashboard. Number are just numbers, but it makes lots of nice charts and puts some perspective of the project.

Some figures as of 6th Aug 2015;
  • Code developers; 3,971
  • Code submitters; 4,171
  • Launchpad participation; 8,881
  • IRC participants; 20,302
  • Ask participants; 4,035





Contribution by companies like HP, IBM and Red Hat;




There is a Malaysian OpenStack meetup on 13th Aug 2015 (Event), and its free.

Wednesday, December 10, 2014

Howto Install Joomla 3 on MS Windows 8

Content Management Systems (CMS) provides a simple framework to focus on developing a web site to deliver specific contents. Basic stuff like user authentication, layout and web standards will be handled by the CMS while more important stuffs like getting the message across and providing a specific service can be the main focus.

Yes, gain insights of experts and community around the world by using a CMS like Joomla! that practices use of open source software (OSS) license.

Installation was done based on notes from docs.joomla.org at https://docs.joomla.org/Use_Joomla!_on_your_own_computer

Following are my notes on installation of Joomla! 3.3.6 on Windows 8. Before going to step 1, ensure the web server has;

Apache 2.4
PHP 5.4 (min 5.3.10), enable following PHP modules
  • Magic Quotes GPC Off
  • Register Globals Off   
  • Zlib Compression Support 
  • XML Support   
  • Database Support: (mysql, mysqli, pdo)  
  • MB Language is Default 
  • MB String Overload Off  
  • INI Parser Support    
  • JSON Support  
  • configuration.php Writeable
MySQL 5.5

Step 1: Getting Joomla!

Download Joomla! from http://www.joomla.org/download.html and extract it to a folder, e.g. myjoomla.
Copy this to your web folder. e.g. C:\apache24htdocs

Step 2: Preparation

Create a MySQL database called myjoomla3. Login to MySQL client and type;

CREATE database myjoomla3;

 And logout.

Step 3: Installation

Open a web browser and enter URL Address. E.g. http://localhost/myjoomla and enter details. Complete the sections for "Configuration", "Database", "Overview".

Configuration


I choose to create the default Administrator username as "admin".



Database
Ensure the configuration for database created is entered correctly. Choose MYSQLi if you are prompted to do so.

Overview
Choose Install Sample Data: Default English (GB) Sample Data

Click "Install". When installation is completed, you will receive the confirmation message "Congratulations! Joomla! is now installed."

Open Windows Explorer and remove the installation folder in joomla named installation. E.g. C:\Apache24\htdocs\myjoomla\installation


Step 4: Post installation

Test the installation with a web browser as;
  1.  front-end page  at http://localhost/myjoomla/
  2.  site administration page  at http://localhost/myjoomla/administrator/
First access: Front-end on desktop

First access: Front-end on mobile
First access:Administration page


Step 5: Choosing a template

This is an extra step for looks. In a web browser open the Administration page, e.g. http://localhost/myjoomla/administrator

In the default Administration page, observer the left column and click "Template Manager". In the left menu choose "Styles". There are 4 styles available for you;
  1. Beez3 (for Front-end)
  2. Hathor (for Administration page)
  3. isis (Default for Administration page)
  4. protostar (Default for Front-end)
 Try to click on Hathor, notice the page has changed. Click Beez3, and in Front-end see the changes.


Done.

Wednesday, December 3, 2014

Install DebugKit for Cakephp 2.5

Debugging in Cakephp is made easier with the DebugKit. Here are steps to install the DebugKit on Centos 6 and CakePHP 2.5.6.

Following are notes based on installation instructions from the Debugkit site.

Step 1: Install CakePHP 2

See previous posting on Installing Cakephp.

Step 2: Download and extract

Read the instructions from DebugKit from Github then download and extract to the cakephp folder app/Plugin.

cd /var/www/html/cakephp-2.5.6/app/Plugin
unzip debug_kit-master.zip
mv debug_kit-master debug_kit
chown -R apache debug_kit-master

Step 3: Configure CakePHP

In app/Config/bootstrap.php add following line;

CakePlugin::load('DebugKit');

In app/Controller/AppController.php edit the class with the array line;

class AppController extends Controller {
         public $components = array('DebugKit.Toolbar');
}



In app/Config/core.php change debug from 2 to 1
         Configure::write('debug', 1);

Note: The Make sure to remove the 'sql_dump' element from your layout (usually app/View/Layouts/default.ctp)

In a web browser open the cakephp site to confirm if Debugkit is available. e.g. http://localhost/cakephp-2.5.6



Saturday, January 5, 2013

What you should not do for your online portal

At any time if you have launched a portal accessed publicly, its a bad idea to have links showing Minta Maaf.

Just found this on the Malaysian Road Transport Department Portal on  5 Jan 2013.

If its not ready, no need to put it online, right? Just my Opinion.




The link kept directing to http://www.jpj.gov.my/mintamaaf for most of the options I picked.





Tuesday, August 14, 2012

Direct Apache access to SSL ports

Secure Socket Layer (SSL) provides an encrypted network connection and is seen to use the HTTPS protocol in the URL. To ensure that the web server only servers HTTPS, the following needs to be enabled before the HTTPS VirtualHost tag.



RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}:443%{REQUEST_URI}


What it means? turn off https if its https, then change the url to always use https.

Actually, you can put a lot more between the VirtualHost tag. E.g. choice of error pages to server and limiting which domain/IP address that can access the contents.

Monday, October 25, 2010

Setting up Flex on Eclipse for Linux

Flash development on Linux is done with Flex SDK. Some nice people started at FB4LINUX have provided a GUI to develop Flash on Linux and this can be integrated into Eclipse IDE.

By the time I wrote this rticle, Adobe placed a notice that they will no longer continue with the Flex Builder development. This means that you can only use command lines to work on Flex. I guess this will affect FB4LINUX.

I refer to a number of sites before starting the installation and found one worth mentioning here. Matthew wrote with clarity and did cover what most other instructions provided and maybe a bit more.

Pre-installation checks: Have you installed Eclipse 3.5+ and Java Development Kit 1.5+

Step 1. Download the fb4linux files in 4 parts from http://code.google.com/p/fb4linux/downloads/list
  • FB4Linuxaa
  • FB4Linuxab
  • FB4Linuxac
  • FB4Linuxad
Merge them together into a BZIP2 format and extract using the command prompt at the terminal. At the folder where you downloaded the 4 files, just type

cat FB4Linux* >FB4Linux.tar.bz2
bunzip2 FB4Linux.tar.bz2
tar -xvf FB4Linux.tar

I renamed the folder to Adobe_Flash_Builder4 since I did not want spaces between the folder name.

Step 2. Download the eclipse plugin for FB4Linux from http://www.brighthub.com/hubfolio/matthew-casperson/media/p/78806.aspx

Unzip the file ecplise and copy the plugins to /usr/lib/eclipse/plugins

The plugins are;
com.adobe.coldfusion.rds.client_1.0.266425.jar
javax.wsdl_1.6.2.v200806030405.jar
org.apache.commons.lang_2.3.0.v200803061910.jar
org.apache.xerces_2.8.0.v200803070308.jar
org.apache.xml.resolver_1.1.0.v200806030311.jar

Step 3. Start Eclipse and apply the plugins.

In Eclipse select Window->Preferences->General->Capabilities and make sure that the Classic Update option is checked.
Click Help->Software Updates->New Feature to Install.
Click the New Local Site button, and type in the location where you extracted FB4Linux in step 1 (you will need to specify the eclipse subdirectory to be specific).
With the Adobe Flash Builder 4 site selected, click the Finish button. You will be asked which features to install. Tick the Adobe Flash Builder 4 feature and click Next.
Accept the terms and click the Next button and click Finish button.

Restart Eclipse.

Step 4: Install the Flex SDK from http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4
Download and extract a copy of the Flex SDK from Adobe into a folder flex4.1.0

Set Eclipse to use the Flex SDK by right clicking on your Flash project and selecting Properties. Select the ActionScript Compiler option.
Click the Add button to add the location of the Flex SDK you have extracted.
Click on the Run toolbar menu item and select the External Tools Configuration option.

Right click on the Program option and select the New option. Then fill out the Location and Arguments settings to point to your Flash standalone player and SWF file respectively.

Done...next to look for more flash tutorials.

Friday, April 23, 2010

Installing ZTE MF110 on Ubuntu Linux

Maxis offered their broadband along with the ZTE's MF110 HSUPA modem. Thus far, I have not gotten a chance to get a Digi offer to try their broadband,....maybe some day.

The MF110 features
Network: HSUPA/HSDPA/UMTS 2100 MHz,EDGE/GPRS/GSM 850/900/1800/1900MHz
Data transmission speeds: 7.2Mbps DL 5.76Mbps UL
Weight: 21.5 gramme
Application: Join Air with SMS service, Data service, Applications management, Data concurrent. This allowed me to add other service providers (yet to be tested) with the same modem.


Installation on Linux KUbuntu 9.10
  1. Install wvdial from KPackageKit
  2. Plug the MF110 into the USB slot. Mount the MF110 and enter the directory "Linux"
  3. Extract "PCL_ZTEDCV.tar.gz" to your HOME directory.
  4. Open a terminal and type "sudo ./install.sh"
  5. Launch the application "Join Air" from the KMenu
  6. In Join Air, at the Internet menu (A globe icon), click "Connect". Minimise this window but do not close as its needed to maintain Internet connection.
  7. It connects directly with initial IP 121.121.X.X and tries to open the web page mylaunchpad.com.my
It defaults to the setting of
Dial number: *99#
APN: static: maxisbb
username: maxis
password: wap

Connection has been pretty much inconsistent. Its fast at times, then no connection, then have to keep reloading the page. I like its thumbdrive size and the blinking lights. The Join Air application is also easy to read and use.

Monday, February 8, 2010

MCRYPT module for PHP (RHEL5)

RHEL5.3 did not have support for the MCRYPT module that many PHP applications use to create basic security. Well, anyone could download mcrypt from sourceforge and recompile PHP to support this module. I found another way which I hope also will work for you;

Step 1: Login as admin and install MCRYPT
yum install mcrypt

Step 2: Install epel
http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
rpm -Uvh epel-release*.rpm

Step 3: Install the module
yum install php-mcrypt.i386

Step 4: Restart Apache
service httpd restart

Confirmation of the installed module can be found from the phpinfo() page. The module I had included cipher for
cast-128
gost
rijndael-128
twofish
arcfour
cast-256
loki97
rijndael-192
saferplus
wake
blowfish-compat
des
rijndael-256
serpent
xtea
blowfish
enigma
rc2
tripledes

Sunday, December 20, 2009

Enable user directories in Apache2

Its been a while since Apache2 was introduced. The configurations are found in apache2.conf and user specific settings can be added to httpd.conf in the /etc/apache2 directory. One major difference from previous version is the method to enable the user directory modules.

The Linux users can have their individual websites but this needs to be enabled and the web server restarted. At the command line type

sudo a2enmod userdir
sudo /etc/init.d/apache2 restart

This enables the Userdir module in /etc/apache2/mods-enabled/userdir.conf and users can create pages in the directory /home/username/public_html
This is managed by the directive

<directory /home/*/public_html>


Other basic configurations can be
  1. Disable a user from serving webpages (e.g. root and user1)

    Userdir disabled root user1

  2. Access URL as http://servername/~username

    Userdir public_html

  3. Access URL as http://servername/web/username

    Userdir web

Friday, April 17, 2009

Encrypting passwords for web applications

Just heard about security concerns and username/passwords being scanned over the network. This is the weakness of the HTTP protocol. One solution is to use the HTTPS with OpenSSL.

With reference to http://www.centos.org/docs/5/html

Step 1: Install the SSL components
yum install mod_ssl openssl

Step 2: Create the certificates
openssl req -new -key ca.key -out ca.csr
openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
mv ca.crt /etc/pki/tls/certs
mv ca.key /etc/pki/tls/private/ca.key
mv ca.csr /etc/pki/tls/private/ca.csr

Step 3: Configure Apache to use the certificates
vi /etc/httpd/conf.d/ssl.conf

Search for the SSLCertificateFile and SSLCertificateKeyFile lines and point it to the correct TLS directory.

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/tls/certs/ca.crt
# nicholas

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/private/ca.key

Restart apache server

service httpd restart

Step 4: Assign Apache to use a secure folder for the HTTPS while redirecting the port 80 of the HTTP to another folder.
vi /etc/httpd/conf/httpd.conf

NameVirtualHost *:80

</virtualhost *:80>
<directory>
AllowOverride All
</directory>
DocumentRoot /var/www/html
ServerName servername.com
</virtualhost>

NameVirtualHost *:443
<virtualhost *:443>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
<directory>
AllowOverride All
</directory>
DocumentRoot /var/www/vhosts/servername/httdocs
ServerName tservername.com
</virtualhost>


Restart Apache server. The virtual host can be verified with the command

httpd -S

Step 5: Test the HTTPS and HTTP
Use a web browser to access with HTTP and HTTPS, both should point to different directory.

Certain web browsers do not know about cacert as a validation server. This can be done easily with following steps.

Step 1. Download from www.cacert.org the Root Certificates for class 1 and 3 PKI keys.
Step 2. Use firefox to add these root keys.
Choose edit ->Preferences ->Advanced ->Encryptions ->View Certificates
Choose Authorities ->Import
Choose both of the root keys that was downloaded
Step 3. Restart the web browser.

Monday, December 8, 2008

Shopping - What web server are used?

Below is a list of shopping websites in Malaysia and the Web server its hosted on (8 Dec 08). It is in no particular order:
Apache 1 / Cayote:
  1. Beautyholicsanonymous
  2. Cari.com.my
  3. IreneLim
  4. EOE Online
  5. Malaysia Central
  6. Mydin
  7. My1stop

Apache 2:
  1. Annexe Gallery
  2. Everyday
  3. MyPDACafe
  4. Shoppingnsales
  5. Offernutz
  6. Real Mart
  7. Street Directory
  8. TimeOut
  9. The Curve
  10. Xerie
MS IIS 5:
  1. BlueHyppo
  2. Sungei Wang Plaza
  3. Sunway Pyramid
MS IIS 6:
  1. 1 Utama
  2. 121motor
  3. All99.com
  4. All Malaysia
  5. Axcess
  6. Business.com.my
  7. Ikea
  8. KUL
  9. Metrojaya
  10. Mines
  11. Motor Trader
  12. Ultimate Toys
  13. VirtualMalaysia
  14. VisionKL
Zope
  1. Berjaya Times

However, I am using a method to detect web servers that is not guaranteed corect all the time.

Wednesday, November 26, 2008

Kubuntu 8.10 with Apache2, PHP 5 and MySQL5

In order to resume testing and developing web based application, I needed PHP, MySQL and Apache to complete the LAMP stack. Default Kubuntu 8.10 did not include those.

Steps taken.
1. Install Apache2 web server
sudo apt-get install apache2

2. Install PHP5 and enable the PHP5 in Apache
sudo apt-get install php5 php-pear
a2enmod php5

3. Install MySQL server
sudo apt-get install php5-mysql libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql

This requires the setup of MySQL root password.

4. Install the Apache and MySQL documentations
sudo apt-get install apache2-doc mysql-doc-5.0

5. Enabled the user public_html directory
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/userdir.load
sudo ln -s ../mods-available/userdir.conf

6. Steps to install the training application
  1. Create the database "example.db"

  2. Insert into the database with the script.
    mysql -u root -p example.db < mysqldata.sql

  3. Add the mcrypt tools.
    sudo apt-get install libmcrypt4 php5-mcrypt

  4. Add the MySQL pear libraries.
    sudo pear channel-update pear.php.net
    sudo pear install Auth_HTTP
    sudo pear install pear/MDB2#mysql

  5. Test the application.

Tuesday, September 30, 2008

Spam, Scam and Hoaxes

Internet, Email and other forms of Online tools are increasingly getting accessible to all level of users. This includes the students, teachers, housespouse (i thought housewifes may soon be subjective), business person, security guards, cleaners and other professions.

There are some out to take advantage of the new comers, ignorant or busy Internet people with these new technologies. The ideas may be as old as the Ford T but many people still find themselves a victim. As a start, if any thing on the Internet is doubtful or sound too opportunistic there are some web sites that list common issues.

  1. Hoax-Slayer (http://www.hoax-slayer.com )
  2. Scambusters (http://www.scambusters.org )
  3. Sophos (http://www.sophos.com)
There are many more sites, but the list above is a start.

Tuesday, April 29, 2008

Firefox 2 could not display Joomla! popups

The problem
I have just update Firefox (via Ubuntu Gnome update tools). Problem occured when I tried to edit my web content using Joomla 1.0 and the text editor choosen was;
TinyMCE result: The editor menu buttons dont appear at all
JoomlaFCK result: The pop up box for links, anchor, insert image and others appear blank

In previous Firefox 2.0.0.12, things look fine for TinyMCE and JoomlaFCK editor.

I am using Firefox 2.0.0.13 on Ubuntu 7.10:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080325 Ubuntu/7.10 (gutsy) Firefox/2.0.0.13

Solution
Upgrade to Firefox 2.0.0.14 or newer. Firefox 3 at the moment is still in beta, so I decided to give it a pass for now.

Friday, April 25, 2008

Using Apache to forward request

I am getting complaints from users that the mail server is not accessible from outside the local network due to the port number being block at other networks. My mail server is using port 8383 for webmail. Following steps allow my webmail to be accessed without needing to change the mail server settings.

The Plan
I need to setup an apache 2 on Linux and later reroute the DNS to use this new sever. All this using mod proxy in Apache.

What is mod proxy? see Apache site
"A typical usage of a forward proxy is to provide Internet access to internal clients that are otherwise restricted by a firewall. "

In this example my mail server details:
servername: mail.myserver.com.my
serverip: 192.93.20.3

STEP 1: Setting up the mod proxy on 192.93.20.4
My proxy is on CentOS 5.1 with Apache 2 (httpd-2.2.3-11.el5_1.centos.3)
  1. Install a Linux with Apache 2 and open the httpd.conf file

    vi /etc/httpd/conf/httpd.conf

  2. Make sure you have the following LoadModule lines (it waas there)
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so

Go to section three of the file and add

ServerName mail2.myserver.com.my
ProxyPass / http://firewall.myserver.com.my/
ProxyPassReverse / http://firewall.myserver.com.my/
RewriteEngine On
RewriteRule ^/$ http://mail.myserver.com.my:8383/ [P]



STEP 2: Redirect DNS
  1. Configure the DNS to accept mail2.myserver.com at the new server 192.93.20.4 which defaults to port 80
-

Blog Archive