Browse Source

Bitmessage to email gateway

Bob Mottram 10 years ago
parent
commit
57d1338f6e
1 changed files with 165 additions and 1 deletions
  1. 165
    1
      beaglebone.txt

+ 165
- 1
beaglebone.txt View File

5729
 editor /home/bitmsg/.config/PyBitmessage/keys.dat
5729
 editor /home/bitmsg/.config/PyBitmessage/keys.dat
5730
 #+END_SRC
5730
 #+END_SRC
5731
 
5731
 
5732
-Add the following:
5732
+Add the following, changing /apipassword/ to some long random string:
5733
 
5733
 
5734
 #+BEGIN_SRC: bash
5734
 #+BEGIN_SRC: bash
5735
 [bitmessagesettings]
5735
 [bitmessagesettings]
5770
 willinglysendtomobile = False
5770
 willinglysendtomobile = False
5771
 maxpayloadlengthkb = 256
5771
 maxpayloadlengthkb = 256
5772
 daemon = true
5772
 daemon = true
5773
+apienabled = true
5774
+apiport = 8442
5775
+apiinterface = 127.0.0.1
5776
+apiusername = bitmsg
5777
+maxpayloadlengthkb = 256
5778
+apipassword = change_this_password
5773
 #+END_SRC
5779
 #+END_SRC
5774
 
5780
 
5775
 Save and exit. Then enable the daemon and run it.
5781
 Save and exit. Then enable the daemon and run it.
5798
 pybitmessage
5804
 pybitmessage
5799
 #+END_SRC
5805
 #+END_SRC
5800
 
5806
 
