Monday, August 27, 2012

UBUNTU: IPTABLES

Reference site:
https://help.ubuntu.com/community/IptablesHowTo

Basic Commands

Typing
sudo iptables -L -t nat
lists your current nat rules in iptables. If you have just set up your server, you will have no rules, and you should see

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Basic Iptables Options
Typing
sudo iptables man
lists the iptables manual

CASE: Redirect port 443 to port 8443 not working
CAUSED: IP server change, server reboot.

Solution:

    1. To reset iptables
      # iptables -L -t nat    to list nat rules
      # iptables -t nat -F    to flush nat  
      # iptables -L -t nat   after flush list nat will empty
    2. Run iptables command
      iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination server_local_ip:8443
    3. Check back the nat list.
      # iptables -L -t nat
      It will show like this:
      Chain PREROUTING (policy ACCEPT)target     prot opt source               destination
      DNAT       tcp  --  anywhere             anywhere             tcp dpt:https to:Server_IP:8443
    4. Test run the https site without port 8443.
      https://sso.domain.com:8443  become   https://sso.domain.com
    5. Save iptables rule in firewall.conf
      # iptables-save > /etc/firewall.conf
    6. Check the rule save or not in firewal# more /etc/firewall.conf
      **Make sure the date is current date:
       
      # Generated by iptables-save v1.4.12 on Mon Aug 27 07:58:04 2012
    7. Reboot server
    8. Test to run the https site again.
      https://sso.domain.com

    9. Finish.

    Friday, August 3, 2012

    Windows 2008: CRM Server Problem - No internet connection after electrical failure shutdown

    Case: CRM Server - Cannot remote & No internet connection after electrical failure shutdown

    Study case:
    One of the components of the Internet connection on your computer is a built-in set of instructions called TCP/IP. TCP/IP can sometimes become damaged or corrupted. If you cannot connect to the Internet and you have tried all other methods to resolve the problem, TCP/IP might be causing it.

    Because TCP/IP is a core component of Windows, you cannot remove it. However, you can reset TCP/IP to its original state by using the NetShell utility (netsh). 


    Recommended solutions:
    1. Logged on to the computer as an administrator.
    2. Type cmd in the Start Search
    3. Type netsh winsock reset at the command prompt, and then press ENTER.
      >
      netsh winsock reset
      *Note If the command is typed incorrectly, you will receive an error message. Type the command again. When the command is completed successfully, a confirmation appears, followed by a new command prompt. Then, go to step 3.
    4. Type exit, and then press ENTER.

    Wednesday, August 1, 2012

    VMWare Server: Cloning a virtual machine in vSphere fails with the error Number of virtual devices exceeds the maximum for a given controller

    I just happen to clone one new virtual server, but unluckily got this error.
    Cloning fails at approximately 90% on the vSphere client with an error message:
     
    Number of virtual devices exceeds the maximum for a given controller


    Solution:
    This issue occurs when the following check box is selected as a cloning option in vCenter 4.0 and vCenter 4.0 Update 1:

    Edit Virtual hardware (Experimental) To resolve this issue, clone the virtual machine again, without selecting the Edit Virtual hardware (Experimental)option.
     
    .

    Tuesday, July 31, 2012

    MySQL: HOW TO GET THE DATABASE SIZE FROM THE MYSQL QUERY

    Run the below query you can get the Data Base Size in MySQL. 
    If you run the query which is given below in MySQL Query Browser then you will get the two columns first will display the Data Base Name and the second will display the Data Base Size in MB.

    mysql# SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;


    And if you want to know How to view the Free space available for my Data Base in MySQL?
    Run the below query:


    mysql# SELECT table_schema "Data Base Name", 
    sum( data_length + index_length ) / 1024 / 
    1024 "Data Base Size in MB", 
    sum( data_free )/ 1024 / 1024 "Free Space in MB" 
    FROM information_schema.TABLES 
    GROUP BY table_schema ;

    .

    Tuesday, July 24, 2012

    Strange problem. keyboard ???

    Case: I can't type U using my keyboard, it will popup Utility Manager each time.
    Today, I can't use L to type my password. What happen?? When i press 'L' key, it Locked my session.


    I search in Google, then found same problem like me.
    http://en.kioskea.net/forum/affich-11475-strange-problem-keyboard

    But for me, after i press windows key without any additinal key... .  it suddenly ok. Miracle!

    .

    MySQL: How to Unblock with 'mysqladmin flush-hosts' Mysql 5 and greater

    MySQL Error : 
    wrong authentication (username or password incorrect)
    too many connections from same machine.

    Solution taken: 

    Clear with flush-hosts command.
    See http://dev.mysql.com/doc/refman/5.1/en/flush.html

    STEPS for Linux 

    Open terminal window type
    mysqladmin -uroot -ppassword flush-hosts;

    *[Remember -uroot is your root name with a "-u" before it, and same for password "-p" before password]


    Another tip 1

    ------------------------------------------
    Restarting MySQLd solves the problem. FLUSH HOSTS also wipes the internal DNS cache, so be careful with its use - a flood of reverse DNS lookups can severely limit your server’s speed!

    Open the terminal and type (for Linux)
    /etc/init.d/mysql restart 

    Another tip 2 allow many connections
    ------------------------------------------
    To increase the maximum connections that mysql allows, you must edit the file /etc/my.cnf. Log into the server as root and type

    nano /etc/MYSQL/my.cnf

    it will open the config file (depending upon your cnf file location change the path) and uncomment (remove #) to the following line with the allowed no of connections e.g.
    max_connections=10000 
    Now press CTRL+X and Yes (Y) to exit from terminal window. Now Type

    /etc/init.d/mysql restart 
    you will see on the terminal screen
    Stopping MySQL database server mysqld: [ OK ]
    Starting MySQL database server mysqld: [ OK ]
     
    CHECK THE SETTING IS PROPER OR NOT...
    
    If you'd like to check to see if this setting was successfully applied, you may check using one of the following methods: 
    1. login to mysql
      mysql -uadmin -ppassword
      or through mysql administrator tool (Go to tools->MySQL text Console), you will be at the "mysql>" prompt. 
    2. Then give the command
      show variables like 'max_connections'; 
      make sure you put the semi-colon on the end. To exit mysql, use the "quit" command

      .

    Monday, July 16, 2012

    CAS Jasig in Ubuntu: Login Issue

    Case: Cannot login to ldap after done configuration in Tomcat6.

    Solution steps:

    1. Check tomcat log
        # cd /var/log/tomcat6

        # grep -R 443 *     <- to grep all log related to 443 port

    2. Check established port See if port 8443 established?
        # netstat -na

    3. Check LDAP log whether CAS listen/connected with LDAP server.
        # tail -f  /var/log/debug.log

    4. How to check tomcat root folder ?
        # nano  /etc/init.d/tomcat6

        From this file, you will find that root folder for tomcat in:
        CATALINA_HOME =  /usr/share/tomcat6

    5. Check the SSL Cert current location. In my case, the cert located in /root/ folder.
        The cert should move to tomcat root folder : /usr/share/tomcat6


    6. Move the SSL cert folder from /root  to   /usr/share/tomcat6/
       # cd  /root/
       # mv cert  
    /usr/share/tomcat6/

    7. Change ownership for the cert folder
        # cd 
     /usr/share/tomcat6/
        # chown -R  tomcat6:tomcat6  cert



    8. Fix the cert path in server.xml configuration file


    9. Check the deployerConfigContext.xml  for 'authenticationHandlers' setting:
        For new version of CAS Jasig, the basedn setting look like this:
        **
        
    value="cn=%u, ou=people, dc=staff, dc=company, dc=com, dc=my" 
        In our case, we missed the ou object in the property value.

    10. Restart Tomcat Server
        # /etc/init.d/tomcat6  restart



    11. Test login again & good luck. Its working in my case!


    Thank you to sifoo Saufi .... cayalah.. terbukti pemegang CCNA. Arigato...
    .