Skip to content

Instantly share code, notes, and snippets.

@elvisimprsntr
Last active January 4, 2019 00:45
Show Gist options
  • Save elvisimprsntr/4409751 to your computer and use it in GitHub Desktop.
Save elvisimprsntr/4409751 to your computer and use it in GitHub Desktop.
SiriProxy running on a Raspberry Pi computer.
# $Header: /root/RCS/siriproxy-raspberrypi.txt,v 1.9 2013/11/09 08:11:00 root Exp $
# $Log: siriproxy-raspberrypi.txt,v $
# Revision 1.9 2013/11/09 08:11:00 root
# updated for latest RVM which installs dependencies and Ruby by default
#
# Revision 1.8 2013/03/22 20:41:20 root
# updated for Ruby 2.0.0 and SiriProxy 0.5.2
#
# Revision 1.7 2012/12/31 04:42:57 root
# shorter URL for newark and typos
#
# Revision 1.6 2012/12/30 05:33:40 root
# typo
#
# Revision 1.5 2012/12/30 04:29:45 root
# removed ruby p286 in rvm commands
#
# Revision 1.4 2012/12/30 01:39:53 root
# added resolv.conf edit steps
#
# Revision 1.3 2012/12/30 00:22:56 root
# typo
#
# Revision 1.2 2012/12/30 00:11:17 root
# typo
#
# Revision 1.1 2012/12/29 22:28:39 root
# Initial revision
#
# DESCRIPTION: SiriProxy running on a Raspberry Pi computer.
# AUTHOR: elvisimprsntr
# CREDITS: This file is derived from plamoni's instructions for getting SiriProxy running on a Ubuntu 11 VM: https://gist.github.com/1428474
# PREREQUISITES: A Raspberry Pi computer or equivalent device, and a router running www.dd-wrt.com open source firmware.
# ASSUMPTIONS: This instruction assumes the reader already has some basic *NIX command line and editor experience and are remotely logging in to the RPi from a *NIX based computer. It is not a BASH script, but the commands and configuration file syntax are formatted to allow one to cut and paste into a terminal window or editor.
# DISCLAIMER: This was written from notes and memory recall.
# Purchase a Raspberry Pi, optionally a pre-configured SDC, and what ever other accessories you need to provide power at: www.newark.com/Raspberry-PI
# Follow the instructions for creating an bootable SDC and booting up for the first time at: http://www.raspberrypi.org/quick-start-guide
# NOTE: Enable SSH server if you intend to run as a headless system.
# Since I am running SiriProxy on a dedicated RPi I am not concerned about installing and running everything as ROOT.
# Set the ROOT password from the user account
sudo passwd
# Log out and log back in as ROOT
# Remove the original user account if you wish
deluser
# Update the system
apt-get update
apt-get dist-upgrade
apt-get autoremove
# Install some basics:
apt-get install samba samba-common-bin ssh vim rcs unzip -y
# If you want to add or create SiriPorxy plugins that push custom pictures to Siri, then install APACHE
# NOTE: The defaults are fine. Your custom images need to reside in /var/www/
apt-get install apache2 -y
# If you use your router to reserve a static IP, add the following line to /etc/dhcp/dhclient.conf file.
supersede domain-name-servers 8.8.8.8, 8.8.4.4;
# Reboot the RPi
reboot
# If you want to define a static IP on the RPi, find out what address your router assigned to your RPi.
ifconfig
# Edit the network settings to use a STATIC IP address.
# NOTE: To make it easy use the same settings your router assigned to your RPi.
vim /etc/network/interfaces
# Comment out the DHCP entry. Make the STATIC entry look something like this:
# NOTE: Tweak the address for your STATIC IP address.
auto eth0
iface eth0 inet static
address 192.168.69.97
netmask 255.255.255.0
broadcast 192.168.69.255
network 192.168.69.0
gateway 192.168.69.1
dns-nameservers 8.8.8.8 8.8.4.4
# Reboot the RPi
reboot
# Enable SAMBA support. Tweak the Share Definition section in the /etc/samba/smb.conf file.
# TIP: If you enable RW access you will be able to create folders and write to the RPi from any client. Also make sure to disable GUEST access.
vim /etc/samba/smb.conf
# Add ROOT as a remote user.
# TIP: Use the same password as the root login to eliminate the need to remember another password.
smbpasswd –a root
# Restart SAMBA daemon:
sh /etc/init.d/samba stop
sh /etc/init.d/samba start
# You should now be able to access the RPi file system from any client.
# In lieu of running DNSMASQ or RubyDNS on the RPi, I opted to use my router to perform a transparent DNS redirect.
# On a router running www.dd-wrt.com open source firmware, configure a DNS redirect from Apple Siri servers to the STATIC IP address of the RPi.
# NOTE: Tweak the address for your RPi STATIC IP address.
# Services -> Additional DNSMasq Options
# iOS production Siri server
address=/guzzoni.apple.com/192.168.69.97
# Here are the prerequisite dependancies that need to be installed.
# RVM installs dependencies and latest Ruby by default.
# Install RVM - This will take awhile.
curl -L https://get.rvm.io | bash -s stable --ruby
# Set RVM path
[[ -s "/etc/profile.d/rvm.sh" ]] && . "/etc/profile.d/rvm.sh"
# Set the RVM path to be set up every time I log in
echo '[[ -s "/etc/profile.d/rvm.sh" ]] && . "/etc/profile.d/rvm.sh" # Load RVM function' >> ~/.bash_profile
# Use RUBY 2.0.0 as the default (and current) version of ruby
rvm use 2.0.0 --default
# Install SiriProxy gem
gem install siriproxy
# Make the .siriproxy directory in my home directory
mkdir ~/.siriproxy
# Generate the certificates
siriproxy gencerts
# Install the certificate on the iPhone.
# On your *NIX machine use SCP to copy the certificate from the RPi.
# Open a terminal window and use the following commands.
# NOTE: Tweak the address for your RPi STATIC IP address.
cd ~/Downloads
scp root@192.168.69.97:/root/.siriproxy/ca.pem .
# Attach this file to an email account you have access to on your iPhone.
# On the iPhone simply tap the file and follow the prompts to install.
# Bundle
siriproxy bundle
# Start the server
siriproxy server
@elvisimprsntr
Copy link
Author

