Bob Mottram преди 11 години
родител
ревизия
8f8fda2963
променени са 1 файла, в които са добавени 181 реда и са изтрити 28 реда
  1. 181
    28
      beaglebone.txt

+ 181
- 28
beaglebone.txt Целия файл

@@ -2673,11 +2673,11 @@ uncolor index "~N"
2673 2673
 set pgp_timeout=60
2674 2674
 
2675 2675
 # automatically sign and encrypt with PGP/MIME
2676
-unset smime_is_default
2677 2676
 set pgp_autosign         # autosign all outgoing mails
2678 2677
 set pgp_replyencrypt     # autocrypt replies to crypted
2679 2678
 set pgp_replysign        # autosign replies to signed
2680 2679
 set pgp_auto_decode=yes  # decode attachments
2680
+unset smime_is_default
2681 2681
 
2682 2682
 set alias_file=~/.mutt-alias
2683 2683
 source ~/.mutt-alias
@@ -6596,6 +6596,130 @@ allow_registration = false
6596 6596
 
6597 6597
 Save and exit.
6598 6598
 
6599
+** Run a pastebin service
6600
+If you need to be able to share short text files or other kinds of files on a temporary basis (doing technical support or reporting a bug, for example) then it's useful to have a pastebin system running on your server.
6601
+
6602
+For this you will need to set up a new subdomain and create a new Apache configuration. For details on how to do that see [[Getting onto the web]] and [[Setting up a web site]].
6603
+
6604
+#+BEGIN_SRC: bash
6605
+adduser --disabled-login zerobin
6606
+cd /tmp
6607
+git clone https://github.com/sametmax/0bin.git
6608
+cd 0bin
6609
+python setup.py install
6610
+#+END_SRC
6611
+
6612
+Now create the daemon.
6613
+
6614
+#+BEGIN_SRC: bash
6615
+editor /etc/init.d/zerobin
6616
+#+END_SRC
6617
+
6618
+Add the following text:
6619
+
6620
+#+BEGIN_SRC: bash
6621
+#!/bin/bash
6622
+# /etc/init.d/zerobin
6623
+
6624
+### BEGIN INIT INFO
6625
+# Provides:          zerobin
6626
+# Required-Start:    $remote_fs $syslog
6627
+# Required-Stop:     $remote_fs $syslog
6628
+# Default-Start:     2 3 4 5
6629
+# Default-Stop:      0 1 6
6630
+# Short-Description: starts zerobin as a background daemon
6631
+# Description:       starts zerobin as a background daemon
6632
+### END INIT INFO
6633
+
6634
+# Author: Bob Mottram <bob@robotics.uk.to>
6635
+
6636
+#Settings
6637
+SERVICE='zerobin'
6638
+LOGFILE='/home/zerobin/zerobin.log'
6639
+COMMAND="zerobin > $LOGFILE"
6640
+USERNAME='zerobin'
6641
+NICELEVEL=19 # from 0-19 the bigger the number, the less the impact on system resources
6642
+HISTORY=1024
6643
+INVOCATION="nice -n ${NICELEVEL} ${COMMAND}"
6644
+PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin'
6645
+
6646
+
6647
+zerobin_start() {
6648
+echo "Starting $SERVICE..."
6649
+su --command "screen -h ${HISTORY} -dmS ${SERVICE} ${INVOCATION}" $USERNAME
6650
+}
6651
+
6652
+
6653
+zerobin_stop() {
6654
+echo "Stopping $SERVICE"
6655
+su --command "screen -p 0 -S ${SERVICE} -X stuff "'^C'"" $USERNAME
6656
+}
6657
+
6658
+
6659
+#Start-Stop here
6660
+case "$1" in
6661
+  start)
6662
+    zerobin_start
6663
+    ;;
6664
+  stop)
6665
+    zerobin_stop
6666
+    ;;
6667
+  restart)
6668
+    zerobin_stop
6669
+    sleep 2s
6670
+    zerobin_start
6671
+    ;;
6672
+    *)
6673
+  echo "Usage: $0 {start|stop|restart}"
6674
+  exit 1
6675
+  ;;
6676
+esac
6677
+
6678
+exit 0
6679
+#+END_SRC
6680
+
6681
+Save and exit.
6682
+
6683
+#+BEGIN_SRC: bash
6684
+chmod +x /etc/init.d/zerobin
6685
+update-rc.d zerobin defaults
6686
+service zerobin start
6687
+#+END_SRC
6688
+
6689
+Now edit the Apache configuration, delete anything which already exists and add the following, changing /mypastedomainname.com/ to your pastebin subdomain and /username@mydomainname.com/ to your email address:
6690
+
6691
+#+BEGIN_SRC: bash
6692
+<VirtualHost *:80>
6693
+    ServerAdmin username@mydomainname.com
6694
+    ServerName mypastedomainname.com
6695
+
6696
+    <Location />
6697
+      ProxyPass http://localhost:8000/
6698
+      Order allow,deny
6699
+      Allow from all
6700
+      LimitRequestBody 256000
6701
+    </Location>
6702
+
6703
+    ErrorLog ${APACHE_LOG_DIR}/paste_error.log
6704
+
6705
+    # Possible values include: debug, info, notice, warn, error, crit,
6706
+    # alert, emerg.
6707
+    LogLevel error
6708
+
6709
+    CustomLog ${APACHE_LOG_DIR}/paste.log combined
6710
+</VirtualHost>
6711
+#+END_SRC
6712
+
6713
+Save and exit.
6714
+
6715
+The encryption used here is really just intended to provide you with plausible deniability for content which other users may post to your server.  Pastes aren't really intended to be totally private, so if your intention is to send private messages then Bitmessage, an XMPP chat session with OTR or a GPG encrypted email is a far better solution.
6716
+
6717
+#+BEGIN_SRC: bash
6718
+service apache2 restart
6719
+#+END_SRC
6720
+
6721
+You can now visit your new site and paste things for others to see, and vice versa.  Uploads are limited to 256K in size to prevent your storage space from being used up.
6722
+
6599 6723
 ** Install Tripwire
