Category Archives: operating system

Best console tool for finding disk usage

Just a post to pay tribute to the awesome tool ncDu is. If you ever need to find where the lost diskspace went to use this tool.
(https://dev.yorhel.nl/ncdu)

Free up cache memory

free && sync && echo 3 > /proc/sys/vm/drop_caches && free

See what is passing though the varnish proxy without a log

First add a header to see what is going on in the varnish proxy

vcl 4.0;
 
sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    #
    # You can do accounting or modifying the final object here.
        if (obj.hits > 0) {
                set resp.http.X-Cache = "HIT";
        } else {
                set resp.http.X-Cache = "MISS";
        }
}

No we can us varnishlog to see what urls are passing as a miss!

varnishlog -q ‘RespHeader ~ “X-Cache: MISS”‘ | grep -i requrl

Generate dhparam

openssl dhparam -out /etc/nginx/ssl/dhparam.pem 4096

find large files

du -a /var | sort -n -r | head -n 10

change or add passphrase to key

ssh-keygen -f keyfile -p

go2shell

One of my favourite tools in OSX can use iTerm 2. I had to google it to find out how.
So as a reminder to myself

 

open -a Go2Shell --args config

SSHd keys only

edit the sshd_config. (most likely located at /etc/ssh)

Change

PermitRootLogin		yes
PasswordAuthentication	yes
UsePAM			yes

to

PermitRootLogin		no
PasswordAuthentication	no
UsePAM			no

*.ps1 cannot be loaded because the execution of the script is disabled on this system.

When executing a powserscript on a windows machine you can encounter the error *.ps1 cannot be loaded because the execution of the script  is disabled on this system. Please see “get-help about_signing for more details.” This nice security feature prevents us from running the script because it’s not signed.

This feature can be disable by running:

Set-ExecutionPolicy Unrestricted

Or by searching what is appropriate for your system at http://technet.microsoft.com/en-us/library/ee176949.aspx

Cisco Transparent firewall

Setting up a transparent firewall is very easy. just follow the steps below and you’re all set!

 

  1. Login to the ASA appliance.
  2. enable
  3. config t
  4. firewall transparent
  5. show firewall (check if it has been set.)
  6. interface ethernet 0/0 (set first ethernet port)
  7. switchport access vlan 2 ( set it to vlan 2)
  8. no shut (prevent it from shutting down)
  9. interface ethernet 0/1 (set first ethernet port)
  10. switchport access vlan 1 ( set it to vlan 1)
  11. no shut (prevent it from shutting down)
  12. interface  vlan 2
  13. nameif outside (name interface vlan 2 to outside – INFO: Security level for “outside” set to 0 by default.)
  14. interface  vlan 1
  15. nameif inside (name interface vlan 1 to inside – INFO: Security level for “inside” set to 100 by default.)
  16. http server enable (enable http server for asdm – optional)
  17. http 192.168.70.0 255.255.255.0 inside (set access list for http server)
  18. asdm image flash:/asdm-621.bin (load asdm image – optional)