If you do not see SiriProxy responding check the following:

  1. You need to either configure your router to perform a transparent DNS redirect or install DNSMASQ and make the appropriate tweaks.
  2. Siri is known to leak over the cellular connection even when connected to Wifi. Turn off cellular data. Occasionally I've had to toggle airplane mode.

@blazzik
Copy link

blazzik commented Feb 27, 2013

I'm having an issue with the "rake install" command...can you help?

root@raspberrypi:/home/root/SiriProxy# rake install
siriproxy 0.4.4 built to pkg/siriproxy-0.4.4.gem.
rake aborted!
Couldn't install gem, run gem install /home/root/SiriProxy/pkg/siriproxy-0.4.4.gem' for more detaied output /usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.0/lib/bundler/gem_helper.rb:68:ininstll_gem'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.0/lib/bundler/gem_helper.rb:43:in bloc in install' /usr/local/rvm/gems/ruby-1.9.3-p392@global/bin/ruby_noexec_wrapper:14:ineval'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin/ruby_noexec_wrapper:14:in `

'
Tasks: TOP => install
(See full trace by running task with --trace)

@elvisimprsntr
Copy link
Author

Updated instructions for Ruby 2.0.0 and SiriProxy 0.5.2

@sferoze
Copy link

sferoze commented Apr 4, 2013

I don't understand at all. I download the image, extracted it to an SD card like normal.

Then I type 'siriproxy server' and I get

bash: siriproxy: command not found.

I type anything command with siriproxy and I get command not found! I try running rvmsudo siriproxy server and I get rvmsudo command not found.

Basically, once I startup from the image, install dnsmasq, configure the file. Then how the hell do I start this thing? None of the siriproxy commands work. bash:siriproxy: command not found

I am running in the default root user with a clean install of your preinstalled siriproxy OS. I thought it would make it easy, what am I doing wrong?

@sferoze
Copy link

sferoze commented Apr 4, 2013

I must be doing something obviously wrong, I used the image and it doesn't even seem to have rvm installed? But the login was correct: user: root pass: siriproxy

I even tried created a new user and logging in as that user and try running siriproxy with and without rvmsudo and nothing

@sferoze
Copy link

sferoze commented Apr 5, 2013

So I got it to respond to siriproxy commands by entering [ -s "/etc/profile.d/rvm.sh" ] && . "/etc/profile.d/rvm.sh"

please add that to the instructions

@sferoze
Copy link

sferoze commented Apr 5, 2013

also now I am having issues, when I start siriproxy it does not detect a dns server

@elvisimprsntr
Copy link
Author

@sferoze I suspect you logged in using a console. type source .bash_profile

Have you determined your DNS problems?

@BA-Baracus
Copy link

Hi.
I downloaded the SD image and managed to get SP up and running but have problems to bundle plugins.
I get NoMethodError with ostruct.rb :
/usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/ostruct.rb:90:in initialize': undefined methodeach_pair' for #Array:0x1e090f0 (NoMethodError)
from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/siriproxy-0.5.4/lib/siriproxy/command_line.rb:167:in new' from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/siriproxy-0.5.4/lib/siriproxy/command_line.rb:167:inparse_options'
...

I have no idea where to fix this.
HELP!

@elvisimprsntr
Copy link
Author

@BA-Baracus That's not a problem with siriproxy or the SD card image. It's likely a problem with your plugins.

@C4Wiz
Copy link

C4Wiz commented Jul 29, 2013

how do you autologin and startx as root?

@shane11
Copy link

shane11 commented Dec 28, 2014

I've followed all these instructions - siriproxy is running, but can't get it to respond to my phone. Any ideas?

@elljun
Copy link

elljun commented Jan 27, 2015

hi.. @elvisimprsntr
please help make make a code on a Lights that i can control.. with the siri proxy running on my raspberry pi. i have a project that would set a scheduled or timed lighting system.. for example i would say to Siri "Set room light from 6pm to 6am."

@jamieburchell
Copy link

Just for anyone else coming here and spending hours going through it all - SiriProxy is dead as of iOS 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment