# RASPBERRY PI ALS MOBILE HOTSPOT MIT PROXYSERVER

## Hardware
- Raspberry Pi Zero W
- 3G Stick Huawei E3531

## INSTALLATION

### Grundinstallation
```
Image: 2018-03-13-raspbian-stretch-lite.zip von https://www.raspberrypi.org/downloads/raspbian/

Installation auf SD:
# unzip -p 2018-03-13-raspbian-stretch-lite.zip |dd of=/dev/sdXXX bs=4M conv=fsync

# raspi-config
- Change User Password: heimetli27
- Hostname: proxypi
- locale: en_US.utf8 (auch Default)
- locale: de_CH.utf8 
- Timezone: Europe/Zurich
- Change Wifi Country: CH
- Keyboard: Generic 105-key (Intl), German (Switzerland)
- Enable SSH Server
- WLAN einrichten (siehe "per WLAN")

# apt-get update
# apt-get upgrade

Software installieren:
# apt-get install gammu python-gammu
# apt-get install python-serial
# apt-get install minicom
# apt-get install ppp
# apt-get install hostapd
# apt-get install ntpdate
# apt-get install dnsmasq
# apt-get install python-bottle
# apt-get install privoxy

Firmware-Update:
# rpi-update 
```

### Boot Config anpassen

in /boot/config.txt

```
dtparam=audio=off

# Disable Bluetooth
dtoverlay=pi3-disable-bt
```

### Zugang ermöglichen

```
# cat /etc/wpa_supplicant/wpa_supplicant.conf
country=CH
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
  ssid="haerdoepfu27" psk="XXXXXXXXXXXX"
}
```

### USB Stick E3531
```
Einrichten GSM:
/etc/usb_modeswitch.d/12d1:157d: 
#Huawei E3531
TargetVendor=0x12d1
TargetProduct=0x1436
MessageContent="55534243123456780000000000000011063000000000010000000000000000"
```


### Test SMS-Versand:
```
gammu sendsms TEXT 0765006123 -text "Halooo von beielipi"
```

### Konfiguration privoxy

/etc/privoxy/config anpassen:
```
debug 1024
listen-address  192.168.255.1:8118
```


in /etc/privoxy/user.action folgendes anfuegen (am Ende):
```
# Wir blockieren grundsaetzlich alles
{ +block{Adresse ist nicht erlaubt} }
/ # Block all URLs

# Jetzt kommt die Whitelist
{ -block }
www.sbb.ch
*.autodesk.com
js-agent.newrelic.com
bam.nr-data.net
urs.microsoft.com
ssl.google-analytics.com
smetrics.autodesk.com
nexus.ensighten.com
api.demandbase.com
munchkin.marketo.net
918-fod-433.mktoresp.com
*.symdb.com
*.symcb.com
*.ws.symantec.com
*.symcd.com
*.geotrust.com
*.pki.goog
*.verisign.com
*.ss2.us
*.digicert.com
crl.microsoft.com
gateway.bluesnap.com
nexus.ensighten.com
d1rvg4h59z7jah.cloudfront.net
```

### Installation Applikation
```
# Aus Git uebernehmen:
(auf anderem Rechner):
$ git clone https://git.nbit.ch/joerg/proxypi.git
$ cd proxypi
$ tar cvf /var/tmp/proxypi-git-files.tar .

# cd /home/pi && tar xvf /var/tmp/proxypi-git-files.tar
# rm -rf /home/pi/.git
# chown -R root:root /home/pi/root-bin
# chown -R root:root /home/pi/web-root
# cd /home/pi/install-files
# for i in $(find . -type f); do echo cp $i /$i ; done
# for i in $(find . -type f); do cp $i /$i ; done

# systemctl enable my_web_server
# systemctl disable dhcpcd

Reboot:
# init 6


```
