Sunday 18 November 2012

Allow Gigabyte GA-EP45-DS4 to boot up with AHCI enabled

If your computer is failing to boot and hangs during AHCI enumeration with a possible code 23 in the top right corner, and it only happens when (1 or more) SATA HDD are connected that have a MBR (Master Boot Record), this may fix it for you, as it did for me:
  • Turn off computer.
  • Disconnect (not-really-)faulty HDD.
  • Turn on computer.
  • In BIOS, disable AHCI:
    • BIOS > Integrated Peripherals > SATA AHCI Mode = Disabled
  • Save changes and turn off computer.
  • Reconnect (not-really-)faulty HDD.
  • Turn on computer.
  • Boot in to operating system of your choice. e.g. Linux
  • Open (not-really-)faulty HDD in a hex editor. e.g. hexcurse /dev/sda
  • Set the 3 bytes starting at offset 0x1C3 to FE FF FF, save and quit.
    • You may wish to make a note of the original values you're replacing in case you need to undo.
  • If using Arch Linux, add ahci to mkinitcpio.conf modules list and rebuild kernel image
  • Reboot, in bios enable AHCI again, save and reboot
There is an error in the BIOS/AHCI controller ROM that has been reported to Gigabyte, but whether they've released BIOS updates for all affected motherboards is a mystery. For example, there's a "beta" bios update for my motherboard, but without a changelog I'm hesitant to install it.

References:
http://forum.giga-byte.co.uk/index.php?topic=8585.0
https://wiki.archlinux.org/index.php/AHCI
http://forums.tweaktown.com/gigabyte/42356-removing-ahci-option-rom.html
http://forums.tweaktown.com/gigabyte/28441-gigabyte-latest-beta-bios-2.html

Thursday 8 November 2012

Startup script for DD-WRT to get date from NTP server.

May or may not work:


while [ "`date +%Y`" == "1970" ]; do
 ntpclient uk.pool.ntp.org && \
 sleep 3 && \
 stopservice process_monitor && \
 sleep 3 && \
 startservice process_monitor;
 echo "done" >> "/tmp/ntp.example.txt" && \
 sleep 120;
done;
echo "end" >> "/tmp/ntp.example.txt"


Reference:

Monday 26 March 2012

Kippo SSH Honeypot on Ubuntu 11.04

Rough install guide:

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean
sudo apt-get install subversion python-twisted-conch
sudo useradd -r -s /bin/false --uid 497 kippo
svn checkout http://kippo.googlecode.com/svn/trunk/ ./kippo
sudo mv kippo/ /opt/
cd /opt/kippo/
cp kippo.cfg.dist kippo.cfg
sudo chown -R kippo:kippo /opt/kippo

Upstart job:

/etc/init/kippo.conf
start on started networking

pre-start script
  iptables -N SSH_FAKE || iptables -F SSH_FAKE
  iptables -A INPUT -p tcp --dport 2222 -m state --state NEW -j SSH_FAKE
  iptables -A SSH_FAKE -m recent --name ssh_attempt --rcheck --seconds 60 --hitcount 3 -j DROP
  iptables -A SSH_FAKE -m recent --name ssh_attempt --set
end script

script
  exec start-stop-daemon -S -c kippo -d /opt/kippo -x /usr/bin/twistd -- -ny kippo.tac -l log/kippo.log
end script

post-stop script
  iptables -D INPUT -p tcp --dport 2222 -m state --state NEW -j SSH_FAKE || true
  iptables -F SSH_FAKE && iptables -X SSH_FAKE || true
end script