5807
+*** Connect Bitmessage to Email
5808
+
5809
+It may be convenient to have any Bitmessages addressed to you which arrive at the BBB to be transfered to your email, so that you can check for messages on mobile devices or on computers where installing a Bitmessage client isn't an available option. This transference will take place on the BBB itself, so will not involve transmitting any plaintext over the local network or internet.  To do this first you'll need to set up a receiving Bitmessage address by editing /home/bitmsg/.config/PyBitmessage/keys.dat and adding the details for your address, which could be coppied from another machine (such as a laptop running a Bitmessage client).
5810
+
5811
+It will look something like:
5812
+
5813
+#+BEGIN_SRC: bash
5814
+[BM-address]
5815
+label = myusername@mydomainname.com
5816
+enabled = true
5817
+decoy = false
5818
+noncetrialsperbyte = 640
5819
+payloadlengthextrabytes = 14000
5820
+privsigningkey = ...
5821
+privencryptionkey = ...
5822
+lastpubkeysendtime = ...
5823
+#+END_SRC
5824
+
5825
+Note that it's particularly important that /label/ be set to your email address.  This is how the system will know that when a bitmessage arrives which account to transfer it to.
5826
+
5827
+You should also make sure that /apipassword/ is set to some long random string.
5828
+
5829
+Save and close /keys.dat/, then restart the Bitmessage daemon.
5830
+
5831
+#+BEGIN_SRC: bash
5832
+service pybitmessage restart
5833
+#+END_SRC
5834
+
5835
+The restart will take 30 seconds or so.  Next install the Bitmessage to email gateway.
5836
+
5837
+#+BEGIN_SRC: bash
5838
+cd /usr/share
5839
+git clone https://github.com/bashrc/bitmessage-email-gateway
5840
+chown -R bitmsg:bitmsg bitmessage-email-gateway
5841
+cd bitmessage-email-gateway
5842
+mkdir /home/bitmsg/Maildir
5843
+mkdir /home/bitmsg/Maildir/new
5844
+chown -R bitmsg:bitmsg /home/bitmsg
5845
+#+END_SRC
5846
+
5847
+Substitute /mydomainname.com/ for your domain name (the main one used for email).
5848
+
5849
+#+BEGIN_SRC: bash
5850
+sed 's/godark.ca/mydomainname.com/g' bitmessage-gateway.py > bitmessage-gateway.py
5851
+#+END_SRC
5852
+
5853
+Change the user to /bitmsg/
5854
+
5855
+#+BEGIN_SRC: bash
5856
+sed 's#your_user/MailDir#bitmsg/Maildir#g' bitmessage-gateway.py > bitmessage-gateway.py
5857
+#+END_SRC
5858
+
5859
+Change the logging location.
5860
+
5861
+#+BEGIN_SRC: bash
5862
+sed 's#/var/log/bitmessage-gateway.log#/home/bitmsg/gateway.log#g'
5863
+bitmessage-gateway.py > bitmessage-gateway.py
5864
+#+END_SRC
5865
+
5866
+Change the API username.
5867
+
5868
+#+BEGIN_SRC: bash
5869
+sed 's/bmapi/bitmsg/g' bitmessage-gateway.py > bitmessage-gateway.py
5870
+#+END_SRC
5871
+
5872
+Find out what the API password is:
5873
+
5874
+#+BEGIN_SRC: bash
5875
+grep "apipassword" /home/bitmsg/.config/PyBitmessage/keys.dat | awk -F ' ' '{print $3}'
5876
+#+END_SRC
5877
+
5878
+Then change it with:
5879
+
5880
+#+BEGIN_SRC: bash
5881
+sed "s/'password' : ''/'password' : 'bitmessage_api_password'/g" bitmessage-gateway.py > bitmessage-gateway.py
5882
+#+END_SRC
5883
+
5884
+Now create the daemon.
5885
+
5886
+#+BEGIN_SRC: bash
5887
+editor /etc/init.d/bitmessage-gateway
5888
+#+END_SRC
5889
+
5890
+Add the following text:
5891
+
5892
+#+BEGIN_SRC: bash
5893
+#!/bin/bash
5894
+# /etc/init.d/bitmessage-gateway
5895
+
5896
+### BEGIN INIT INFO
5897
+# Provides:          bitmessage-gateway
5898
+# Required-Start:    $remote_fs $syslog
5899
+# Required-Stop:     $remote_fs $syslog
5900
+# Default-Start:     2 3 4 5
5901
+# Default-Stop:      0 1 6
5902
+# Short-Description: starts a gateway between bitmessage and email
5903
+# Description:
5904
+### END INIT INFO
5905
+
5906
+# Author: Bob Mottram <bob@robotics.uk.to>
5907
+
5908
+#Settings
5909
+SERVICE='bitmessage-gateway'
5910
+LOGFILE='/dev/null'
5911
+COMMAND="python bitmessage-gateway.py > $LOGFILE"
5912
+USERNAME='bitmsg'
5913
+NICELEVEL=19 # from 0-19 the bigger the number, the less the impact on system resources
5914
+HISTORY=1024
5915
+BMG_LOCATION="/usr/share/bitmessage-email-gateway"
5916
+INVOCATION="nice -n ${NICELEVEL} ${COMMAND}"
5917
+PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/share/bitmessage-email-gateway'
5918
+
5919
+
5920
+bmg_start() {
5921
+echo "Starting $SERVICE..."
5922
+cd ${BMG_LOCATION}
5923
+su --command "screen -h ${HISTORY} -dmS ${SERVICE} ${INVOCATION}" $USERNAME
5924
+}
5925
+
5926
+
5927
+bmg_stop() {
5928
+echo "Stopping $SERVICE"
5929
+su --command "screen -p 0 -S ${SERVICE} -X stuff "'^C'"" $USERNAME
5930
+}
5931
+
5932
+
5933
+#Start-Stop here
5934
+case "$1" in
5935
+  start)
5936
+    bmg_start
5937
+    ;;
5938
+  stop)
5939
+    bmg_stop
5940
+    ;;
5941
+  restart)
5942
+    bmg_stop
5943
+    sleep 5s
5944
+    bmg_start
5945
+    ;;
5946
+    *)
5947
+  echo "Usage: $0 {start|stop|restart}"
5948
+  exit 1
5949
+  ;;
5950
+esac
5951
+
5952
+exit 0
5953
+#+END_SRC
5954
+
5955
+Save and exit.
5956
+
5957
+#+BEGIN_SRC: bash
5958
+chmod +x /etc/init.d/bitmessage-gateway
5959
+update-rc.d bitmessage-gateway defaults
5960
+service bitmessage-gateway start
5961
+#+END_SRC
5962
+
5963
+From a Bitmessage client you should now be able to send a message to your Bitmessage address and have it eventually appear as an email in your inbox.
5964
+
5801
 ** Overcome restrictive environments
5965
 ** Overcome restrictive environments
5802
 
5966
 
5803
 #+BEGIN_VERSE
5967
 #+BEGIN_VERSE