May 302013
 

A shell script that keeps running rsync in a loop until a file is created to stop it. Obviously not the right way to do such things, but good enough for a quickie.

Create /tmp/stoprsync to stop it. rsync --status is needed in order to check if any files were transferred the previous run.

Apr 072013
 
  • If you have:
  • % VBoxManage  list extpacks
    Extension Packs: 1
    Pack no. 0: VNC
    Version: 4.2.6_OSE
    Revision: 82870
    Edition:
    Description: VNC plugin module
    VRDE Module: VBoxVNC
    Usable: true
    Why unusable:

  • Then you most likely don’t need:
  • % VBoxManage setproperty vrdeextpack VNC

  • Just set per virtual machine settings:
  • % VBoxManage modifyvm test --vrdeproperty VNCPassword=somepass
    % VBoxManage modifyvm test --vrdeauthlibrary null
    % VBoxManage modifyvm test --vrdeport 1501
    % VBoxHeadless -s test &

  • Set vrdeextpack to VNC only if you have other extention packs installed.
  • Apr 022013
     

    How to redirect something like “www.example.orgto “www.example.com“, or “longer.subdomain.example.org” to “longer.subdomain.example.com” with a rewrite rule in nginx.conf:

    Continue reading »

    Mar 292013
     

    Overview

    This post covers building a server that will be used to update both ports and the base system on FreeBSD backend servers that don’t have access to the Internet. For ports it will use poudriere combined with the new pkgng package manager in order to build packages that will be distributed to the other servers using Nginx. Since Nginx is already there it will be used as a forward proxy, as opposed to reverse proxy as it’s usually used, to http://updates.freebsd.org and http://pkgbeta.freebsd.org. This covers freebsd-update and installing pkg on FreeBSD 9.X. For no good reason, just to do something different, there’s a cron job that runs every day and fetches auditfile.tbz from http://portaudit.freebsd.org if it’s changed, so that pkg audit can do it’s job properly. In order to remotely install the servers they are PXE booted into a net install image, mfsbsd, base install files are mirrored on the package repository and served by Nginx. With that, the environment is complete, servers can be installed and kept up to date without giving them any kind of access to the Internet.
    Continue reading »

    Mar 282013
     

    Throwing this here mostly for myself. After repeated failures at installing FreeBSD 9.1 straight on ZFS, mostly because of typos, I decided to create a script to do it. It will probably be superfluous soon as FreeBSD 10 should be able to do it from the installer. There might be typos inside the script too.
    I copied the script to an USB stick, booted from the FreeBSD cd, dropped into a shell, mounted the USB stick under /tmp/whatever (do NOT mount anywhere under /mnt), removed the exit line at the beginning and executed.
    It creates partitions, installs FreeBSD, modifies loader.conf, rc.conf, periodic.conf and fstab and exits. Server should be ready for reboot at this point. Compiled from several HOW-TOs around the Internet.
    Continue reading »

    Mar 182013
     

    Problem: setting CARP on an interface that is set by DHCP on FreeBSD leaves the carp interface locked in INIT state after reboot:

    results in:

    No IP on carp0, the interface isn’t working.

    Solution: add synchronous_dhclient="YES":

    Alternatively:

    RTFM: “By default, DHCP configuration on FreeBSD runs in the background, or asynchronously. Other startup scripts continue to run while DHCP completes, speeding up system startup.”

    Feb 212013
     

    Sep 212012
     

    The time zone settings in Windows are kept in registry, in two places. One has a list of all available time zones and their settings and the other has the currently set time zone. When the zone changes Windows copies the proper settings from the list to the current settings key.
    The list of time zones is kept under
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
    The current zone is set in
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

    So, here are a few ways of doing that.
    Continue reading »

    Jul 192012
     

    SpamhausDROP (Don’t Route Or Peer) and EDROP lists are sets of IPs controlled by bad people. Basically IPs that are very likely going to cause trouble so might as well block them completely. Details.

    The following script will load a pf table with these networks. It will get drop.txt and, if uncommented, edrop.txt, cut the comments, compare to the existing list, if different flush the table and add the new blocks, then kill all existing connections to bad IPs.
    Continue reading »