6600 6724
 
6601 6725
 #+BEGIN_VERSE
@@ -7203,42 +7327,70 @@ export HOSTNAME=mydiasporadomainname.com
7203 7327
 editor /etc/apache2/sites-available/$HOSTNAME
7204 7328
 #+END_SRC
7205 7329
 
7206
-The initial section which begins with *<VirtualHost *:80>* should be replaced by the following, replacing /mydiasporadomainname.com/ with your Diaspora domain name and /myusername@mydomainname.com/ with your email address.
7330
+Delete anything which already exists and add the following:
7207 7331
 
7208 7332
 #+BEGIN_SRC: bash
7209 7333
 <VirtualHost *:80>
7210
-	ServerAdmin myusername@mydomainname.com
7211
-	ServerName mydiasporadomainname.com
7334
+  ServerName mydiasporadomainname.com
7335
+  ServerAlias www.mydiasporadomainname.com
7212 7336
 
7213
-    RewriteEngine On
7214
-    RewriteCond %{HTTPS} off
7215
-    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
7337
+  RedirectPermanent / https://mydiasporadomainname.com/
7216 7338
 </VirtualHost>
7217
-#+END_SRC
7218 7339
 
7219
-Add the following in the section which begins with *<VirtualHost *:443>*.
7340
+<VirtualHost *:443>
7341
+  ServerName mydiasporadomainname.com
7342
+  ServerAlias www.mydiasporadomainname.com
7220 7343
 
7221
-#+BEGIN_SRC: bash
7222
-    ProxyVia On
7223
-    ProxyPreserveHost On
7224
-	ProxyRequests Off
7225
-    SSLProxyEngine On
7344
+  DocumentRoot /home/diaspora/diaspora/public
7226 7345
 
7227
-    ProxyPass / http://localhost:3001/
7228
-    ProxyPassReverse / http://localhost:3001/
7229
-    RequestHeader set X_FORWARDED_PROTO https
7346
+  RewriteEngine On
7230 7347
 
7231
-	DocumentRoot /home/diaspora/diaspora/public
7232
-	<Directory />
7233
-		Options FollowSymLinks
7234
-		AllowOverride All
7235
-	</Directory>
7236
-	<Directory /home/diaspora/diaspora/public>
7237
-		Options All
7238
-		AllowOverride All
7239
-		Order allow,deny
7240
-		allow from all
7241
-	</Directory>
7348
+  RewriteCond %{HTTP_HOST} !^mydiasporadomainname\.com [NC]
7349
+  RewriteRule ^/(.*)$ https://mydiasporadomainname\.com/$1 [L,R,QSA]
7350
+
7351
+  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
7352
+  RewriteRule ^/(.*)$ balancer://upstream%{REQUEST_URI} [P,QSA,L]
7353
+
7354
+  <Proxy balancer://upstream>
7355
+    BalancerMember http://127.0.0.1:3001
7356
+  </Proxy>
7357
+
7358
+  ProxyRequests Off
7359
+  ProxyVia On
7360
+  ProxyPreserveHost On
7361
+  RequestHeader set X_FORWARDED_PROTO https
7362
+
7363
+  <Proxy *>
7364
+    # Apache < 2.4
7365
+    Order allow,deny
7366
+    Allow from all
7367
+    # Apache >= 2.4
7368
+    #Require all granted
7369
+  </Proxy>
7370
+
7371
+  <Directory /home/diaspora/diaspora/public>
7372
+    Options -MultiViews
7373
+    # Apache < 2.4
7374
+    Allow from all
7375
+    AllowOverride all
7376
+    # Apache >= 2.4
7377
+    #Require all granted
7378
+  </Directory>
7379
+
7380
+  SSLEngine On
7381
+  SSLCertificateFile    /etc/ssl/certs/mydiasporadomainname.com.crt
7382
+  SSLCertificateKeyFile /etc/ssl/private/mydiasporadomainname.com.key
7383
+
7384
+  # maybe not needed, need for example for startssl to point to a local
7385
+  # copy of http://www.startssl.com/certs/sub.class1.server.ca.pem
7386
+  SSLCertificateChainFile /etc/ssl/chains/startssl-sub.class1.server.ca.pem
7387
+
7388
+  # Based on https://wiki.mozilla.org/Security/Server_Side_TLS - consider as global configuration
7389
+  SSLProtocol all -SSLv2
7390
+  SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK
7391
+  SSLHonorCipherOrder on
7392
+  SSLCompression off
7393
+</VirtualHost>
7242 7394
 #+END_SRC
7243 7395
 
7244 7396
 Save and exit.
@@ -7351,6 +7503,7 @@ a2enmod headers
7351 7503
 a2enmod proxy
7352 7504
 a2enmod proxy_connect
7353 7505
 a2enmod proxy_http
7506
+a2enmod proxy_balancer
7354 7507
 a2ensite $HOSTNAME
7355 7508
 service apache2 restart
7356 7509
 #+END_SRC