Sunday, May 11, 2014

OpenDNS provides a way to secure your internet so that kids will not be allowed to visit sites YOU don't want them to visit.

Frankly speaking I don't know how effective this is because if they have laptop and they connect to internet from sat StarBucks. There's no way you can control which sites they visit when they are their. Or limiting their access to social networking sites like Facebook.

However if your goal is to protect them when they are on your network then read on.

You need to subscribe to OpenDNS package and configure your access on OpenDNS Website.
e.g. If you are pretty strict you would restrict ALL Email sites which blocks access to Gmail, Yahoo Mail and all well known email websites.

The next task is to tell your router to redirect requests to ALL domains to OpenDNS servers rather than say Google or your ISP DNS servers so that OpenDNS could actually filter results based on your restrictions rather than being open to the world.

Here's the screenshot of settings under OpenWRT. Ignore the last 2 entries, those are actually Google DNS servers and remember that listing dozens of DNS servers is actually useless. Only first 3 entries will be used to resolve the Website IP addresses.






One would think that we are done at this step. But then we will be underestimating the kids. Because every computer maintains the DNS servers the computer can talk to regardless of what the router configuration says.

Which means configuring each machine to use 192.168.1.1 or the router as the DNS server. That works very well too until the Computer users can modify the list of DNS servers on Linux it's /etc/resolv.conf where the list of DNS servers can be provided thus bypassing the settings at router.

For that OpenDNS has a solution. Configure the firewall to REJECT all requests to outside DNS servers.

Configure the router to REJECT any TCP+UDP requests from any host in the LAN to any host in WAN on port 53. Thus if DNS servers are using the standard port 53, no hosts in your network can send requests to them.

Again if you are using OpenDNS this can be achieved by going to Network -> Firewal -> Traffic Rules and creating a new rule shown in the picture below.


Once you create the new rule do not forget to Save and Apply under OpenWRT.

Good luck!

Thursday, April 24, 2014

Unite.vim is quite useful

For several days I had been using Unite.vim plugin to navigate through the project files. It's quite useful.

After installing plugin my ~/.vimrc contains the following code ( I found somewhere on the web )

  " Unite : http://www.codeography.com/2013/06/17/replacing-all-the-things-with-unite-vim.html  
  let g:unite_source_history_yank_enable = 1  
  call unite#filters#matcher_default#use(['matcher_fuzzy'])  
  nnoremap <leader>t :<C-u>Unite -no-split -buffer-name=files  -start-insert file_rec/async:!<cr>  
  nnoremap <leader>f :<C-u>Unite -no-split -buffer-name=files  -start-insert file<cr>  
  nnoremap <leader>r :<C-u>Unite -no-split -buffer-name=mru   -start-insert file_mru<cr>  
  nnoremap <leader>o :<C-u>Unite -no-split -buffer-name=outline -start-insert outline<cr>  
  nnoremap <leader>y :<C-u>Unite -no-split -buffer-name=yank  history/yank<cr>  
  nnoremap <leader>e :<C-u>Unite -no-split -buffer-name=buffer buffer<cr>  
  " Custom mappings for the unite buffer  
  autocmd FileType unite call s:unite_settings()  
  function! s:unite_settings()  
   " Play nice with supertab  
   let b:SuperTabDisabled=1  
   " Enable navigation with control-j and control-k in insert mode  
   imap <buffer> <C-j>  <Plug>(unite_select_next_line)  
   imap <buffer> <C-k>  <Plug>(unite_select_previous_line)  
   imap <silent><buffer><expr> <C-t> unite#do_action('tabopen')  
   imap <silent><buffer><expr> <C-v> unite#do_action('vsplit')  
   imap <silent><buffer><expr> <C-x> unite#do_action('split')  
  endfunction  

Find a file somewhere in the source code.

Today I find another feature of Unite.vim, searching files.

It turns out you don't need to know which directory the file is in under your source code. Just



<Leader>f
**/*obj.pm

and Unite will display the matched files.
 

Tuesday, April 22, 2014

tmux + bash - C-a to move to the start of command line.

Recently I compiled tmux on the development server when I got tired of trying to find a good terminal multiplexer which I could use confortably.

Don't get me wrong ConEmu is a terminal as good as it gets on Windows.

I've tried several of them following are a few of them
  • Putty Connection Manager
  • Poderosa - Development on this one seems to have been stalled quite a while back.
  • mrxvt - Compiled on Cygwin, this was working fine and probably the longest one I used. But it doesn't support Unicode and there's no plan of supporting it as well. If you just want the multiple TABS with a single window, this should be the choice.
For one reason or the other they fell short. None of the above do more than giving you a TABBED interface like "gnome-terminal" or KDE "konsole".

Then I found ConEmu and it's simply great! Although I could not find a key to set CTRL-Arrow to move from one tab to another.

Bugged me a lot! And hence compiling "tmux" on the Linux server so that I can use it.

"tmux" is great although comes with a default Key Prefix C-b. GNU screen uses CTRL-a as a Prefix key.

If you are like me, I use C-a a lot to move about on the command prompt. Once you bind C-a in ~/.tmux.conf as prefix to "tmux" commands you can't seem to use it.

So if I define the following in ~/.tmux.conf 

unbind C-b
set -g prefix C-a    # I loose the ability to use C-a to move to the start of the line. 

How to use C-a mentions the following tmux configuration to be able to use familiar shortcut.

bind a send-prefix




And now one can use "C-a a"  to do the same trick.

Just in case you want to see what tmux looks like? Here's the screenshot.

tmux running under ConEmu!