This time server is built on a Raspberry Pi. It includes a GPS reference and a Kismet wifi scanner.


This guide starts with a basic Raspbian Lite build, connected to a wired network. Follow the RPi Initial Setup Guide to get started. A Raspberry Pi 2 or 3 may be used.

Parts List


Connect wires from the GPS breakout to the pi.

  • VIN to GPIO 5V pin 04

  • GND to GPIO GND pin 06

  • RX to GPIO TXD0 pin 08

  • TX to GPIO RXD0 pin 10

  • PPS to GPIO 27 pin 13 (to output timing PPS, for accurate clock)

Connect a pushbutton to the pi.

  • Pin 1 to GND

  • Pin 2 to GPIO 17 pin 11

timeserver bb

Connect a rooftop antenna via the SMA to u.FL adapter.

Connect a monitor mode capable USB wifi with external antenna.

GPS and Time Services

Set up GPS and Time Services as shown in GPS on Raspberry Pi 3.


Set up Kismet as shown in Kismet on Raspberry Pi. The optional GISKismet is not needed.

For IDS purposes, the more interesting log files are those which track the alerts. Validating the client MAC addresses attached to your own access points is also worthwhile.

The various Kismet alerts are documented at under Alerts and IDS.

Timeserver Code

The is intended to be launched at startup. It provides an easy to use shutdown button and starts Kismet when the system is ready.
""" main timeserver startup script
Provides a shutdown button and starts Kismet after a GPS fix.

import RPi.GPIO as GPIO
import time, datetime, logging
import gps

# Configure logging
logformat = '%(asctime)s - %(levelname)s - %(message)s'
logging.basicConfig(format=logformat, filename = logfilename, level=logging.DEBUG)

# Use the Board Pin numbers

# Pins

# Setup the Pin with Internal pullups enabled and PIN in reading mode.

def shutdown(channel):
    Calls system shutdown after a button press of more than 2 seconds
    pressed_time =
    while not GPIO.input(channel):
    dif = - pressed_time
    pressed_time = dif.seconds
    logging.debug('Pressed time = %s', pressed_time)
    if pressed_time > 2:'Button initiated shutdown')
        os.system("sudo reboot -h now")
    GPIO.add_event_detect(channel, GPIO.FALLING, callback=shutdown, bouncetime=200)

# Add button pressed event detects
GPIO.add_event_detect(BUTTON_SHUTDOWN, GPIO.FALLING, callback=shutdown, bouncetime=2000)

def main():
    """Timeserver Main"""
    # Check for valid GPS fix (mode == 3) before loading kismet
    session = gps.gps(mode=gps.WATCH_ENABLE)
    report =
    while report['class'] != 'TPV':
        report =
    while report.mode != 3:
        report =

    # Start Kismet'GPS mode 3 fix achieved')
    os.system('/usr/local/bin/kismet_server --daemonize')'Kismet server started')

    # Loop until shutdown
    while True:

if __name__ == "__main__":

Launch on Boot

Crontab is used to launch the on boot.

  • sudo crontab -e

  • Add at end of file

@reboot python /home/pi/github/RaspberryPi-projects/timeserver/ &

Check that your script is running:

  • Logfile, grep 'CRON' /var/log/syslog. The last line show the script being run.

Oct 31 15:26:32 timeserver cron[389]: (CRON) INFO (pidfile fd = 3)
Oct 31 15:26:32 timeserver cron[389]: (CRON) INFO (Running @reboot jobs)
Oct 31 15:26:32 timeserver CRON[460]: (root) CMD (python /home/pi/github/RaspberryPi-projects/timeserver/ &)
  • Process, ps aux | grep Show the process running. For this instance, the PID is 462.

root       462  0.0  0.9  21004  8896 ?        Sl   15:26   0:00 python /home/pi/github/RaspberryPi-projects/timeserver/
  • Kill process if needed, sudo kill 462. Replace 462 with your PID.


Our current NTP configuration does not serve time to clients.