Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • webscriptz 2:40 pm on June 9, 2014 Permalink | Reply
    Tags: cent6, , connection, eth0, , ifconfig, , networking, ,   

    CentOS 6 minimal install on VM – network connection 

    Just installed CentOS 6 and by default the eth0 is not connected in the VM, even if the VM configuration indicates it is connected. You’ll see this when you cat /etc/sysconfig/network-scripts/ifcfg-eth0. Note all these actions are executed as the root user.

    DEVICE="eth0" HWADDR=MAC Address*System MAC* NM_CONTROLLED="no" ONBOOT="no" BOOTPROTO="dhcp"

    So you need to do the following to correct the issue.

    nano /etc/sysconfig/network-scripts/ifcfg-eth0

    Edit the contents of that file to end up having this:

    DEVICE="eth0" HWADDR=MAC Address*System MAC* NM_CONTROLLED="no" ONBOOT="yes" BOOTPROTO="dhcp"

    Then save (CTRL + x, yes and enter, enter) and then reboot:

    reboot

    CentOS will do the rest for you.

     
  • webscriptz 10:58 pm on February 4, 2014 Permalink | Reply
    Tags: , , , iptables, , , remote access, selinux, , tigervnc, vnc, vncserver   

    Vnc Server on CentOS 6.x 

    Thank to: http://wiki.centos.org/HowTos/VNC-Server#head-86a610f73b0fa6b5ecf2fe40f0bb301ea0038a26 for the incredible tutorial and reference material!

    1. Installing the software packages

    The server package is called ‘vnc-server’. Starting for a clean slate, install it with the command: yum install vnc-server.

    Make sure to install a window manager in order to get a full-featured GUI desktop. Gnome, Mate, KDE or XFCE.

    2. Create the VNC user accounts

    If you want to have it just for your user, meaning the regular desktop user that you use for the desktop, you can skip this.

    As a root user:

    $ su root
    # useradd userOne
    # passwd PssswdOn

    3. Edit the server configuration

    Edit /etc/sysconfig/vncservers, and add the following to the end of the file.

    [root@localhost]# cat /etc/sysconfig/vncservers
    # The VNCSERVERS variable is a list of display:user pairs.
    #
    # Uncomment the lines below to start a VNC server on display :2
    # as my 'myusername' (adjust this to your own).  You will also
    # need to set a VNC password; run 'man vncpasswd' to see how
    # to do that.  
    #
    # DO NOT RUN THIS SERVICE if your local area network is
    # untrusted!  For a secure way of using VNC, see this URL:
    # http://kbase.redhat.com/faq/docs/DOC-7028
    
    # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
    
    # Use "-localhost" to prevent remote VNC clients connecting except when
    # doing so through a secure tunnel.  See the "-via" option in the
    # `man vncviewer' manual page.
    
    # VNCSERVERS="2:userOne"
    # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

    4. Set your users’ VNC passwords

    Switch user into the account for each user, and as noted below, run: vncpasswd This will create the .vnc directory for that userid:

    [~]# su - userOne
    [~]$ vncpasswd
    [~]$ cd .vnc
    [.vnc]$ ls
    passwd
    [.vnc]$ exit

     5. Confirm that the vncserver will start and stop cleanly

    We will create the xstartup scripts by starting and stopping the vncserver as root. We also enable the vncserver service to be automatically started. You can always do this through the services gui application in system ->administration.

    # /sbin/service   vncserver start
    # /sbin/service   vncserver stop
    # /sbin/chkconfig vncserver on

    6. The iptables

    The iptables rules in /etc/sysconfig/ need to be modified to open the VNC ports; as needed, if a local ipv6 setup is being used, those need to be amended as well. first check with NIC you use to go to the internet with the server/pc.

    You need to add something similar to this: -A INPUT -i eth1 -j ACCEPT where eth0 is your NIC. Don’t skip this step or you’ll never be able to access your server!

    # Firewall configuration written by system-config-firewall
    # Manual customization of this file is not recommended.
    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -i eth1 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT
    -A INPUT -j REJECT --reject-with icmp-host-prohibited
    -A FORWARD -j REJECT --reject-with icmp-host-prohibited
    COMMIT
    [root@xen-221 sysconfig]#         

    … and then restart the iptables:
    # /sbin/service iptables restart

    7. Start the VNC server

    Start the vncserver as root. if you get an error with “display configuration” then you don’t have the .vnc directory for the user executing the start command!

    # /sbin/service vncserver start

    Now You need to test and everything should work as planned!

     
  • webscriptz 9:38 am on February 4, 2014 Permalink | Reply
    Tags: , high performance, , PHP phalcon, ,   

    Phalcon php, a serious replacement for Yii framework 

    I’ve been using Yii a lot, in various projects that I have been writing the past three years and up until now it has always delivered. However, recently I have been looking at the version 2 of the Yii Framework, while still a very nice framework, I don’t think it will be to my liking. The structure for projects is just to different en the use of composer is not my favorite thing so I have been looking for high performance frameworks written for PHP.

    Obviously all the frameworks pass through on the screen an non where really good for me. That was until I read something about frameworks in 2014 end one of them was Yii but another was Phalcon a PHP framework written in C and added to the PHP parser in the .ini file.

    Obviously this means that you’ll have to have administrative privileges on the webhost, ask the hoster to accommodate or use like Amazon aws services. In any I’ll be experimenting with the framework and see how it functions, my experiences and tutorials will be posted!

     
  • webscriptz 11:09 pm on October 14, 2013 Permalink | Reply
    Tags: clientscript, , javascript, , registerscript, , ,   

    Yii retain speed when using Javascript 

    CClientScript can be useful for including css files and javscript files, while avoiding duplication, you only need to learn and control the darn thing right.

    Before we begin or if you tried it already and have come searching for this:

    1. Yii writes the code for css files just above thetag in the html document. So, if you want to override, put your
    or (preferred) AFTER the

    2. I recommend putting all your
    and in theand all your just before . are blocking, so your page will load faster if the are at the bottom. use:

    1
    Yii::app()->getClientScript()->coreScriptPosition = CClientScript::POS_END;

    3. If you want to include some inline javascript in a view, but make it load at the bottom, after say jquery, use the registerScript() method.

    1
    /* load some formatted js into a php variable: */
    2
    $js = <<<EOF
    3
    var = 'some javascript here!';
    4
        function() { return 'you can format it as you like, and include php $variables'; };
    5
    EOF;
    6
     
    7
    /* write the script at the bottom of the document  */
    8
    Yii::app()->getClientScript()->registerScript("some id", $js, CClientScript::POS_END);

     
  • webscriptz 3:26 pm on October 13, 2013 Permalink | Reply
    Tags: dropdownlist, nestled structure, , treeview, , ,   

    Yii dropdownlist treestructure 

    A possible solution to having an tree type display of a nestled structure in a dropDownlist or activeDropDownList.

     

    01
    public static function getListModulesTreeView() {
    02
            return self::visualTree(SystemModules::model()->findAll('moduleIdFk is NULL'), 0);
    03
        }
    04
     
    05
        private static function visualTree($moduleTree, $level) {
    06
            //resultset to be returned -------------------------------------------//
    07
            $results = array(0=>Yii::t('gui', 'noSubmodules'));
    08
            // looping the data --------------------------------------------------//
    09
            if ($moduleTree) {
    10
                // looping the results -------------------------------------------//
    11
                foreach ($moduleTree as $module) {
    12
                    // adding to mail array --------------------------------------//
    13
                    $results[$module['moduleId']] = str_pad('', $level * 2, '-')  . $module['moduleName'];
    14
                    // do we have children? --------------------------------------//
    15
                    if ($module->systemModules) {
    16
                        $temp = self::visualTree($module->systemModules, $level + 1);
    17
                        // moduleId : $key ---------------------------------------//
    18
                        foreach ($temp as $key => $val) {
    19
                            $results[$key] = $val;
    20
                        }
    21
                    }
    22
                }
    23
            }
    24
            return $results;
    25
        }

     
  • webscriptz 11:05 pm on September 7, 2013 Permalink | Reply
    Tags: , ERD, , MAMP, mamp pro, models, , , reverse engeneering, uml, workbench   

    MAMP Pro & MySQL workbench 

    I’ve been looking for a few hours for a quick and easy solution to my connection problem between MySQL workbench and the database itself using MAMP Pro. In itself it isn’t a real problem because you have phpMyAdmin readily available but for ERD models and reverse engineering options. I found my answer on stackoverflow without a lot of trouble but it was a hasty answer and I like to explain a bit complete. So here goes.

    First open MAMP Pro on your Mac and you’ll see the following image

    mamp1

    See to it that your ports are the same as mine or adjust accordingly if you want to keep them.

    Next you will need to open workbench, I Presume you have it already installed in your Mac. The first thing you’ll have, is the possibility to create a connection or edit one if you have tried and failed as I have before. open or create the connection that you want to establish but can’t. You’ll get something along these lines, if not, please search for it.

    workb1

    When you have the first form filled out correctly go to ‘Advanced’ in the same window!

    workb2

    In the ‘Others’ section you will have to add a line and you’ll be good to go. You have to add: socket=/Applications/MAMP/tmp/mysql/mysql.sock and go back to the ‘Parameters’ and use ‘test connection’, normally this should have you up and running. If not, is MAMP started? Are your ports correctly configured? User/password? ….

     
  • webscriptz 7:00 pm on June 29, 2013 Permalink | Reply
    Tags: , Gii, modules, , , submodules, , , ,   

    Module and submodule in Yii framework 

    Yii framework is a very fast and usable framework, within you can create modules to house some sort of sub-applications, link a forum for example but how do you make use of sub-modules?

    First you need to create the top most modules, in my case ‘main’. You can do this by using the Gii tool to generate it. After this you need to add the created module to the config/main.php

     PHP |  copy code |? 
    01
    'modules' => array(
    02
            'gii' => array(
    03
                'class' => 'system.gii.GiiModule',
    04
                'password' => 'admin',
    05
                'generatorPaths' => array(
    06
                    'bootstrap.gii'
    07
                ),
    08
            ),
    09
            // main application components
    10
            'main',
    11
        ),

    After this you can create the submodules by using Gii, don’t forget to do it like this main/NewModuleName, the system then knows where to place them.

    And now we go back to the config/main.php

     PHP |  copy code |? 
    01
    'modules' => array(
    02
    'gii' => array(
    03
    'class' => 'system.gii.GiiModule',
    04
    'password' => 'admin',
    05
    'generatorPaths' => array(
    06
    'bootstrap.gii'
    07
    ),
    08
    ),
    09
    // main application components
    10
    'main'=>array('NewModuleName1','...'),
    11
    ),

     
  • webscriptz 9:58 am on June 15, 2013 Permalink | Reply
    Tags: bookmarks, , FF, , , mozilla, newtabpage,   

    Firefox: new tab page tweak 

    I use Firefox daily in my browsing and i like the new tab page a lot but 9 sites doesn’t cut it for me anymore so it was time to tweak things a bit.

    Firefox uses an internal database to store it’s configuration values an that’s where you’ll need to go: type in the address bar: “about:config”. Firefox will warn you and just click “ok” but be careful anyway. now search for “browser.newtabpage.”, there you’ll have not more then 10 results, search for rows and columns with their standard value 3. 

    You’ll want to have a grid, I did the following, columns = 5 and rows = 4, everything is smaller but still readable and not more taxing on the browser itself.

    about.config thumbnails

     
  • webscriptz 8:16 pm on May 27, 2013 Permalink | Reply  

    Windows SBS 2008 

    To make hibernation unavailable, follow these steps:

    1. Click Start, and then type cmd in the Start Search box.
    2. In the search results list, right-click Command Prompt, and then click Run as Administrator.
    3. When you are prompted by User Account Control, click Continue.
    4. At the command prompt, type powercfg.exe /hibernate off, and then press Enter.
    5. Type exit, and then press Enter to close the Command Prompt window.

    To make hibernation available, follow these steps:

    1. Click Start, and then type cmd in the Start Search box.
    2. In the search results list, right-click Command Prompt, and then click Run as Administrator.
    3. When you are prompted by User Account Control, click Continue.
    4. At the command prompt, type powercfg.exe /hibernate on, and then press Enter.
    5. Type exit, and then press Enter to close the Command Prompt window.
     
  • webscriptz 11:56 am on May 6, 2012 Permalink | Reply
    Tags: censorship, debian, , , , , tor, tor-project, , vidalia, vpn   

    Tor: Vidalia Tor software exited unexpectedly 

    With the latest developments in internet censorship I too have been looking for secure alternatives and the Tor project is one of them but unfortunately I had a small problem with Vidalia, the software GUI for Tor. I discovered a solution after some reading and Google-ing.

    After installing Tor on ubuntu or other Debian based distributions and running it for the first time you probably are getting the following error:

    Vidalia detected that the tor software exited unexpectedly.

    Please check the message log for recent warning or error messages.

    Alright, now on to the solution. You best open up a terminal because it’s going to require some command-line work, first thing you should do is make sure that everything Tor isn’t running anymore, so copy/past this in your terminal:

     Bash |  copy code |? 
    1
    sudo killall tor

    and enter your password when asked after having hit the ‘enter’ button. Don’t exit the terminal window just yet because you’ll need it a bit more. Now that you have killed off all the possible running tor-processes you can fix the real problem.

    Upon installation, tor will automatically starts up when booting Ubuntu. When you open Vidalia, it will first check if there is an existing tor process and try to connect to the control port of tor. All you need to do is reconfigure tor so it allows Vidalia to connect and start using the tor process correctly without throwing the error.

    First step: is to open the configuration file of tor. Open a terminal and execute the following command: (note: sudo is required or you won’t be able to save the file later on)

    sudo gedit /etc/tor/torrc

    Gedit is standard installed on Ubuntu and a lot of other distributions, and my favorite but if you have another just replace gedit by that one in the command-line. Also check your preferences so that the editor displayed line numbers it will make this easier.

    After the file opens, scroll down to line 53 to line 60 and you will see something like this:

     Bash |  copy code |? 
    1
    ## The port on which Tor will listen for local connections from Tor
    2
    ## controller applications, as documented in control-spec.txt.
    3
    #ControlPort 9051
    4
    ## If you enable the controlport, be sure to enable one of these
    5
    ## authentication methods, to prevent attackers from accessing it.
    6
    #HashedControlPassword 16:872860B76453A77D60CA2BB8C1A7042072093276A3D701AD684053EC4C #CookieAuthentication 1

    Now modify this so that you have something that looks like this:

     Bash |  copy code |? 
    1
    ## The port on which Tor will listen for local connections from Tor
    2
    ## controller applications, as documented in control-spec.txt.
    3
    ControlPort 9051
    4
    ## If you enable the controlport, be sure to enable one of these
    5
    ## authentication methods, to prevent attackers from accessing it.
    6
    HashedControlPassword 16:D11E80307FCD1E730083FA68F6650BDBC2FE1D3BA100C07A7895CFC4D1
    7
    #CookieAuthentication 1

    What have you done? You set the control port so vidalia can take control of tor and you initiated the password authentication. Now you just have to run one other command, so open a secondary terminal, you’ll need it because your current one is running gedit.

     Bash |  copy code |? 
    1
    tor --hash-password mypassword

    Now the result of this command is something like this: (note: don’t past my result, make your own for security reasons)

     Bash |  copy code |? 
    1
    webscriptz@webscriptz-hp:~$ tor --hash-password mypassword
    2
    May 06 12:49:45.190 [notice] Tor v0.2.2.35 (git-73ff13ab3cc9570d). This is experimental software. Do not rely on it for strong anonymity. (Running on Linux x86_64)
    3
    16:E499E055BC335107609A1E2A0D857422E238376BEA3B75F35E50C376A6

    This part you need is :

     Bash |  copy code |? 
    1
    16:E499E055BC335107609A1E2A0D857422E238376BEA3B75F35E50C376A6

    You need to insert this on line 68 after:

     Bash |  copy code |? 
    1
    HashedControlPassword 

    Now for the final step you need to restart Tor:

     Bash |  copy code |? 
    1
    sudo /etc/init.d/tor restart

    Now open vidalia and start Tor, it should work, if not close vidalia and re-open it again and everything should be fine.

     
    • Jose Salis 3:55 am on May 3, 2014 Permalink | Reply

      I have a question, in the last step, restarting tor. It displays the following:

      [FAIL] Checking if tor configuration is valid … failed!
      May 02 22:18:53.561 [notice] Tor v0.2.3.25 (git-3fed5eb096d2d187) running on Linux.
      May 02 22:18:53.561 [notice] Tor can’t help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
      May 02 22:18:53.562 [notice] Read configuration file “/etc/tor/torrc”.
      May 02 22:18:53.565 [warn] Failed to parse/validate config: Unknown option ’16:80E05F4A94CD222760A4916B0E332DF55E9D9CC86237A5219E9E492222′. Failing.
      May 02 22:18:53.573 [err] Reading config failed–see warnings above.

      I perform all the steps right, and open Vidalia me the same error, can you help me?

    • webscriptz 10:48 pm on May 25, 2014 Permalink | Reply

      My first reaction would be to look for trailing spaces and characters that are in the configuration file, please remove any you find.

      If this doesn’t help, try to remove your tor installation, preform apt-get auto-clean within the consolde and download the tor bundle from the official source. While I haven’t gotten the same error you have encountered, the ubuntu tor repo isn’t always the most reliable installation. Also the ubuntu version you are using is important I tested this with 12.04 I think, newer Ubuntu versions are already available so maybe the problem is elsewhere?!

      I hope it helps you :)

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel