beaglebone.txt 145KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598
  1. #+TITLE: FreedomBone
  2. #+AUTHOR: Bob Mottram
  3. #+EMAIL: bob@robotics.uk.to
  4. #+KEYWORDS: freedombox, debian, beaglebone, friendica, email, web server, home server, internet, censorship, surveillance, social network, irc, jabber, chat
  5. #+DESCRIPTION: Turn the Beaglebone Black into a personal communications server
  6. #+OPTIONS: ^:nil
  7. #+STYLE: <link rel="stylesheet" type="text/css" href="index.css" />
  8. #+BEGIN_CENTER
  9. *How to turn the Beaglebone Black into a FreedomBox-like personal communications server*
  10. #+END_CENTER
  11. #+CAPTION: BeagleBone Black
  12. #+ATTR_HTML: :alt BeagleBone Black image :align center
  13. [[[[./images/freedombone.jpg]]]]
  14. #+BEGIN_CENTER
  15. Copyright (C) 2014 Bob Mottram
  16. Permission is granted to copy, distribute and/or modify this document under the terms of the [[https://gnu.org/licenses/fdl.html][GNU Free Documentation License]], Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
  17. Source for this web site in [[https://en.wikipedia.org/wiki/Org-mode][Emacs org-mode]] format is available [[/beaglebone.txt][here]]. Comments or patches may be submitted via [[https://github.com/fuzzgun/freedombone][Github]].
  18. #+END_CENTER
  19. * Introduction
  20. #+BEGIN_VERSE
  21. /If you look at it from an engineering perspective, an iterative perspective, it’s clear that you have to try something rather than do nothing./
  22. -- Edward J. Snowden
  23. #+END_VERSE
  24. ** What is FreedomBone?
  25. Today many of us rely upon "free" services in the cloud, such as Gmail, Facebook, Google+ and so on. It might appear that these services are indispensible infrastructure of the modern internet, but actually they're not strictly needed and the amount of value which they deliver to the average internet user is very marginal. It is possible to be a citizen of the internet and yet not use those things - to disintermediate the most well known companies and cut out their prurient or merely cringeworthy business models.
  26. FreedomBone is a personal home communications server based upon the BeagleBone Black hardware. It's small and cheap and will allow you to use email, have your own web site and do social networking in a federated way without needing to rely upon any intermediary companies other than your ISP.
  27. ** Do I need any prior knowledge?
  28. In these instructions only a minimal level of familiarity with Linux is assumed. It's assumed that you know the basics of the /nano/ and /emacs/ editors, but it would be simple to also use other editors if you prefer.
  29. ** Why should I do this?
  30. You should consider doing this if you are a freedom-oriented sort of person and you want to maintain sovereignty over your information. Laws in many places in the world consider you to have relinquished any property rights over data which you put onto a server not owned by youself (i.e. owned by a third party, such as Google or Facebook).
  31. If you don't like the idea of having all your communications intercepted and investigated by the Surveillance State then you should consider running a FreedomBone. If your profession involves maintaining confidentiality as an essential feature, such as legal or medical services, counselling, teaching or any sort of activism then you should consider running a FreedomBone.
  32. As Eben Moglen noted in his now famous [[https://www.youtube.com/watch?v=QOEMv0S8AcA]["Freedom in The Cloud"]] talk the simple fact of you keeping your own internet logs (found in the /var/log directory) puts a certain amount of power in your hands and takes it away from parties who would otherwise sell that information without your knowledge or permission to advertisers or other shady outfits who may not have your best interests at heart.
  33. ** After it's installed will it need a lot of maintenance?
  34. So long as the hardware is ok the amount of maintenance needed should be very small. Unlike on Windows based systems you don't need to defragment drives or mess about with anti-virus programs. I ran a similar Sheevaplug system between 2010 and 2013 with only occasional software updates or reboots, and uptime was probably 99% or better.
  35. ** Is it secure?
  36. Nothing is totally secure or infallible. You could have the most secure technology and yet still use easy to guess passwords. This system will not defend you from an attacker who is actively trying to block or corrupt your communications, but I assume that doesn't apply in the majority of cases. Another thing to be aware of is that running a FreedomBone could make you more vulnerable to traffic analysis, since the server is associated with your home address and isn't a giant aggregation of users somewhere in the cloud. You need to weigh this alongside the additional legal protection which owning the server and having it in your own home gives you.
  37. FreedomBone should be far more secure than using popular cloud-based services which have spying built into them as a core feature (although not one which is typically advertised), but it is not necessarily an impenetrable information fortress. This project is at least as much about achieving communications independence as it is about being able to do that securely.
  38. ** Will running a server all the time affect my electricity bill?
  39. Hardly at all. The BeagleBone Black consumes very little power - less than 5W. It would even be potentially possible to run it from a solar panel.
  40. ** Can I use a Raspberry Pi or Cubieboard instead?
  41. These instructions are not highly specific to the Beaglebone Black and so will likely also work on other single board computers (SBCs) such as the [[https://en.wikipedia.org/wiki/Raspberry_pi][Raspberry Pi]] or [[https://en.wikipedia.org/wiki/Cubieboard][Cubieboard]]. The original Raspberry Pi only had 256MB of RAM and so the performance of some services may be more limited. The Beaglebone Black was chosen mainly because of its low cost, relatively good CPU performance for the price (by the standards of 2013) and also low electricity consumption. The Cubieboard is also another good alternative, with the A20 version having similar specifications but twice as much RAM as the BeagleBone Black.
  42. ** Why should I trust the packages or source code downloaded from this site?
  43. If you're particularly security conscious then you shouldn't. Binary or source packages have only been included here for convenience and to avoid confusion. "/Go and find a Debian installation for the BeagleBone Black somewhere on the web/" is too vague an instruction for my liking, and I've attempted to keep things as concise and unambiguous as possible - particularly with an average or new Linux user in mind.
  44. However, for maximum security for those software systems which are not already packaged within the Debian repositories then seek out the original sources and verify the hashes independently.
  45. It's worth adopting an attitude of "/trust but verify/". Don't let fear of mass surveillance and [[https://www.techdirt.com/articles/20140207/08354426130/gchq-has-entire-program-dirty-tricks-including-honeypots-using-journalists-deleting-online-accounts.shtml]["dirty tricks"]] paralyse you into trusting nothing and consequently doing nothing. Doing nothing means they win.
  46. * Inventory
  47. #+BEGIN_VERSE
  48. /You can’t help someone just by making a wish to do so, you have to take action./
  49. -- Dalai Lama
  50. #+END_VERSE
  51. These instructions assume that you have the following ingredients.
  52. ** A BeagleBone Black (BBB)
  53. It should come with a suitable USB cable for the initial setup. To make things look nicer you may also want to get a case for it.
  54. ** An internet connection
  55. It is assumed that the most common situation is via a router installed at home. The router should have ethernet sockets on it and a web interface which allows you to forward ports (sometimes under the "firewall" settings), so that you can forward ssh and web traffic to the BBB.
  56. ** microSD card
  57. To use as the main storage for the BBB. 16 or 32GB is fine, and can be obtained quite cheaply. Try to use Sandisk (class 10 or better) where possible and avoid cheaper cards which often have poor performance.
  58. You may also need an SD card adaptor or USB card reader in order to flash the operating image to the microSD card. For instance, many laptops have an SD card slot but not a microSD slot.
  59. ** 5V/1A power supply
  60. With a plug suitable for powering the BBB. If you have some device with a USB socket nearby you may also be able to just use that for electrical power. However, powering from the USB cable alone might result in crashes when the system is under load, depending upon how many milliamps can be supplied by the USB hub/socket. If the system crashes due to running out of power then you will see that the LEDs on the BBB are continuously on, rather than flashing.
  61. ** An ethernet patch cable
  62. Just an ordinary cat5 or cat6 cable that you can get from most electrical/computer stores.
  63. * Installing Debian onto the microSD card
  64. The Debian Linux OS will be installed onto a small flash drive. It's a good idea to do this rather than using the internal flash, because it will allow you to easily create backups of the entire system if necessary using the dd command.
  65. Download the image.
  66. #+BEGIN_SRC: bash
  67. cd ~/
  68. wget http://freedombone.uk.to/debian-7.2-console-armhf-2013-11-15.tar.xz
  69. #+END_SRC
  70. Verify it.
  71. #+BEGIN_SRC: bash
  72. sha256sum debian-7.2-console-armhf-2013-11-15.tar.xz
  73. 262ea96d6bff530ad545e001eb2aa50b26a999c02f0c0e2e5f8536edf21c973a debian-7.2-console-armhf-2013-11-15.tar.xz
  74. #+END_SRC
  75. Uncompress it.
  76. #+BEGIN_SRC: bash
  77. tar xJf debian-7.2-console-armhf-2013-11-15.tar.xz
  78. cd debian-7.2-console-armhf-2013-11-15
  79. #+END_SRC
  80. Create the disk image, where sdX is the name of the flash drive (probably it will be sdb or sdc).
  81. #+BEGIN_SRC: bash
  82. sudo apt-get install u-boot-tools
  83. sudo ./setup_sdcard.sh --mmc /dev/sdX --uboot bone --swap-file 1024
  84. #+END_SRC
  85. Once completed then safely remove the microSD card via your file manager (usually right click and "safely remove" or "eject").
  86. * Setup
  87. #+BEGIN_VERSE
  88. /Build the tools for a future you would want to live in/
  89. -- Kurt Opsahl
  90. #+END_VERSE
  91. ** Things to be aware of
  92. *** A note on ssh
  93. When using ssh to log into the BBB if you get warnings of the type "/the ECDSA host key for domain differs from the key for the IP address/" then run the command:
  94. #+BEGIN_SRC: bash
  95. ssh-keygen -R <IP address>
  96. #+END_SRC
  97. *** Passwords
  98. It's highly recommended that you use a password manager, such as KeepassX, and make all your passwords long random strings. It's also a good idea to use different passwords for different pieces of software, instead of one or two passwords for the whole system. That compartmentalises the security such that even if an attacker gains access to one system they can't necessarily get access to others.
  99. *** HTTPS
  100. Throughout these instructions self signed SSL certificates are used to implement access to web pages via HTTPS. The whole HTTPS security model upon which much of the internet currently rests seems broken in that it usually depends upon "trusted certificate authorities" who are not really trusted, except perhaps by the maintainers of certain web browser software. So all that HTTPS really guarantees is that you have an encrypted connection, but an encrypted connection /to who/ can be subject to doubt. As was seen in 2013 with the [[https://www.schneier.com/essay-455.html][information coming from Edward Snowden]], and also the [[http://en.wikipedia.org/wiki/Lavabit][Lavabit email service]], it's possible for companies/organisations to be compromised or bribed and SSL private keys for all users can be demanded using gagging orders or secret laws without any individual user ever being able to know that their communications is no longer secure..
  101. Not knowing who you're really connecting to is especially true for self-signed certificates, so it is in principle possible that when logging into a site with a username and password a system such as [[http://arstechnica.com/tech-policy/2013/11/uk-spies-continue-quantum-insert-attack-via-linkedin-slashdot-pages/][Quantum Insert]], or a compromised [[http://en.wikipedia.org/wiki/Domain_Name_System][DNS service]], could be used to direct the user to a fake copy of the login screen for the purposes of obtaining their login details. While this doesn't seem to be a major problem at the time of writing it's something to keep in mind. So if you can't log in or if you log in and what you see doesn't look like your site then it's possible that such a compromise could have taken place. Using a password manager with different login details for each site is one way to ensure that if one system is compromised then the attacker can't necessarily get access to all your other stuff.
  102. ** Initial
  103. Plug the microSD card into the BBB and Connect the USB cable to your laptop/desktop, then login via ssh.
  104. #+BEGIN_SRC: bash
  105. ssh debian@192.168.7.2
  106. #+END_SRC
  107. The default password is /temppwd/
  108. Then log in as root:
  109. #+BEGIN_SRC: bash
  110. su
  111. #+END_SRC
  112. The default password is /root/
  113. The first thing to do is to change the passwords from their defaults.
  114. #+BEGIN_SRC: bash
  115. passwd
  116. #+END_SRC
  117. Then you will need to change the network interfaces. The main task here is to comment out the stuff related to usb0. That will enable you to plug the BBB into the back of a router and for it to be detectable on the network.
  118. #+BEGIN_SRC: bash
  119. nano /etc/network/interfaces
  120. #+END_SRC
  121. The resulting interfaces file should look like this:
  122. #+BEGIN_SRC: bash
  123. # This file describes the network interfaces available on your system
  124. # and how to activate them. For more information, see interfaces(5).
  125. # The loopback network interface
  126. auto lo
  127. iface lo inet loopback
  128. # The primary network interface
  129. allow-hotplug eth0
  130. iface eth0 inet static
  131. address 192.168.1.60
  132. netmask 255.255.255.0
  133. gateway 192.168.1.254
  134. dns-nameservers 213.73.91.35 85.214.20.141
  135. # Example to keep MAC address between reboots
  136. #hwaddress ether DA:AD:CE:EF:CA:FE
  137. # WiFi Example
  138. #auto wlan0
  139. #iface wlan0 inet dhcp
  140. # wpa-ssid "essid"
  141. # wpa-psk "password"
  142. # Ethernet/RNDIS gadget (g_ether)
  143. # ... or on host side, usbnet and random hwaddr
  144. # Note on some boards, usb0 is automaticly setup with an init script
  145. # in that case, to completely disable remove file [run_boot-scripts] from the boot partition
  146. #iface usb0 inet static
  147. # address 192.168.7.2
  148. # netmask 255.255.255.0
  149. # network 192.168.7.0
  150. # gateway 192.168.7.1
  151. #+END_SRC
  152. CTRL-O followed by ENTER to save, then CTRL-X to exit.
  153. In the above example "address 192.168.1.60" is a static IP address for the BBB, which will allow incoming network traffic to be directed from the router in a reliable manner. It should be outside of the DHCP range set up on the router.
  154. "gateway 192.168.1.254" should be the IP address of the router.
  155. Note that setting the DNS servers with dns-nameservers is important because some home routers do not allow you to change the DNS settings.
  156. Edit resolv.conf.
  157. #+BEGIN_SRC: bash
  158. nano /etc/resolv.conf
  159. #+END_SRC
  160. It should look something like the following:
  161. #+BEGIN_SRC: bash
  162. domain localdomain
  163. search localdomain
  164. nameserver 213.73.91.35
  165. nameserver 85.214.20.141
  166. #+END_SRC
  167. CTRL-O followed by ENTER to save, then CTRL-X to exit.
  168. Now disconnect the BBB from your computer and plug it into the router. You'll need an ethernet patch cable and you may also need a 5V/1A power supply for the BBB.
  169. If you go to the web administration screen for your internet router (often it's on 192.168.2.1 or 192.168.1.254) then after a few minutes you should see the BBB appear on the network. It's name will be "arm".
  170. ** Add a user
  171. Ssh back in to the BBB and login as root. In this example the BBB's IP address is 192.168.1.60.
  172. #+BEGIN_SRC: bash
  173. ssh-keygen -f "/home/myusername/.ssh/known_hosts" -R 192.168.1.60
  174. ssh debian@192.168.1.60
  175. su
  176. #+END_SRC
  177. Then make a new user. It's a bad idea to add users to the sudo group, because that then means that an attacker potentially only needs to know one password in order to get administrator access to the system. With no sudoers an attacker needs to know, or be able to obtain, two separate passwords to be able to really compromise the system.
  178. #+BEGIN_SRC: bash
  179. adduser myusername
  180. #+END_SRC
  181. Exit from the ssh login by typing "exit" a couple of times, then ssh back in as the new user. Make sure you use a difficult to guess password/phrase, or ideally a randomly generated password used together with a password manager such as KeepassX.
  182. Remove the default debian user.
  183. #+BEGIN_SRC: bash
  184. userdel -r debian
  185. #+END_SRC
  186. ** Text editor
  187. For an editor which is less erratic than vi when used within a remote console such as Terminator.
  188. #+BEGIN_SRC: bash
  189. apt-get update
  190. apt-get install emacs
  191. #+END_SRC
  192. Some basic Emacs keys which will be useful to new users are:
  193. | Load a file | CTRL-x CTRL-f |
  194. | Save | CTRL-x CTRL-s |
  195. | Exit | CTRL-x CTRL-c |
  196. ** Create a swap file
  197. Without a swap file the system may occasionally run out of memory and crash, since the Beaglebone only has 512MB of RAM. The following commands will create a 1GB swap file:
  198. #+BEGIN_SRC: bash
  199. mkdir -p /var/cache/swap/
  200. dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=1024
  201. chmod 600 /var/cache/swap/swapfile
  202. mkswap /var/cache/swap/swapfile
  203. swapon /var/cache/swap/swapfile
  204. #+END_SRC
  205. To tell the OS to load this swapfile on each start up.
  206. #+BEGIN_SRC: bash
  207. emacs /etc/fstab
  208. #+END_SRC
  209. Append the following line:
  210. #+BEGIN_SRC: bash
  211. /var/cache/swap/swapfile none swap sw 0 0
  212. #+END_SRC
  213. Then save and exit.
  214. To verify that the swapfile is accessilble type /top/ and look for the line which begins with "KiB Swap". Probably there will be zero bytes used, but this might be non-zero when the system is under some load (for example getting a lot of web views or being crawled by a search engine). CTRL-C exits from the /top/ command.
  215. ** Enable backports
  216. To enable some newer packages add backports to the repositories.
  217. #+BEGIN_SRC: bash
  218. echo "deb http://ftp.us.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list
  219. apt-get update
  220. apt-get dist-upgrade
  221. #+END_SRC
  222. ** Random number generation
  223. #+BEGIN_VERSE
  224. /Near as I can tell, the answer on what has been requested is everything: deliberate weakenings of encryption algorithms, deliberate weakenings of random number generations, copies of master keys, encryption of the session key with an NSA-specific key … everything./
  225. -- Bruce Schneier, on the 2013 leaked NSA documents
  226. #+END_VERSE
  227. The security of encryption depends upon the randomness of the random source used on your system. If it isn't very random then it may be far more vulnerable to cryptanalysis, and it's known that in the past some dubious agencies have encouraged the use of flawed random number generators to assist with their prurient activities. Randomness - typically referred to as /entropy/ - is often gathered from factors such as the timing of key presses or mouse movements, but since the BBB won't have such devices plugged into it this reduces the amount of entropy available.
  228. To improve entropy generation there are two options. One is to install a kernel module which enables the hardware crypto available on the BBB, but that's a bit complicated and might have some stability implications. The other option is to install [[http://www.issihosts.com/haveged/][havegd]]. While not as good as a true hardware random number generator, havegd is better than the default pseudo-random number generation within the Linux kernel. To install it:
  229. #+BEGIN_SRC: bash
  230. apt-get install haveged
  231. #+END_SRC
  232. At the time of writing there is also some hardware called [[http://beagleboard.org/project/CryptoCape/][cryptocape]] being developed, with the intention of adding extra random number generation capabilities to the BBB.
  233. ** Alter ssh configuration
  234. Altering the ssh configuration will make it a little more secure than the standard Debian settings.
  235. #+BEGIN_SRC: bash
  236. emacs /etc/ssh/sshd_config
  237. #+END_SRC
  238. Check the following values:
  239. #+BEGIN_SRC: bash
  240. PermitRootLogin no
  241. X11Forwarding no
  242. ServerKeyBits 4096
  243. Protocol 2
  244. PermitEmptyPasswords no
  245. StrictModes yes
  246. #+END_SRC
  247. Append the following:
  248. #+BEGIN_SRC: bash
  249. Ciphers aes256-ctr,aes192-ctr,aes128-ctr
  250. MACs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
  251. KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
  252. #+END_SRC
  253. CTRL-X CTRL-S to save, then CTRL-X CTRL-C to exit.
  254. #+BEGIN_SRC: bash
  255. service ssh restart
  256. #+END_SRC
  257. To test the new settings log out by typing "exit" a couple of times, then log back in again with:
  258. #+BEGIN_SRC: bash
  259. ssh -vvv myusername@192.168.1.60
  260. #+END_SRC
  261. and check that some number of bits are set within a 4096 bit sized key:
  262. #+BEGIN_SRC: bash
  263. debug2: bits set: */4096
  264. #+END_SRC
  265. ** Getting onto the web
  266. Create a subdomain on [[http://freedns.afraid.org][freeDNS]]. You may need to click on "/subdomains/" a couple of times. FreeDNS is preferred because it is one of the few domain name providers which supports genuinely free (as in beer) accounts. So if your budget is tiny or non-existent you can still participate as a first class citizen of the internet. If you do have money to spend there is also a premium option.
  267. Select "/dynamic DNS/" then click "/quick cron example/"
  268. An example would look like:
  269. #+BEGIN_SRC: bash
  270. 4,9,14,19,24,29,34,39,44,49,54,59 * * * * root sleep 29 ; wget -O - http://free\ dns.afraid.org/dynamic/update.php?ABCKDNRCLFHENSLKNFEGSBFLFF== >> /\ tmp/freedns_mysubdomain_us_to.log 2>&1 &
  271. #+END_SRC
  272. Edit */etc/crontab* and append that to the end of the file.
  273. Via your router's firewall settings you should now open port 22 (secure shell). This will allow you to ssh into your BBB from any location - not just your own local network.
  274. The freeDNS subdomain which you just created will hereafter just be refered to as "/your domain name/".
  275. ** Set the host name
  276. #+BEGIN_SRC: bash
  277. emacs /etc/hostname
  278. #+END_SRC
  279. CTRL-x CTRL-s to save, then CTRL-x CTRL-c to exit.
  280. Also issue the command, replacing /mydomainname.com/ with your domain name.
  281. #+BEGIN_SRC: bash
  282. hostname mydomainname.com
  283. #+END_SRC
  284. You may also need to assign the same hostname separately via your router's web interface.
  285. #+BEGIN_SRC: bash
  286. emacs /etc/hosts
  287. #+END_SRC
  288. Append the following, replacing /mydomainname.com/ with your domain name.
  289. #+BEGIN_SRC: bash
  290. 127.0.1.1 mydomainname.com
  291. #+END_SRC
  292. If you then run the command:
  293. #+BEGIN_SRC: bash
  294. hostname -f
  295. #+END_SRC
  296. it should return your domain name.
  297. ** Install NTP
  298. To synchronise time.
  299. #+BEGIN_SRC: bash
  300. apt-get install ntp
  301. #+END_SRC
  302. ** Install fail2ban
  303. #+BEGIN_SRC: bash
  304. apt-get install fail2ban
  305. #+END_SRC
  306. ** Set up a firewall
  307. #+BEGIN_VERSE
  308. /The documents, from a PowerPoint presentation prepared for a 2012 NSA conference called SIGDEV, show that the unit known as the Joint Threat Research Intelligence Group, or JTRIG, boasted of using the DDOS attack – which it dubbed Rolling Thunder/
  309. -- NBC News article: /War on Anonymous: British Spies Attacked Hackers, Snowden Docs Show/
  310. #+END_VERSE
  311. A basic firewall limits the maximum rate at which connections can be made and closes any unused ports, and this helps to defend against various kinds of DDOS attack.
  312. #+BEGIN_SRC: bash
  313. apt-get install portsentry
  314. emacs /etc/portsentry/portsentry.conf
  315. #+END_SRC
  316. Uncomment the entry for *iptables support for Linux*
  317. Set the following properties:
  318. #+BEGIN_SRC: bash
  319. TCP_PORTS="1,7,9,11,15,79,109,110,111,119,138,139,512,513,514,515,540,635,1080,1524,2000,2001,4000,4001,5742,6000,6001,6667,12345,12346,20034,27665,30303,32771,32772,32773,32774,31337,40421,40425,49724,54320"
  320. UDP_PORTS="1,7,9,66,67,68,69,111,137,138,161,162,474,513,517,518,635,640,641,666,700,2049,31335,27444,34555,32770,32771,32772,32773,32774,31337,54321"
  321. ADVANCED_EXCLUDE_TCP="113,139,70,80,443,143,6670,993,5060,5061,25,465,22,5222,5223,5269,5280,5281,8444"
  322. ADVANCED_EXCLUDE_UDP="520,138,137,67,70,80,443,143,6670,993, 5060,5061,25,465,22,5222,5223,5269,5280,5281,8444"
  323. SCAN_TRIGGER="2"
  324. BLOCK_UDP="2"
  325. BLOCK_TCP="2"
  326. #+END_SRC
  327. Save and exit.
  328. #+BEGIN_SRC: bash
  329. service portsentry restart
  330. emacs /tmp/firewall.sh
  331. #+END_SRC
  332. Enter the following:
  333. #+BEGIN_SRC: bash
  334. #!/bin/bash
  335. # Enable syn cookies
  336. echo 1 > /proc/sys/net/ipv4/tcp_syncookies
  337. # Other settings
  338. echo 1 > /proc/sys/net/ipv4/tcp_keepalive_probes
  339. echo 2 > /proc/sys/net/ipv4/tcp_synack_retries
  340. echo 1 > /proc/sys/net/ipv4/tcp_syn_retries
  341. # First of all delete any existing rules.
  342. # This means you're back to a known state:
  343. iptables -P INPUT ACCEPT
  344. iptables -F
  345. iptables -X
  346. # Drop access to unused ports
  347. iptables -A INPUT -p tcp --destination-port 1 -j DROP
  348. iptables -A INPUT -p tcp --destination-port 7 -j DROP
  349. iptables -A INPUT -p tcp --destination-port 109:111 -j DROP
  350. iptables -A INPUT -p tcp --destination-port 995 -j DROP
  351. iptables -A INPUT -p tcp --destination-port 139 -j DROP
  352. iptables -A INPUT -p tcp --destination-port 6000:6001 -j DROP
  353. iptables -A INPUT -p tcp --destination-port 9 -j DROP
  354. iptables -A INPUT -p tcp --destination-port 79 -j DROP
  355. iptables -A INPUT -p tcp --destination-port 515 -j DROP
  356. iptables -A INPUT -p tcp --destination-port 4001 -j DROP
  357. iptables -A INPUT -p tcp --destination-port 1524 -j DROP
  358. iptables -A INPUT -p tcp --destination-port 1080 -j DROP
  359. iptables -A INPUT -p tcp --destination-port 512:514 -j DROP
  360. iptables -A INPUT -p tcp --destination-port 31337 -j DROP
  361. iptables -A INPUT -p tcp --destination-port 2000:2001 -j DROP
  362. iptables -A INPUT -p tcp --destination-port 12345 -j DROP
  363. iptables -A INPUT -p tcp --destination-port 32771:32774 -j DROP
  364. iptables -A INPUT -p tcp --destination-port 4000 -j DROP
  365. iptables -A INPUT -p tcp --destination-port 119 -j DROP
  366. iptables -A INPUT -p tcp --destination-port 137 -j DROP
  367. iptables -A INPUT -p udp --destination-port 1 -j DROP
  368. iptables -A INPUT -p udp --destination-port 7 -j DROP
  369. iptables -A INPUT -p udp --destination-port 109:111 -j DROP
  370. iptables -A INPUT -p udp --destination-port 995 -j DROP
  371. iptables -A INPUT -p udp --destination-port 139 -j DROP
  372. iptables -A INPUT -p udp --destination-port 6000:6001 -j DROP
  373. iptables -A INPUT -p udp --destination-port 9 -j DROP
  374. iptables -A INPUT -p udp --destination-port 79 -j DROP
  375. iptables -A INPUT -p udp --destination-port 515 -j DROP
  376. iptables -A INPUT -p udp --destination-port 4001 -j DROP
  377. iptables -A INPUT -p udp --destination-port 1524 -j DROP
  378. iptables -A INPUT -p udp --destination-port 1080 -j DROP
  379. iptables -A INPUT -p udp --destination-port 512:514 -j DROP
  380. iptables -A INPUT -p udp --destination-port 31337 -j DROP
  381. iptables -A INPUT -p udp --destination-port 2000:2001 -j DROP
  382. iptables -A INPUT -p udp --destination-port 12345 -j DROP
  383. iptables -A INPUT -p udp --destination-port 32771:32774 -j DROP
  384. iptables -A INPUT -p udp --destination-port 4000 -j DROP
  385. iptables -A INPUT -p udp --destination-port 119 -j DROP
  386. iptables -A INPUT -p udp --destination-port 137 -j DROP
  387. # Make sure NEW incoming tcp connections are SYN packets
  388. iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
  389. # Drop packets with incoming fragments
  390. iptables -A INPUT -f -j DROP
  391. # Incoming malformed XMAS packets drop them
  392. iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
  393. iptables -A INPUT -p tcp --tcp-flags ALL FIN,PSH,URG -j DROP
  394. iptables -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
  395. # Incoming malformed NULL packets:
  396. iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
  397. # Drop UDP to used ports
  398. iptables -A INPUT -p udp --match multiport --dports 70,80,443,143,6670,993,5060,5061,25 -j DROP
  399. iptables -A INPUT -p udp --match multiport --dports 465,22,5222,5223,5269,5280,5281,8444 -j DROP
  400. # Limit ssh logins
  401. iptables -A INPUT -p tcp --dport 22 -m limit --limit 3/minute --limit-burst 1 -j ACCEPT
  402. # Limit web connections
  403. iptables -A INPUT -p tcp --dport 80 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  404. iptables -A INPUT -p tcp --dport 443 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  405. # Limit number of XMPP connections
  406. iptables -A INPUT -p tcp --match multiport --dports 5222:5223,5269,5280:5281 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  407. # Limit IRC connections
  408. iptables -A INPUT -p tcp --dport 6666:6670 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  409. # Limit gopher connections
  410. iptables -A INPUT -p tcp --dport 70 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  411. # Limit IMAP connections
  412. iptables -A INPUT -p tcp --dport 143 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  413. iptables -A INPUT -p tcp --dport 993 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  414. # Limit SIP connections
  415. iptables -A INPUT -p tcp --dport 5060:5061 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  416. # Limit SMTP/SMTPS connections
  417. iptables -A INPUT -p tcp --dport 25 -m limit --limit 3/minute --limit-burst 1 -j ACCEPT
  418. iptables -A INPUT -p tcp --dport 465 -m limit --limit 3/minute --limit-burst 1 -j ACCEPT
  419. # Limit Bitmessage connections
  420. iptables -A INPUT -p tcp --dport 8444 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  421. # Limit the number of incoming tcp connections
  422. # Interface 0 incoming syn-flood protection
  423. iptables -N syn_flood
  424. iptables -A INPUT -p tcp --syn -j syn_flood
  425. iptables -A syn_flood -m limit --limit 1/s --limit-burst 3 -j RETURN
  426. iptables -A syn_flood -j DROP
  427. # Limiting the incoming icmp ping request:
  428. #iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j ACCEPT
  429. #iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j LOG --log-prefix PING-DROP:
  430. iptables -A INPUT -p icmp -j DROP
  431. #iptables -A OUTPUT -p icmp -j ACCEPT
  432. # Save the settings
  433. iptables-save > /etc/firewall.conf
  434. echo '#!/bin/sh' > /etc/network/if-up.d/iptables
  435. echo 'iptables-restore < /etc/firewall.conf' >> /etc/network/if-up.d/iptables
  436. chmod +x /etc/network/if-up.d/iptables
  437. #+END_SRC
  438. Save and exit
  439. #+BEGIN_SRC: bash
  440. chmod +x /tmp/firewall.sh
  441. . /tmp/firewall.sh
  442. rm /tmp/firewall.sh
  443. #+END_SRC
  444. Also disable ping. This may be inconvenient to some extent, but it seems common for malicious systems, including but not limited to the [[http://www.nbcnews.com/news/investigations/snowden-docs-british-spies-used-sex-dirty-tricks-n23091][JTRIG "EFFECTS" team]], to try to disable the machine by flooding it with pings. These days there seems to be not much difference between "cybercrime" and nefarious state-sponsored internet activities.
  445. #+BEGIN_SRC: bash
  446. emacs /etc/sysctl.conf
  447. #+END_SRC
  448. Uncomment or change the following:
  449. #+BEGIN_SRC: bash
  450. net.ipv4.conf.all.accept_redirects = 0
  451. net.ipv6.conf.all.accept_redirects = 0
  452. net.ipv4.conf.all.send_redirects = 0
  453. net.ipv4.conf.all.accept_source_route = 0
  454. net.ipv6.conf.all.accept_source_route = 0
  455. net.ipv4.conf.default.rp_filter=1
  456. net.ipv4.conf.all.rp_filter=1
  457. #+END_SRC
  458. And append the following:
  459. #+BEGIN_SRC: bash
  460. # ignore pings
  461. net.ipv4.icmp_echo_ignore_all = 1
  462. #+END_SRC
  463. Save and exit. It may be a good idea to reboot at this point and then log back into the BBB using ssh. You can do a safe reboot of the system by typing:
  464. #+BEGIN_SRC: bash
  465. reboot
  466. #+END_SRC
  467. ** Install Email
  468. #+BEGIN_VERSE
  469. /If you knew what I know about email, you might not use it/
  470. -- Ladar Levison
  471. #+END_VERSE
  472. Email is not very secure, but its usefulness and ubiquity mean that it's likely to continue as a primary communications method for many years to come. You can encrypt the contents of email using PGP/GPG, but very few people do that and even for those that do the metadata (the From/To/CC/BCC) is always transmitted in the clear as a fundamental aspect of the protocol, allowing an attacker to easily construct detailed models of people's social network and life patterns even without knowing the content.
  473. Exim4 seems much easier to install and configure than Postfix.
  474. #+BEGIN_SRC: bash
  475. aptitude install exim4 sasl2-bin swaks libnet-ssleay-perl procmail
  476. #+END_SRC
  477. You will be prompted to remove postfix. Say yes and yes again.
  478. #+BEGIN_SRC: bash
  479. dpkg-reconfigure exim4-config
  480. #+END_SRC
  481. Settings as follows:
  482. #+BEGIN_SRC: bash
  483. internet site
  484. System mail name: mydomainname.com
  485. IP addresses to listen on: blank
  486. Destinations: mydomainname.com
  487. Domains to relay mail: blank
  488. Smarthost Relay: 192.168.1.0/60 (the range of addresses on your LAN)
  489. Dial on demand = no
  490. Maildir format in home directory
  491. Split configuration = no
  492. Root and postmaster: root email
  493. #+END_SRC
  494. To test the installation:
  495. #+BEGIN_SRC: bash
  496. telnet 192.168.1.60 25
  497. ehlo xxx
  498. quit
  499. #+END_SRC
  500. #+BEGIN_SRC: bash
  501. emacs /etc/default/saslauthd
  502. #+END_SRC
  503. set START=yes then save and exit.
  504. #+BEGIN_SRC: bash
  505. /etc/init.d/saslauthd start
  506. emacs exim-gencert
  507. #+END_SRC
  508. #+BEGIN_SRC: bash
  509. #!/bin/sh -e
  510. if [ -n "$EX4DEBUG" ]; then
  511. echo "now debugging $0 $@"
  512. set -x
  513. fi
  514. DIR=/etc/exim4
  515. CERT=$DIR/exim.crt
  516. KEY=$DIR/exim.key
  517. # This exim binary was built with GnuTLS which does not support dhparams
  518. # from a file. See /usr/share/doc/exim4-base/README.Debian.gz
  519. #DH=$DIR/exim.dhparam
  520. if ! which openssl > /dev/null ;then
  521. echo "$0: openssl is not installed, exiting" 1>&2
  522. exit 1
  523. fi
  524. # valid for ten years
  525. DAYS=3650
  526. if [ "$1" != "--force" ] && [ -f $CERT ] && [ -f $KEY ]; then
  527. echo "[*] $CERT and $KEY exists!"
  528. echo " Use \"$0 --force\" to force generation!"
  529. exit 0
  530. fi
  531. if [ "$1" = "--force" ]; then
  532. shift
  533. fi
  534. #SSLEAY=/tmp/exim.ssleay.$$.cnf
  535. SSLEAY="$(tempfile -m600 -pexi)"
  536. cat > $SSLEAY <<EOM
  537. RANDFILE = $HOME/.rnd
  538. [ req ]
  539. default_bits = 4096
  540. default_keyfile = exim.key
  541. distinguished_name = req_distinguished_name
  542. [ req_distinguished_name ]
  543. countryName = Country Code (2 letters)
  544. countryName_default = GB
  545. countryName_min = 2
  546. countryName_max = 2
  547. stateOrProvinceName = State or Province Name (full name)
  548. localityName = Locality Name (eg, city)
  549. organizationName = Organization Name (eg, company; recommended)
  550. organizationName_max = 64
  551. organizationalUnitName = Organizational Unit Name (eg, section)
  552. organizationalUnitName_max = 64
  553. commonName = Server name (eg. ssl.domain.tld; required!!!)
  554. commonName_max = 64
  555. emailAddress = Email Address
  556. emailAddress_max = 40
  557. EOM
  558. echo "[*] Creating a self signed SSL certificate for Exim!"
  559. echo " This may be sufficient to establish encrypted connections but for"
  560. echo " secure identification you need to buy a real certificate!"
  561. echo " "
  562. echo " Please enter the hostname of your MTA at the Common Name (CN) prompt!"
  563. echo " "
  564. openssl req -config $SSLEAY -x509 -sha256 -newkey rsa:4096 -keyout $KEY -out $CERT -days $DAYS -nodes
  565. #see README.Debian.gz*# openssl dhparam -check -text -5 512 -out $DH
  566. rm -f $SSLEAY
  567. chown root:Debian-exim $KEY $CERT $DH
  568. chmod 640 $KEY $CERT $DH
  569. echo "[*] Done generating self signed certificates for exim!"
  570. echo " Refer to the documentation and example configuration files"
  571. echo " over at /usr/share/doc/exim4-base/ for an idea on how to enable TLS"
  572. echo " support in your mail transfer agent."
  573. #+END_SRC
  574. Save and exit
  575. #+BEGIN_SRC: bash
  576. chmod +x exim-gencert
  577. ./exim-gencert
  578. #+END_SRC
  579. This will generate the certificate used for email authentication. You will be asked for various details, the most important of which is the server name, which should be your domain name.
  580. #+BEGIN_SRC: bash
  581. emacs /etc/exim4/exim4.conf.template
  582. #+END_SRC
  583. Append the following:
  584. #+BEGIN_SRC: bash
  585. login_saslauthd_server:
  586. driver = plaintext
  587. public_name = LOGIN
  588. server_prompts = "Username:: : Password::"
  589. # don't send system passwords over unencrypted connections
  590. server_condition = ${if saslauthd{{$auth1}{$auth2}}{1}{0}}
  591. server_set_id = $auth1
  592. .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  593. server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}
  594. .endif
  595. #+END_SRC
  596. Search for the line *.ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME* and above it insert the line:
  597. #+BEGIN_SRC: bash
  598. MAIN_HARDCODE_PRIMARY_HOSTNAME = mydomainname.com
  599. #+END_SRC
  600. Save and exit.
  601. #+BEGIN_SRC: bash
  602. emacs /etc/exim4/exim4.conf.template
  603. #+END_SRC
  604. Add the line:
  605. #+BEGIN_SRC: bash
  606. MAIN_TLS_ENABLE = true
  607. #+END_SRC
  608. Save and exit.
  609. #+BEGIN_SRC: bash
  610. emacs /etc/default/exim4
  611. change SMTPLISTENEROPTIONS to:
  612. SMTPLISTENEROPTIONS='-oX 465:25 -oP /var/run/exim4/exim.pid'
  613. #+END_SRC
  614. save and exit
  615. #+BEGIN_SRC: bash
  616. emacs /etc/exim4/exim4.conf.template
  617. under the section "main/03_exim4-config_tlsoptions"
  618. Add the following:
  619. tls_on_connect_ports=465
  620. #+END_SRC
  621. save and exit
  622. #+BEGIN_SRC: bash
  623. adduser myusername sasl
  624. addgroup Debian-exim sasl
  625. /etc/init.d/exim4 restart
  626. mkdir -m 700 /etc/skel/Maildir
  627. mkdir -m 700 /etc/skel/Maildir/sent
  628. mkdir -m 700 /etc/skel/Maildir/sent/tmp
  629. mkdir -m 700 /etc/skel/Maildir/sent/cur
  630. mkdir -m 700 /etc/skel/Maildir/sent/new
  631. #+END_SRC
  632. If you're starting from scratch and don't already have a /Maildir/ directory in your home directory, then create one as follows:
  633. #+BEGIN_SRC: bash
  634. export MYUSERNAME=myusername
  635. mkdir -m 700 /home/$MYUSERNAME/Maildir
  636. mkdir -m 700 /home/$MYUSERNAME/Maildir/cur
  637. mkdir -m 700 /home/$MYUSERNAME/Maildir/tmp
  638. mkdir -m 700 /home/$MYUSERNAME/Maildir/new
  639. mkdir -m 700 /home/$MYUSERNAME/Maildir/sent
  640. mkdir -m 700 /home/$MYUSERNAME/Maildir/sent/cur
  641. mkdir -m 700 /home/$MYUSERNAME/Maildir/sent/tmp
  642. mkdir -m 700 /home/$MYUSERNAME/Maildir/sent/new
  643. chown -R $MYUSERNAME:$MYUSERNAME /home/$MYUSERNAME/Maildir
  644. #+END_SRC
  645. ** Spam filtering
  646. #+BEGIN_SRC: bash
  647. apt-get install spamassassin exim4-daemon-heavy
  648. emacs /etc/default/spamassassin
  649. #+END_SRC
  650. Set ENABLED=1 then save and exit.
  651. #+BEGIN_SRC: bash
  652. emacs /etc/exim4/exim4.conf.template
  653. #+END_SRC
  654. uncomment or change according to your configuration
  655. #+BEGIN_SRC: bash
  656. # For spam scanning, there is a similar option that defines the interface to
  657. # SpamAssassin. You do not need to set this if you are using the default, which
  658. # is shown in this commented example. As for virus scanning, you must also
  659. # modify the acl_check_data access control list to enable spam scanning.
  660. spamd_address = 127.0.0.1 783
  661. #+END_SRC
  662. add spam header in the /acl_check_data/ section:
  663. #+BEGIN_SRC: bash
  664. ### acl/40_exim4-config_check_data
  665. #################################
  666. # This ACL is used after the contents of a message have been received. This
  667. # is the ACL in which you can test a message's headers or body, and in
  668. # particular, this is where you can invoke external virus or spam scanners.
  669. acl_check_data:
  670. ...
  671. ...
  672. ...
  673. # See the exim docs and the exim wiki for more suitable examples.
  674. #
  675. # warn
  676. # spam = Debian-exim:true
  677. # add_header = X-Spam_score: $spam_score\n\
  678. # X-Spam_score_int: $spam_score_int\n\
  679. # X-Spam_bar: $spam_bar\n\
  680. # X-Spam_report: $spam_report
  681. # put headers in all messages (no matter if spam or not)
  682. warn spam = nobody:true
  683. add_header = X-Spam-Score: $spam_score ($spam_bar)
  684. add_header = X-Spam-Report: $spam_report
  685. # add second subject line with *SPAM* marker when message
  686. # is over threshold
  687. warn spam = nobody
  688. add_header = Subject: ***SPAM (score:$spam_score)*** $h_Subject:
  689. #+END_SRC
  690. Save and exit.
  691. Then restart
  692. #+BEGIN_SRC: bash
  693. exit
  694. emacs ~/.procmailrc
  695. #+END_SRC
  696. The text should look like the following.
  697. #+BEGIN_SRC: sh
  698. MAILDIR=$HOME/Maildir
  699. DEFAULT=$MAILDIR/
  700. LOGFILE=$HOME/log/procmail.log
  701. LOGABSTRACT=all
  702. # get spamassassin to check emails
  703. :0fw: .spamassassin.lock
  704. * < 256000
  705. | spamc
  706. # strong spam are discarded
  707. :0
  708. * ^X-Spam-Level: \*\*\*\*\*\*
  709. /dev/null
  710. # weak spam are kept just in case - clear this out every now and then
  711. :0
  712. * ^X-Spam-Level: \*\*\*\*\*
  713. .0-spam/
  714. # otherwise, marginal spam goes here for revision
  715. :0
  716. * ^X-Spam-Level: \*\*
  717. .spam/
  718. #+END_SRC
  719. Save and exit.
  720. #+BEGIN_SRC: bash
  721. su
  722. emacs /usr/bin/filterspam
  723. #+END_SRC
  724. Add the following contents:
  725. #+BEGIN_SRC: bash
  726. #!/bin/bash
  727. USERNAME=$1
  728. MAILDIR=/home/$USERNAME/Maildir/.learn-spam
  729. if [ ! -d "$MAILDIR" ]; then
  730. exit
  731. fi
  732. for f in `ls $MAILDIR/cur`
  733. do
  734. spamc -L spam < "$MAILDIR/cur/$f" > /dev/null
  735. rm "$MAILDIR/cur/$f"
  736. done
  737. for f in `ls $MAILDIR/new`
  738. do
  739. spamc -L spam < "$MAILDIR/new/$f" > /dev/null
  740. rm "$MAILDIR/new/$f"
  741. done
  742. #+END_SRC
  743. Save and exit.
  744. #+BEGIN_SRC: bash
  745. emacs /usr/bin/filterham
  746. #+END_SRC
  747. Add the following contents:
  748. #+BEGIN_SRC: bash
  749. #!/bin/bash
  750. USERNAME=$1
  751. MAILDIR=/home/$USERNAME/Maildir/.learn-ham
  752. if [ ! -d "$MAILDIR" ]; then
  753. exit
  754. fi
  755. for f in `ls $MAILDIR/cur`
  756. do
  757. spamc -L ham < "$MAILDIR/cur/$f" > /dev/null
  758. rm "$MAILDIR/cur/$f"
  759. done
  760. for f in `ls $MAILDIR/new`
  761. do
  762. spamc -L ham < "$MAILDIR/new/$f" > /dev/null
  763. rm "$MAILDIR/new/$f"
  764. done
  765. #+END_SRC
  766. Save and exit.
  767. #+BEGIN_SRC: bash
  768. emacs /etc/crontab
  769. #+END_SRC
  770. Append the following, replacing *myusername* with your username.
  771. #+BEGIN_SRC: bash
  772. */3 * * * * root /usr/bin/filterspam myusername
  773. */3 * * * * root /usr/bin/filterham myusername
  774. #+END_SRC
  775. Save and exit.
  776. #+BEGIN_SRC: bash
  777. chmod 655 /usr/bin/filterspam /usr/bin/filterham
  778. service spamassassin restart
  779. service exim4 restart
  780. service cron restart
  781. #+END_SRC
  782. ** Install Dovecot
  783. Install the required packages.
  784. #+BEGIN_SRC: bash
  785. aptitude -y install dovecot-common dovecot-pop3d dovecot-imapd
  786. #+END_SRC
  787. Edit the configuration file.
  788. #+BEGIN_SRC: bash
  789. emacs /etc/dovecot/dovecot.conf
  790. #+END_SRC
  791. Line 26: change:
  792. #+BEGIN_SRC: bash
  793. listen = *
  794. #+END_SRC
  795. Save and exit.
  796. #+BEGIN_SRC: bash
  797. emacs /etc/dovecot/conf.d/10-auth.conf
  798. #+END_SRC
  799. Line 9: uncomment and change (allow plain text auth)
  800. #+BEGIN_SRC: bash
  801. disable_plaintext_auth = no
  802. #+END_SRC
  803. Line 99: add:
  804. #+BEGIN_SRC: bash
  805. auth_mechanisms = plain login
  806. #+END_SRC
  807. Save and exit.
  808. #+BEGIN_SRC: bash
  809. emacs /etc/dovecot/conf.d/10-mail.conf
  810. #+END_SRC
  811. Line 30: uncomment and add:
  812. #+BEGIN_SRC: bash
  813. mail_location = maildir:~/Maildir:LAYOUT=fs
  814. #+END_SRC
  815. Save and exit, then start the dovecot service.
  816. #+BEGIN_SRC: bash
  817. service dovecot restart
  818. #+END_SRC
  819. ** Create Email folders and rules
  820. A common situation with email is that you may be subscribed to various mailing lists and want incoming email from those to be automatically grouped into a separate folder for each list.
  821. We can make a script to make adding mailing list rules easy:
  822. #+BEGIN_SRC: bash
  823. emacs /usr/bin/mailinglistrule
  824. #+END_SRC
  825. Add the following:
  826. #+BEGIN_SRC: bash
  827. #!/bin/bash
  828. MYUSERNAME=$1
  829. MAILINGLIST=$2
  830. SUBJECTTAG=$3
  831. MUTTRC=/home/$MYUSERNAME/.muttrc
  832. PM=/home/$MYUSERNAME/.procmailrc
  833. LISTDIR=/home/$MYUSERNAME/Maildir/$MAILINGLIST
  834. if [ ! -d "$LISTDIR" ]; then
  835. mkdir -m 700 $LISTDIR
  836. mkdir -m 700 $LISTDIR/tmp
  837. mkdir -m 700 $LISTDIR/new
  838. mkdir -m 700 $LISTDIR/cur
  839. fi
  840. chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR
  841. echo "" >> $PM
  842. echo ":0" >> $PM
  843. echo " * ^Subject:.*()\[$SUBJECTTAG\]" >> $PM
  844. echo "$LISTDIR/new" >> $PM
  845. chown $MYUSERNAME:$MYUSERNAME $PM
  846. if [ ! -f "$MUTTRC" ]; then
  847. cp /etc/Muttrc $MUTTRC
  848. chown $MYUSERNAME:$MYUSERNAME $MUTTRC
  849. fi
  850. #+END_SRC
  851. Save and exit, then make the script executable.
  852. #+BEGIN_SRC: bash
  853. chmod +x /usr/bin/mailinglistrule
  854. #+END_SRC
  855. Now we can add a new mailing list rule with the following, where /myusername/ is your username, /mailinglistname/ is the name of the mailing list (with no spaces) and /subjecttag/ is the tag which usually appears within square brackets in the subject line of emails from the list.
  856. #+BEGIN_SRC: bash
  857. mailinglistrule myusername mailinglistname subjecttag
  858. #+END_SRC
  859. Repeat this command for as many mailing lists as you need. Then edit your local Mutt configuration.
  860. #+BEGIN_SRC: bash
  861. emacs /home/myusername/.muttrc
  862. #+END_SRC
  863. Search for the *mailboxes* variable and add entries for the mailing lists you just created. For example:
  864. #+BEGIN_SRC: bash
  865. mailboxes = =sent =mailinglistname
  866. #+END_SRC
  867. Then save and exit.
  868. ** Setting up a web site
  869. #+BEGIN_VERSE
  870. /It's important to have the geek community as a whole think about its responsibility and what it can do. We need various alternative voices pushing back on conventional government sometimes./
  871. -- Tim Berners-Lee
  872. #+END_VERSE
  873. Edit the apache configuration so that it doesn't run out of memory if there are a lot of connections.
  874. #+BEGIN_SRC: bash
  875. su
  876. emacs /etc/apache2/apache2.conf
  877. #+END_SRC
  878. Search for MaxClients and replace the value with 6. As an example the settings should look something like this:
  879. #+BEGIN_SRC: bash
  880. <IfModule mpm_prefork_module>
  881. StartServers 3
  882. MinSpareServers 3
  883. MaxSpareServers 5
  884. MaxClients 6
  885. MaxRequestsPerChild 0
  886. </IfModule>
  887. <IfModule mpm_worker_module>
  888. StartServers 2
  889. MinSpareThreads 25
  890. MaxSpareThreads 75
  891. ThreadLimit 64
  892. ThreadsPerChild 25
  893. MaxClients 6
  894. MaxRequestsPerChild 0
  895. </IfModule>
  896. <IfModule mpm_event_module>
  897. StartServers 2
  898. MinSpareThreads 25
  899. MaxSpareThreads 75
  900. ThreadLimit 64
  901. ThreadsPerChild 25
  902. MaxClients 6
  903. MaxRequestsPerChild 0
  904. </IfModule>
  905. #+END_SRC
  906. Then save and exit In the examples below replace /mydomainname.com/ with your own domain name.
  907. #+BEGIN_SRC: bash
  908. export HOSTNAME=mydomainname.com
  909. mkdir /var/www/$HOSTNAME
  910. mkdir /var/www/$HOSTNAME/htdocs
  911. emacs /etc/apache2/sites-available/$HOSTNAME
  912. #+END_SRC
  913. The Apache configuration for the site should look something like the following. Replace /mydonainname.com/ with the site domain name.
  914. #+BEGIN_SRC: bash
  915. <VirtualHost *:80>
  916. ServerAdmin myusername@mydomainname.com
  917. ServerName mydomainname.com
  918. DocumentRoot /var/www/mydomainname.com/htdocs
  919. <Directory />
  920. Options FollowSymLinks
  921. AllowOverride All
  922. </Directory>
  923. <Directory /var/www/mydomainname.com/htdocs/>
  924. Options All
  925. AllowOverride All
  926. Order allow,deny
  927. allow from all
  928. </Directory>
  929. # Don't serve .php~ or .php# files created by emacs
  930. <Files ~ "(^#.*#|~|\.sw[op])$">
  931. Order allow,deny
  932. Deny from all
  933. </Files>
  934. <IfModule headers_module>
  935. Header set X-Content-Type-Options nosniff
  936. Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate, private"
  937. Header set Pragma no-cache
  938. </IfModule>
  939. <Files .htaccess>
  940. deny from all
  941. </Files>
  942. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  943. <Directory "/usr/lib/cgi-bin">
  944. AllowOverride All
  945. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  946. Order allow,deny
  947. Allow from all
  948. </Directory>
  949. ErrorLog ${APACHE_LOG_DIR}/error.log
  950. # Possible values include: debug, info, notice, warn, error, crit,
  951. # alert, emerg.
  952. LogLevel error
  953. CustomLog ${APACHE_LOG_DIR}/access.log combined
  954. </VirtualHost>
  955. <IfModule mod_ssl.c>
  956. <VirtualHost *:443>
  957. ServerAdmin myusername@mydomainname.com
  958. ServerName mydomainname.com
  959. DocumentRoot /var/www/mydomainname.com/htdocs
  960. <Directory />
  961. Options FollowSymLinks
  962. AllowOverride All
  963. </Directory>
  964. <Directory /var/www/mydomainname.com/htdocs/>
  965. Options All
  966. AllowOverride All
  967. Order allow,deny
  968. allow from all
  969. </Directory>
  970. # Don't serve .php~ or .php# files created by emacs
  971. <Files ~ "(^#.*#|~|\.sw[op])$">
  972. Order allow,deny
  973. Deny from all
  974. </Files>
  975. <IfModule headers_module>
  976. Header set X-Content-Type-Options nosniff
  977. Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate, private"
  978. Header set Pragma no-cache
  979. </IfModule>
  980. <Files .htaccess>
  981. deny from all
  982. </Files>
  983. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  984. <Directory "/usr/lib/cgi-bin">
  985. AllowOverride All
  986. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  987. Order allow,deny
  988. Allow from all
  989. </Directory>
  990. ErrorLog ${APACHE_LOG_DIR}/error.log
  991. # Possible values include: debug, info, notice, warn, error, crit,
  992. # alert, emerg.
  993. LogLevel error
  994. CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
  995. # SSL Engine Switch:
  996. # Enable/Disable SSL for this virtual host.
  997. SSLEngine on
  998. # A self-signed certificate
  999. SSLCertificateFile /etc/ssl/certs/mydomainname.com.crt
  1000. SSLCertificateKeyFile /etc/ssl/private/mydomainname.com.key
  1001. # Options based on bettercrypto.org
  1002. SSLProtocol All -SSLv2 -SSLv3
  1003. SSLHonorCipherOrder On
  1004. SSLCompression off
  1005. SSLCipherSuite EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
  1006. # Add six earth month HSTS header for all users ...
  1007. Header add Strict-Transport-Security "max-age=15768000"
  1008. # If you want to protect all subdomains , use the following header
  1009. # ALL subdomains HAVE TO support https if you use this !
  1010. # Strict-Transport-Security: max-age=15768000 ; includeSubDomains
  1011. # SSL Engine Options:
  1012. # Set various options for the SSL engine.
  1013. # o FakeBasicAuth:
  1014. # Translate the client X.509 into a Basic Authorisation. This means that
  1015. # the standard Auth/DBMAuth methods can be used for access control. The
  1016. # user name is the `one line' version of the client's X.509 certificate.
  1017. # Note that no password is obtained from the user. Every entry in the user
  1018. # file needs this password: `xxj31ZMTZzkVA'.
  1019. # o ExportCertData:
  1020. # This exports two additional environment variables: SSL_CLIENT_CERT and
  1021. # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
  1022. # server (always existing) and the client (only existing when client
  1023. # authentication is used). This can be used to import the certificates
  1024. # into CGI scripts.
  1025. # o StdEnvVars:
  1026. # This exports the standard SSL/TLS related `SSL_*' environment variables.
  1027. # Per default this exportation is switched off for performance reasons,
  1028. # because the extraction step is an expensive operation and is usually
  1029. # useless for serving static content. So one usually enables the
  1030. # exportation for CGI and SSI requests only.
  1031. # o StrictRequire:
  1032. # This denies access when "SSLRequireSSL" or "SSLRequire" applied even
  1033. # under a "Satisfy any" situation, i.e. when it applies access is denied
  1034. # and no other module can change it.
  1035. # o OptRenegotiate:
  1036. # This enables optimized SSL connection renegotiation handling when SSL
  1037. # directives are used in per-directory context.
  1038. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
  1039. <FilesMatch "\.(cgi|shtml|phtml|php)$">
  1040. SSLOptions +StdEnvVars
  1041. </FilesMatch>
  1042. <Directory /usr/lib/cgi-bin>
  1043. SSLOptions +StdEnvVars
  1044. </Directory>
  1045. # SSL Protocol Adjustments:
  1046. # The safe and default but still SSL/TLS standard compliant shutdown
  1047. # approach is that mod_ssl sends the close notify alert but doesn't wait for
  1048. # the close notify alert from client. When you need a different shutdown
  1049. # approach you can use one of the following variables:
  1050. # o ssl-unclean-shutdown:
  1051. # This forces an unclean shutdown when the connection is closed, i.e. no
  1052. # SSL close notify alert is send or allowed to received. This violates
  1053. # the SSL/TLS standard but is needed for some brain-dead browsers. Use
  1054. # this when you receive I/O errors because of the standard approach where
  1055. # mod_ssl sends the close notify alert.
  1056. # o ssl-accurate-shutdown:
  1057. # This forces an accurate shutdown when the connection is closed, i.e. a
  1058. # SSL close notify alert is send and mod_ssl waits for the close notify
  1059. # alert of the client. This is 100% SSL/TLS standard compliant, but in
  1060. # practice often causes hanging connections with brain-dead browsers. Use
  1061. # this only for browsers where you know that their SSL implementation
  1062. # works correctly.
  1063. # Notice: Most problems of broken clients are also related to the HTTP
  1064. # keep-alive facility, so you usually additionally want to disable
  1065. # keep-alive for those clients, too. Use variable "nokeepalive" for this.
  1066. # Similarly, one has to force some clients to use HTTP/1.0 to workaround
  1067. # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
  1068. # "force-response-1.0" for this.
  1069. BrowserMatch "MSIE [2-6]" \
  1070. nokeepalive ssl-unclean-shutdown \
  1071. downgrade-1.0 force-response-1.0
  1072. # MSIE 7 and newer should be able to use keepalive
  1073. BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
  1074. </VirtualHost>
  1075. </IfModule>
  1076. #+END_SRC
  1077. Then to enable the site:
  1078. #+BEGIN_SRC: bash
  1079. a2ensite
  1080. a2dissite default
  1081. a2dissite default-ssl
  1082. a2enmod rewrite
  1083. a2enmod headers
  1084. #+END_SRC
  1085. Ensure that "NameVirtualHost *:443" is added to /etc/apache2/ports.conf. It should look something like the following:
  1086. #+BEGIN_SRC: bash
  1087. NameVirtualHost *:80
  1088. Listen 80
  1089. <IfModule mod_ssl.c>
  1090. NameVirtualHost *:443
  1091. Listen 443
  1092. </IfModule>
  1093. <IfModule mod_gnutls.c>
  1094. NameVirtualHost *:443
  1095. Listen 443
  1096. </IfModule>
  1097. #+END_SRC
  1098. Create a self-signed certificate. The passphrase isn't important and will be removed, so make it easy (such as "password").
  1099. #+BEGIN_SRC: bash
  1100. emacs makecert
  1101. #+END_SRC
  1102. Enter the following:
  1103. #+BEGIN_SRC: bash
  1104. #!/bin/bash
  1105. HOSTNAME=$1
  1106. openssl genrsa -des3 -out $HOSTNAME.key 1024
  1107. openssl req -new -x509 -nodes -sha1 -days 3650 -key $HOSTNAME.key -out $HOSTNAME.crt
  1108. openssl rsa -in $HOSTNAME.key -out $HOSTNAME.new.key
  1109. cp $HOSTNAME.new.key $HOSTNAME.key
  1110. rm $HOSTNAME.new.key
  1111. cp $HOSTNAME.key /etc/ssl/private
  1112. chmod 400 /etc/ssl/private/$HOSTNAME.key
  1113. cp $HOSTNAME.crt /etc/ssl/certs
  1114. shred -zu $HOSTNAME.key $HOSTNAME.crt
  1115. a2enmod ssl
  1116. service apache2 restart
  1117. #+END_SRC
  1118. Save and exit.
  1119. #+BEGIN_SRC: bash
  1120. chmod +x makecert
  1121. ./makecert mydomainname.com
  1122. #+END_SRC
  1123. Enter some trivial password for the key file. The password will be removed as part of the makecert script. Note that leaving a password on the key file would mean that after a power cycle the apache server will not be able to boot properly (it would wait indefinitely for a password to be manually entered) and would look as if it had crashed.
  1124. If all has gone well then there should be no warnings or errors after you run the service restart command. After that you should enable ports 80 (HTTP) and 443 (HTTPS) on your internet router/firewall, such that they are redirected to the BBB.
  1125. ** Accessing your Email
  1126. *** Mutt email client
  1127. #+BEGIN_VERSE
  1128. /I dreamt last night that I was living in a surveillance state. I woke up and… I’m still in a surveillance state./
  1129. -- Conrad Kramer
  1130. #+END_VERSE
  1131. #+BEGIN_SRC: bash
  1132. apt-get install mutt-patched lynx abook
  1133. exit
  1134. mkdir ~/.mutt
  1135. echo "text/html; lynx -dump -width=78 -nolist %s | sed ‘s/^ //’; copiousoutput; needsterminal; nametemplate=%s.html" > ~/.mutt/mailcap
  1136. #+END_SRC
  1137. Save and exit.
  1138. #+BEGIN_SRC: bash
  1139. su
  1140. emacs /etc/Muttrc
  1141. #+END_SRC
  1142. Append the following:
  1143. #+BEGIN_SRC: bash
  1144. set mbox_type=Maildir
  1145. set folder="~/Maildir"
  1146. set mask="!^\\.[^.]"
  1147. set mbox="~/Maildir"
  1148. set record="+sent"
  1149. set postponed="+.Drafts"
  1150. set spoolfile="~/Maildir"
  1151. auto_view text/x-vcard text/html text/enriched
  1152. set editor="emacsclient %s"
  1153. set header_cache="+.cache"
  1154. macro index S "<tag-prefix><save-message>=.learn-spam<enter>" "move to learn-spam"
  1155. macro pager S "<save-message>=.learn-spam<enter>" "move to learn-spam"
  1156. macro index H "<tag-prefix><copy-message>=.learn-ham<enter>" "copy to learn-ham"
  1157. macro pager H "<copy-message>=.learn-ham<enter>" "copy to learn-ham"
  1158. # set up the sidebar
  1159. set sidebar_width=12
  1160. set sidebar_visible=yes
  1161. set sidebar_delim='|'
  1162. set sidebar_sort=yes
  1163. set rfc2047_parameters
  1164. # Show inbox and sent items
  1165. mailboxes = =sent
  1166. # Alter these colours as needed for maximum bling
  1167. color sidebar_new yellow default
  1168. color normal white default
  1169. color hdrdefault brightcyan default
  1170. color signature green default
  1171. color attachment brightyellow default
  1172. color quoted green default
  1173. color quoted1 white default
  1174. color tilde blue default
  1175. # ctrl-n, ctrl-p to select next, prev folder
  1176. # ctrl-o to open selected folder
  1177. bind index \Cp sidebar-prev
  1178. bind index \Cn sidebar-next
  1179. bind index \Co sidebar-open
  1180. bind pager \Cp sidebar-prev
  1181. bind pager \Cn sidebar-next
  1182. bind pager \Co sidebar-open
  1183. # ctrl-b toggles sidebar visibility
  1184. macro index \Cb '<enter-command>toggle sidebar_visible<enter><refresh>' "toggle sidebar"
  1185. macro pager \Cb '<enter-command>toggle sidebar_visible<enter><redraw-screen>' "toggle sidebar"
  1186. # esc-m Mark new messages as read
  1187. macro index <esc>m "T~N<enter>;WNT~O<enter>;WO\CT~T<enter>" "mark all messages read"
  1188. #+END_SRC
  1189. Save and exit.
  1190. #+BEGIN_SRC: bash
  1191. emacs /etc/mail/spamassassin/local.cf
  1192. #+END_SRC
  1193. Uncomment *use_bayes*, *bayes_auto_learn*
  1194. Save and exit, then run:
  1195. #+BEGIN_SRC: bash
  1196. service spamassassin restart
  1197. #+END_SRC
  1198. Now to add an address book:
  1199. #+BEGIN_SRC: bash
  1200. emacs ~/.muttrc
  1201. #+END_SRC
  1202. Append the following:
  1203. #+BEGIN_SRC: bash
  1204. set alias_file=~/.mutt-alias
  1205. source ~/.mutt-alias
  1206. set query_command= "abook --mutt-query '%s'"
  1207. macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook"
  1208. #+END_SRC
  1209. Then save and exit.
  1210. #+BEGIN_SRC: bash
  1211. touch ~/.mutt-alias
  1212. #+END_SRC
  1213. Finally you can then type *mutt* to get access to your email. Hence as a fallback, or if you prefer as the primary way of accessing email, you can ssh into the BBB and use the mutt command line email client. Ssh clients are available for all operating systems, and also you should be reasonably protected from passive surveillance between wherever you are and the BBB (although not between the BBB and the wider internet), which can be useful if you are for example using an Android tablet from a cafe or railway station.
  1214. To use the address book system open an email and then to add the sender to the address list press the A key. It will ask you for an alias which may be used the next time you want to send a mail. Alternatively you may just edit the *~/.mutt-alias* file directly to add email addresses.
  1215. Some useful keys to know are:
  1216. | ESC / | Search for text within message contents |
  1217. | "/" | Search for text within headers |
  1218. | * | Move to the last message |
  1219. | TAB | Move to the next unread message |
  1220. | d | Delete a message |
  1221. | u | Undelete a mail which is pending deletion |
  1222. | $ | Delete all messages selected and check for new messages |
  1223. | a | Add to the address book |
  1224. | m | Send a new mail |
  1225. | ESC-m | Mark all messages as having been read |
  1226. | S | Mark a message as spam |
  1227. | H | Mark a message as ham |
  1228. | CTRL-b | Toggle side bar on/off |
  1229. | CTRL-n | Next mailbox (on side bar) |
  1230. | CTRL-p | Previous mailbox (on side bar) |
  1231. | CTRL-o | Open mailbox (on side bar) |
  1232. *** K9 Android client
  1233. #+BEGIN_VERSE
  1234. /The surveillance state is robust. It is robust politically, legally, and technically./
  1235. -- Bruce Schneier
  1236. #+END_VERSE
  1237. **** Incoming server settings
  1238. * Select settings/account settings
  1239. * Select Fetching mail/incoming server
  1240. * Enter your username and password
  1241. * IMAP server should be your domain name
  1242. * Security: SSL/TLS (always)
  1243. * Authentication: Plain
  1244. * Port: 993
  1245. **** Outgoing (SMTP) server settings
  1246. * Select settings/account settings
  1247. * Select Sending mail/outgoing server
  1248. * Set SMTP server to your domain name
  1249. * Set Security to SSL/TLS (always)
  1250. * Set port to 465
  1251. * Set authentication to PLAIN
  1252. * Enter your username and password
  1253. * Accept the SSL certificate
  1254. *** Webmail
  1255. #+BEGIN_VERSE
  1256. /Most of the information extracted is "content", such as recordings of phone calls or the substance of email messages./
  1257. -- From a 2013 Guardian article on GCHQ/NSA bulk internet data interception.
  1258. #+END_VERSE
  1259. For maximum speed and efficiency the recommended email client is Mutt, accessed via ssh, but non-technical people who aren't using an Android app are unlikely to want to use email in that manner. So it's a good idea to also have a webmail system installed, both for accessibility and as a fallback should ssh not be available due to port blocking.
  1260. Install dependencies.
  1261. #+BEGIN_SRC: bash
  1262. apt-get install libapache2-mod-authz-unixgroup
  1263. #+END_SRC
  1264. Create a mysql database, specifying a password which should be a long random string generated with a password manager such as KeepassX.
  1265. #+BEGIN_SRC: bash
  1266. mysql -u root -p
  1267. create database roundcubemail;
  1268. CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'roundcubepassword';
  1269. GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost';
  1270. quit
  1271. #+END_SRC
  1272. Download roundcube.
  1273. #+BEGIN_SRC: bash
  1274. cd /tmp
  1275. wget http://freedombone.uk.to/roundcubemail.tar.gz
  1276. #+END_SRC
  1277. Verify it.
  1278. #+BEGIN_SRC: bash
  1279. sha256sum roundcubemail.tar.gz
  1280. e8a311b22a8e1f70abb72ed9551cc9233cf6c5221f1eebf1ae64974117e3148b roundcubemail.tar.gz
  1281. #+END_SRC
  1282. Extract the files.
  1283. #+BEGIN_SRC: bash
  1284. tar -xzvf roundcubemail.tar.gz
  1285. export HOSTNAME=mydomainname.com
  1286. cp -r roundcubemail-* /var/www/$HOSTNAME/htdocs/mail
  1287. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/mail/temp
  1288. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/mail/logs
  1289. rm /var/www/$HOSTNAME/htdocs/mail/.htaccess
  1290. #+END_SRC
  1291. Edit your web site configuration.
  1292. #+BEGIN_SRC: bash
  1293. emacs /etc/apache2/sites-available/$HOSTNAME
  1294. #+END_SRC
  1295. Within the 80 VirtualHost section add the following:
  1296. #+BEGIN_SRC: bash
  1297. <Directory /var/www/mydomainname.com/htdocs/mail>
  1298. deny from all
  1299. </Directory>
  1300. #+END_SRC
  1301. Within the 443 VirtualHost section add the following:
  1302. #+BEGIN_SRC: bash
  1303. <Directory /var/www/mydomainname.com/htdocs/mail>
  1304. Options Indexes FollowSymLinks MultiViews
  1305. AllowOverride All
  1306. Order allow,deny
  1307. allow from all
  1308. </Directory>
  1309. #+END_SRC
  1310. Save and exit, then restart Apache.
  1311. #+BEGIN_SRC: bash
  1312. service apache2 restart
  1313. #+END_SRC
  1314. Now with a browser visit https://mydomainname.com/mail/installer. Scroll down and click "next". Give your webmail site a product name.
  1315. The *spellcheck_engine* option being limited to Google is slightly concerning in terms of privacy and security, but seems not to be implemented.
  1316. Change the *database password* to the password you gave when creating the MySql database above.
  1317. Set *smtp_port* to 465.
  1318. Click *create config*
  1319. Click download to download the file.
  1320. In a terminal on your local machine (not logged into the BBB):
  1321. #+BEGIN_SRC: bash
  1322. cd ~/Downloads
  1323. scp config.inc.php myusername@mydomainname.com:/home/myusername
  1324. #+END_SRC
  1325. Then in a terminal ssh'd into the BBB:
  1326. #+BEGIN_SRC: bash
  1327. mv /home/myusername/config.inc.php /var/www/$HOSTNAME/htdocs/mail/config
  1328. chmod 755 /var/www/$HOSTNAME/htdocs/mail/config/config.inc.php
  1329. #+END_SRC
  1330. Click *continue*.
  1331. Click *initialize database*.
  1332. Under *Test SMTP config* you can use a [[mailinator.com]] address to check that mail can be sent.
  1333. Now we can delete the installer.
  1334. #+BEGIN_SRC: bash
  1335. rm -rf /var/www/$HOSTNAME/htdocs/mail/installer
  1336. #+END_SRC
  1337. Now with a browser navigate to https://mydomainname.com/mail and log in.
  1338. TODO: connect Sent and Draft folders.
  1339. *** Thunderbird
  1340. #+BEGIN_VERSE
  1341. /Towards the end of 2012, we heard from the National Technical Assistance Centre (NTAC), a division of GCHQ and a liaison with the Home Office, [that] they wanted the keys to decrypt the customer data./
  1342. -- Brian Spector, on the shutting down of the PrivateSky encrypted email service
  1343. #+END_VERSE
  1344. Another common way in which you may want to access email is via Thunderbird. This may be especially useful if you're trying to convert former Windows users who may previously have been using some version of Outlook.
  1345. The following instructions should be carried out on the client machines (laptop, etc), not on the BBB itself.
  1346. **** Initial setup
  1347. Install *Thunderbird* and *Enigmail*. How you do this just depends upon your distro and software manager or "app store".
  1348. Open Thinderbird
  1349. Select "*Skip this and use existing email*"
  1350. Enter your name, email address (myusername@mydomainname.com) and the password for your user (the one from [[Add a user]]).
  1351. You'll get a message saying "/Thunderbird failed to find the settings/"
  1352. The settings should be as follows, substituting /mydomainname.com/ for your domain name and /myusername/ for the username given previously in [[Add a user]].
  1353. * Incoming: IMAP, mydomainname.com, 993, SSL/TLS, Normal Password
  1354. * Outgoing: SMTP, mydomainname.com, 465, SSL/TLS, Normal Password
  1355. * Username: myusername
  1356. Click *Done*.
  1357. Click *Get Certificate* and make sure "*permanently store this exception*" is selected", then click *Store Security Exception*.
  1358. From OpenPGP setup select "*Yes, I would like the wizard to get me started*". If the wizard doesn't start automatically then "setup wizard" can be selected from OpenPGP on the menu bar.
  1359. Select "*Yes, I want to sign all of my email*"
  1360. Select "*No, I will create per-recipient rules*"
  1361. Select "*yes*" to change default settings.
  1362. **** If you have existing GPG key
  1363. Export your GPG public and private keys.
  1364. #+BEGIN_SRC: bash
  1365. gpg --output ~/public_key.txt --armor --export KEY_ID
  1366. gpg --output ~/private_key.txt --armor --export-secret-key KEY_ID
  1367. #+END_SRC
  1368. Select "*I have existing public and private keys*".
  1369. Select your public and private GPG exported key files.
  1370. Select the account which you want to use and click *Next*, *Next* and *Finish*.
  1371. Remove your exported key files.
  1372. #+BEGIN_SRC: bash
  1373. shred -zu ~/public_key.txt
  1374. shred -zu ~/private_key.txt
  1375. #+END_SRC
  1376. **** If you don't have any existing GPG or PGP key
  1377. Select "*I want to create a new key pair*"
  1378. Enter a passphrase and click *Next* a couple of times.
  1379. Click *Generate Certificate* to generate a revocation certificate.
  1380. Enter the passphrase which you gave previously.
  1381. Click *Finish*
  1382. From the menu select *OpenPGP* and then *Key Management*. Make sure that *Display all keys* is selected and then select your key. Select *Keyserver* on the menu and then *Upload Public Keys*. This will upload your public key to a key server so that others can find it.
  1383. Select *File* from the menu then *Export keys to file*. Click on *Export Secret keys* and select a location to save them to. It's a good idea to save them to a USB stick which can then be removed from the computer and carried around on a keyring together with your physical keys. If you need to set up GPG or Thunderbird/Enigmail on others then this file will be used to import your keys.
  1384. **** Using for the first time
  1385. Click on the Thunderbird menu, which looks like three horizontal bars on the right hand side.
  1386. Hover over *preferences* and then *Account settings*.
  1387. Select *Synchronization & Storage*.
  1388. Make sure that *Keep messages for this account on this computer* is unticked, then click *Ok*.
  1389. Click on *Inbox*. Depending upon how much email you have it may take a while to import the subject lines.
  1390. Note that when sending an email for the first time you will also need to accept the SSL certificate.
  1391. Get into the habit of using email encryption and encourage others to do so. Remember that you may not think that your emails are very interesting but the Surveillance State is highly interested in them and will be actively trying to data mine your private life looking for "suspicious" patterns, regardless of whether you are guilty of any crime or not.
  1392. **** Making folders visible
  1393. By default you won't be able to see any folders which you may have created earlier using the /mailinglistrule/ script. To make folders visible select:
  1394. *Menu*, hover over *Preferences*, select *Account Settings*, select *Server Settings* then click on the *Advanced* button.
  1395. Make sure that the "*Show only subscribed folders*" is not checked. Then click the *Ok* buttons. Folders will be re-scanned, which may take some time depending upon how much email you have, but your folders will then appear.
  1396. ** Install a Blog
  1397. #+BEGIN_VERSE
  1398. /When society gives censors wide and vague powers they never confine themselves to deserving targets. They are not snipers, but machine-gunners. Allow them to fire at will, and they will hit anything that moves./
  1399. -- Nick Cohen
  1400. #+END_VERSE
  1401. Wordpress is the most popular blogging platform, but in practice I found it to be high maintenance with frequent security updates and breakages. More practical for a home server is Flatpress. Flatpress doesn't use a MySql database, just text files, and so is easy to relocate or reinstall.
  1402. See the [[Setting up a web site]] section of this document for details of how to configure the web server for your blog's domain.
  1403. Download flatpress.
  1404. #+BEGIN_SRC: bash
  1405. cd /tmp
  1406. wget http://freedombone.uk.to/flatpress.tar.gz
  1407. #+END_SRC
  1408. Verify the download:
  1409. #+BEGIN_SRC: bash
  1410. sha256sum flatpress.tar.gz
  1411. 6312a49aab5aabd6371518dcaf081f489dff04d001bc34b4fe3f2a81170bbd4e flatpress.tar.gz
  1412. #+END_SRC
  1413. Extract and install it.
  1414. #+BEGIN_SRC: bash
  1415. tar -xzvf flatpress.tar.gz
  1416. cd flatpress-*
  1417. cp -r * /var/www/$HOSTNAME/htdocs
  1418. rm -rf flatpress-*
  1419. rm -f flatpress.tar.gz
  1420. #+END_SRC
  1421. Now visit your blog and follow the setup instructions, which are quite minimal. Various themes and addons are available from the Flatpress web site, http://www.flatpress.org
  1422. ** Install an IRC server
  1423. #+BEGIN_VERSE
  1424. /Give me the liberty to know, to utter, and to argue freely according to conscience, above all liberties./
  1425. -- John Milton
  1426. #+END_VERSE
  1427. *** Base install
  1428. IRC is not an especially secure system. For instance, even with the best encryption it's easily possible to imagine IRC-specific cribs which could be used by cryptanalytic systems. However, we'll try to implement it in a manner which will at least give the surveillance aparatus something to ponder over.
  1429. First install some dependencies.
  1430. #+BEGIN_SRC: bash
  1431. apt-get update
  1432. apt-get install build-essential openssl libssl-dev
  1433. #+END_SRC
  1434. Then get the source code for ircd-hybrid.
  1435. #+BEGIN_SRC: bash
  1436. cd /tmp
  1437. mkdir hybrid
  1438. cd hybrid
  1439. apt-get source ircd-hybrid
  1440. #+END_SRC
  1441. Modify the source code to include SSL security.
  1442. #+BEGIN_SRC: bash
  1443. emacs ircd-hybrid-*/debian/rules
  1444. #+END_SRC
  1445. Beneath MAXCLIENTS add the line:
  1446. #+BEGIN_SRC: bash
  1447. USE_OPENSSL = 1
  1448. #+END_SRC
  1449. Then save and exit. Now we can build the debian package for ircd-hybrid and install it.
  1450. #+BEGIN_SRC: bash
  1451. cd ircd-hybrid-*
  1452. dpkg-buildpackage -rfakeroot -uc -b
  1453. cd ..
  1454. dpkg -i ircd-hybrid_*.deb
  1455. #+END_SRC
  1456. Customise the configuration to your system, giving it a name and description. In this example 192.168.1.60 is the static IP address on the BBB on the local network, so change that if necessary.
  1457. #+BEGIN_SRC: bash
  1458. emacs /etc/ircd-hybrid/ircd.conf
  1459. #+END_SRC
  1460. Set *name* to the name of your server, and set a description.
  1461. Set a *network_name* and *network_desc*. The network name should not contain any spaces.
  1462. Set max_clients to 20, or however many you expect that you'll typically need.
  1463. Within the admin section set your *name* and *email*.
  1464. Within the *listen* section set host to your fixed IP address (in the earlier
  1465. sections it was 192.168.1.60).
  1466. Within the *auth* section set user = "*@192.168.1.60" - or whatever the fixed IP address of the BBB is on your network.
  1467. Uncomment the first *connect* section and set the *name* to your domain name, the *host* to 192.168.1.60 and the send/accept passwords to a password which you use to log into the IRC server. Also set the *port* to 6670.
  1468. Save and exit, then restart the IRC server. Open port 6670 on your internet router and forward it to the BBB.
  1469. Ensure that the configuration is only readable by the root user.
  1470. #+BEGIN_SRC: bash
  1471. chmod 600 /etc/ircd-hybrid/ircd.conf
  1472. #+END_SRC
  1473. *** Channel management
  1474. To to install channel management tools.
  1475. #+BEGIN_SRC: bash
  1476. cd /tmp
  1477. wget http://freedombone.uk.to/hybserv_1.9.4-1_armhf.deb
  1478. #+END_SRC
  1479. Verify it.
  1480. #+BEGIN_SRC: bash
  1481. sha256sum hybserv_1.9.4-1_armhf.deb
  1482. 41bf4eb6e24c87610a80bc14db1103a57484835510eea7e4ba9709c523318615 hybserv_1.9.4-1_armhf.deb
  1483. #+END_SRC
  1484. Install it.
  1485. #+BEGIN_SRC: bash
  1486. dpkg -i hybserv_1.9.4-1_armhf.deb
  1487. #+END_SRC
  1488. Make a md5 version of the password for the IRC server operator.
  1489. #+BEGIN_SRC: bash
  1490. /usr/bin/mkpasswd <myoperatorpassword>
  1491. #+END_SRC
  1492. Edit the ircd-hybrid configuration.
  1493. #+BEGIN_SRC: bash
  1494. emacs /etc/ircd-hybrid/ircd.conf
  1495. #+END_SRC
  1496. Enter the md5 password which you previously created within the /operator/ section. Also change /user/ to:
  1497. #+BEGIN_SRC: bash
  1498. user = "*@*";
  1499. #+END_SRC
  1500. Then save and exit.
  1501. #+BEGIN_SRC: bash
  1502. emacs /etc/hybserv/hybserv.conf
  1503. #+END_SRC
  1504. Change #MD5 PASSWORD HERE# to the md5 operator password created earlier, mydomainname.com to your domain name and mysendacceptpassword to the send/accept password specified within /ircd.conf/.
  1505. #+BEGIN_SRC: bash
  1506. A:mynickname <myemailaddress>
  1507. N:irc.mydomainname.com:Hybrid services
  1508. O:*@*:#MD5 PASSWORD HERE#:root:segj (comment out other Q: lines)
  1509. S:mysendacceptpassword:192.168.1.60:6670 (remove the other two services)
  1510. #+END_SRC
  1511. Also remove the line *#NOT-EDITED#*, then save and exit.
  1512. Now we need to restart the ircd and hybrid server to make things work:
  1513. #+BEGIN_SRC: bash
  1514. service ircd-hybrid restart
  1515. service hybserv start
  1516. #+END_SRC
  1517. *** Usage
  1518. On another computer (not the BBB).
  1519. #+BEGIN_SRC: bash
  1520. sudo apt-get install irssi
  1521. irssi
  1522. #+END_SRC
  1523. Connect to the IRC and identify yourself as an operator. Here /mynetwork/ should be the same as *network_name* specified earlier within /ircd.conf/.
  1524. #+BEGIN_SRC: bash
  1525. /server add -auto -network mynetwork -ssl mydonainname.com 6670 mysendacceptpassword
  1526. /connect mydomainname.com
  1527. /channel add -auto #mychannel mynetwork channelpassword
  1528. /network add -nick mynick mychannel
  1529. /join #mychannel
  1530. /msg -servername chanserv REGISTER #mychannel channelpassword
  1531. /msg -servername chanserv set #mychannel mlock +k channelpassword
  1532. #+END_SRC
  1533. If you edit the irssi config file:
  1534. #+BEGIN_SRC: bash
  1535. emacs ~/.irssi/config
  1536. #+END_SRC
  1537. It should look something like this:
  1538. #+BEGIN_SRC: bash
  1539. {
  1540. address = "mydomainname.com";
  1541. chatnet = "mynetwork";
  1542. port = "6670";
  1543. password = "mysendacceptpassword";
  1544. use_ssl = "yes";
  1545. ssl_verify = "no";
  1546. autoconnect = "yes";
  1547. },
  1548. #+END_SRC
  1549. If you're not using a self-signed certificate (self-signed is the default) then you can set *ssl_verify* to "yes".
  1550. ** Install a Jabber/XMPP server
  1551. #+BEGIN_VERSE
  1552. /Well heck, it isn’t that hard to write an instant messaging system./
  1553. --Jeremie Miller
  1554. #+END_VERSE
  1555. *** The Server
  1556. Generate a SSL certificate.
  1557. #+BEGIN_SRC: bash
  1558. openssl ecparam -out /etc/ssl/private/xmpp.pem -name prime256v1
  1559. openssl genpkey -paramfile /etc/ssl/private/xmpp.pem -out /etc/ssl/private/xmpp.key
  1560. openssl req -new -x509 -key /etc/ssl/private/xmpp.key -out /etc/ssl/certs/xmpp.crt -days 3650
  1561. #+END_SRC
  1562. The above uses a Diffie-Hellman elliptic curve (ECDH P-256) algorithm. It is apparent that amongst crypographers there are differences of opinion about the security of elliptic curves, so if you prefer there is also a more traditional RSA way to generate an SSL certificate:
  1563. #+BEGIN_SRC: bash
  1564. openssl genrsa -out /etc/ssl/private/xmpp.key 4096
  1565. openssl req -new -x509 -key /etc/ssl/private/xmpp.key -out /etc/ssl/certs/xmpp.crt -days 3650
  1566. #+END_SRC
  1567. Change permissions.
  1568. #+BEGIN_SRC: bash
  1569. chmod 600 /etc/ssl/private/xmpp.key
  1570. chmod 600 /etc/ssl/certs/xmpp.crt
  1571. chown prosody:prosody /etc/ssl/private/xmpp.key
  1572. chown prosody:prosody /etc/ssl/certs/xmpp.crt
  1573. #+END_SRC
  1574. Install Prosody.
  1575. #+BEGIN_SRC: bash
  1576. apt-get install prosody
  1577. cp -a /etc/prosody/conf.avail/example.com.cfg.lua /etc/prosody/conf.avail/xmpp.cfg.lua
  1578. emacs /etc/prosody/conf.avail/xmpp.cfg.lua
  1579. #+END_SRC
  1580. Change the *VirtualHost* name to your domain name and remove the line below it.
  1581. Set the ssl section to:
  1582. #+BEGIN_SRC: bash
  1583. ssl = {
  1584. key = "/etc/ssl/private/xmpp.key";
  1585. certificate = "/etc/ssl/certs/xmpp.crt";
  1586. }
  1587. #+END_SRC
  1588. And also append the following:
  1589. #+BEGIN_SRC: bash
  1590. modules_enabled = {
  1591. "bosh"; -- Enable mod_bosh
  1592. "tls"; -- Enable mod_tls
  1593. }
  1594. c2s_require_encryption = true
  1595. s2s_require_encryption = true
  1596. #+END_SRC
  1597. Save and exit. Create a symbolic link.
  1598. #+BEGIN_SRC: bash
  1599. ln -sf /etc/prosody/conf.avail/xmpp.cfg.lua /etc/prosody/conf.d/xmpp.cfg.lua
  1600. #+END_SRC
  1601. Add a user. You will be prompted to specify a password. You can repeat the process for as many users as needed. This will also be your Jabber ID (JID).
  1602. #+BEGIN_SRC: bash
  1603. prosodyctl adduser myusername@mydomainname.com
  1604. #+END_SRC
  1605. Restart the server
  1606. #+BEGIN_SRC: bash
  1607. service prosody restart
  1608. #+END_SRC
  1609. On your internet router/firewall open ports 5222, 5223, 5269, 5280 and 5281 and forward them to the BBB.
  1610. It's possible to test that your XMPP server is working at https://xmpp.net. It may take several minutes and you'll get a low score because of the self-signed certificate, but it will at least verify that your server is capable of communicating.
  1611. *** Managing users
  1612. To add a user:
  1613. #+BEGIN_SRC: bash
  1614. prosodyctl adduser myusername@mydomainname.com
  1615. #+END_SRC
  1616. To change a user password:
  1617. #+BEGIN_SRC: bash
  1618. prosodyctl passwd myusername@mydomainname.com
  1619. #+END_SRC
  1620. To remove a user:
  1621. #+BEGIN_SRC: bash
  1622. prosodyctl deluser myusername@mydomainname.com
  1623. #+END_SRC
  1624. Report the status of the XMPP server:
  1625. #+BEGIN_SRC: bash
  1626. prosodyctl status
  1627. #+END_SRC
  1628. *** Using with Jitsi
  1629. Jitsi is the recommended communications client for desktop or laptop systems, since it includes the /off the record/ (OTR) feature which provides some additional security beyond the usual SSL certificates.
  1630. Jitsi can be downloaded from https://jitsi.org/
  1631. On your desktop/laptop open Jitsi and select *Options* from the *Tools* menu.
  1632. Click *Add* to add a new user, then enter the Jabber ID which you previously specified with /prosodyctl/ when setting up the XMPP server. Close and then you should notice that your status is "Online" (or if not then you should be able to set it to online).
  1633. From the *File* menu you can add contacts, then select the chat icon to begin a chat. Click on the lock icon on the right hand side and this will initiate an authentication procedure in which you can specify a question and answer to verify the identity of the person you're communicating with. Once authentication is complete then you'll be chating using OTR, which provides an additional layer of security.
  1634. When opening Jitsi initially you will get a certificate warning for your domain name (assuming that you're using a self-signed certificate). If this happens then select *View Certificate* and enable the checkbox to trust the certificate, then select *Continue Anyway*. Once you've done this then the certificate warning will not appear again unless you reinstall Jitsi or use a different computer.
  1635. You can also [[https://www.youtube.com/watch?v=vgx7VSrDGjk][see this video]] as an example of using OTR.
  1636. *** Using with Ubuntu
  1637. The default XMPP client in Ubuntu is Empathy. Using Empathy isn't as secure as using Jitsi, since it doesn't include the /off the record/ feature, but since it's the default it's what many users will have easy access to.
  1638. Open *System Settings* and select *Online Accounts*, *Add account* and then *Jabber*.
  1639. Enter your username (myusername@mydomainname.com) and password.
  1640. Click on *Advanced* and make sure that *Encryption required* and *Ignore SSL certificate errors* are checked. Ignoring the certificate errors will allow you to use the self-signed certificate created earlier. Then click *Done* and set your Jabber account and Empathy to *On*.
  1641. *** Using with Android
  1642. There are a few XMPP clients available on Android. Ideally choose ones which support off-the-record messaging. Here are some examples.
  1643. **** Xabber
  1644. Install [[https://f-droid.org/][F-Droid]]
  1645. Search for and install Xabber.
  1646. Add an account and enter your Jabber/XMPP ID and password.
  1647. From the menu select *Settings* then *Security* then *OTR mode*. Set the mode to *Required*.
  1648. Make sure that *Check server certificate* is not checked.
  1649. Go back to the initial screen and then using the menu you can add contacts and begin chatting. Both parties will need to go through the off-the-record question and answer verification before the chat can begin, but that only needs to be done once for each person you're chatting with.
  1650. **** Gibberbot
  1651. Install [[https://f-droid.org/][F-Droid]]
  1652. Search for and install Gibberbot, otherwise known as ChatSecure.
  1653. From the menu open *Accounts*
  1654. Select *Add account*
  1655. Change the server port from 0 to 5222
  1656. Done
  1657. Accept unknown certificate? Select *Always*
  1658. Go back to the initial screen and then using the menu you can add contacts and begin chatting.
  1659. ** Social Networking
  1660. #+BEGIN_VERSE
  1661. /Facebook is not your friend, it is a surveillance engine./
  1662. -- Richard Stallman, Free Software Foundation
  1663. #+END_VERSE
  1664. *** Friendica
  1665. **** Installation
  1666. See [[Setting up a web site]] for details of how to update the Apache configuration for your Friendica site. You should have a separate domain name specifically to run Friendica on. It can't be installed in a subdirectory on a domain used for something else.
  1667. Edit your Apache configuration and disable the port 80 (HTTP) version of the site. We only want to log into Friendica via HTTPS, so to prevent anyone from accidentally logging in insecurely:
  1668. #+BEGIN_SRC: bash
  1669. emacs /etc/apache2/sites-available/mydomainname.com
  1670. #+END_SRC
  1671. Within the section which begins with *<VirtualHost *:80>* change the following:
  1672. #+BEGIN_SRC: bash
  1673. <Directory /var/www/mydomainname.com/htdocs/>
  1674. deny from all
  1675. </Directory>
  1676. #+END_SRC
  1677. Save and exit, then restart the apache server.
  1678. #+BEGIN_SRC: bash
  1679. service apache2 restart
  1680. #+END_SRC
  1681. Now install some dependencies.
  1682. #+BEGIN_SRC: bash
  1683. apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt
  1684. #+END_SRC
  1685. Enter an admin password for MySQL.
  1686. Create a mysql database.
  1687. #+BEGIN_SRC: bash
  1688. mysql -u root -p
  1689. create database friendica;
  1690. CREATE USER 'friendicaadmin'@'localhost' IDENTIFIED BY 'password';
  1691. GRANT ALL PRIVILEGES ON friendica.* TO 'friendicaadmin'@'localhost';
  1692. quit
  1693. #+END_SRC
  1694. You may need to fix Git SSL problems.
  1695. #+BEGIN_SRC: bash
  1696. git config --global http.sslVerify true
  1697. apt-get install ca-certificates
  1698. cd ~/
  1699. emacs .gitconfig
  1700. #+END_SRC
  1701. The .gitconfig file should look something like this:
  1702. #+BEGIN_SRC: bash
  1703. [http]
  1704. sslVerify = true
  1705. sslCAinfo = /etc/ssl/certs/ca-certificates.crt
  1706. [user]
  1707. email = myusername@mydomainname.com
  1708. name = yourname
  1709. #+END_SRC
  1710. Get the source code.
  1711. #+BEGIN_SRC: bash
  1712. export HOSTNAME=mydomainname.com
  1713. cd /var/www/$HOSTNAME
  1714. mv htdocs htdocs_old
  1715. git clone https://github.com/friendica/friendica.git htdocs
  1716. chmod -R 755 htdocs
  1717. chown -R www-data:www-data htdocs
  1718. chown -R www-data:www-data htdocs/view/smarty3
  1719. git clone https://github.com/friendica/friendica-addons.git htdocs/addon
  1720. #+END_SRC
  1721. Now visit the URL of your site and you should be taken through the rest of the installation procedure. If you have trouble with "allow override" ensure that "AllowOverride" is set to "all" in your Apache settings for the site (within /etc/apache2/sites-available) and then restart the apache2 service.
  1722. Install the poller.
  1723. #+BEGIN_SRC: bash
  1724. emacs /etc/crontab
  1725. #+END_SRC
  1726. and append the following, changing mydomainname.com to whatever your domain is.
  1727. #+BEGIN_SRC: bash
  1728. */10 * * * * root cd /var/www/mydomainname.com/htdocs; /usr/bin/php include/poller.php
  1729. #+END_SRC
  1730. Save and exit, then restart cron.
  1731. #+BEGIN_SRC: bash
  1732. service cron restart
  1733. #+END_SRC
  1734. You can improve the speed of Friendica database searches by adding the following indexes:
  1735. #+BEGIN_SRC: bash
  1736. mysql -u root -p
  1737. use friendica;
  1738. CREATE INDEX `uri_received` ON item(`uri`, `received`);
  1739. CREATE INDEX `received_uri` ON item(`received`, `uri`);
  1740. CREATE INDEX `contact-id_created` ON item(`contact-id`, created);
  1741. CREATE INDEX `uid_network_received` ON item(`uid`, `network`, `received`);
  1742. CREATE INDEX `uid_parent` ON item(`uid`, `parent`);
  1743. CREATE INDEX `uid_received` ON item(`uid`, `received`);
  1744. CREATE INDEX `uid_network_commented` ON item(`uid`, `network`, `commented`);
  1745. CREATE INDEX `uid_title` ON item(uid, `title`);
  1746. CREATE INDEX `created_contact-id` ON item(`created`, `contact-id`);
  1747. quit
  1748. #+END_SRC
  1749. Make sure that Friendica doesn't use too much memory.
  1750. #+BEGIN_SRC: bash
  1751. emacs /var/www/$HOSTNAME/htdocs/.htaccess
  1752. #+END_SRC
  1753. Append the following:
  1754. #+BEGIN_SRC: bash
  1755. php_value memory_limit 32M
  1756. #+END_SRC
  1757. The save ane exit.
  1758. **** Backups
  1759. Make sure that the database gets backed up. By using cron if anything goes wrong then you should be able to recover the database either from the previous day or the previous week.
  1760. #+BEGIN_SRC: bash
  1761. emacs /etc/cron.daily/friendicabackup
  1762. #+END_SRC
  1763. Enter the following
  1764. #+BEGIN_SRC: bash
  1765. #!/bin/sh
  1766. MYSQL_PASSWORD=<mysql root password>
  1767. umask 0077
  1768. # Backup the database
  1769. mysqldump --password=$MYSQL_PASSWORD friendica > /var/backups/friendica_daily.sql
  1770. # Make the backup readable only by root
  1771. chmod 600 /var/backups/friendica_daily.sql
  1772. #+END_SRC
  1773. Save and exit.
  1774. #+BEGIN_SRC: bash
  1775. chmod 600 /etc/cron.daily/friendicabackup
  1776. chmod +x /etc/cron.daily/friendicabackup
  1777. emacs /etc/cron.weekly/friendicabackup
  1778. #+END_SRC
  1779. Enter the following
  1780. #+BEGIN_SRC: bash
  1781. #!/bin/sh
  1782. MYSQL_PASSWORD=<mysql root password>
  1783. umask 0077
  1784. # Backup the database
  1785. mysqldump --password=$MYSQL_PASSWORD friendica > /var/backups/friendica_weekly.sql
  1786. # Make the backup readable only by root
  1787. chmod 600 /var/backups/friendica_weekly.sql
  1788. #+END_SRC
  1789. Save and exit.
  1790. #+BEGIN_SRC: bash
  1791. chmod 600 /etc/cron.weekly/friendicabackup
  1792. chmod +x /etc/cron.weekly/friendicabackup
  1793. #+END_SRC
  1794. **** Recommended configuration
  1795. ***** Admin
  1796. To get to the admin settings you will need to be logged in with the admin email address which you specified at the beginning of the installation procedure. Depending upon the theme which you're using "/admin/" will be available either as an icon or on a drop down menu.
  1797. Under the *plugins* section the main one which you may wish to enable is the NSFW plugin. With that enabled if a post contans the #NSFW tag then it will appear minimised by default and you will need to click a button to open it.
  1798. Under the *themes* section select a few themes, including mobile themes which are suitable for phones or tablets.
  1799. Under the *site* section give your Friendica node a name other than "/my friend network/", you can change the icon and banner text and set the default mobile theme typically to /frost-mobile/. If you don't want your node to host a lot of accounts for people you don't know then you may want to set the register policy to "/requires approval/". For security it's probably a good idea only to host accounts for people who you actually know, rather than random strangers. Also be aware that the Beaglebone does not have a great deal of computational power or bandwidth and will not function well if there are hundreds of users using your node. If you're not federating with Diaspora or other sites then you may wish to select "/only allow Friendica contacts/". That improves the security of the system, since communication between Friendica nodes is always encrypted separately and in addition to the usual SSL encryption layer - which makes life interesting for the Surveillance State and at least keeps those cryptanalysts employed.
  1800. It's probably a good idea to enable "/private posts by default for new users/" and also "/don't include post content in email notifications/". Since traditional email isn't a secure system and is easily vulnerable to attack by systems such as [[https://en.wikipedia.org/wiki/XKeyscore][Xkeyscore]].
  1801. ***** Settings
  1802. Each user has their own customisable settings, typically available either via an icon or by an entry on a drop down menu.
  1803. Under *additional features* enable "/richtext editor/", "/post preview/", "/group filter/", "/network filter/", "/edit sent posts/" and "/dislike posts/".
  1804. Under *display settings* select your desktop and mobile themes.
  1805. Once you have connected to enough friends it's also a good idea to use the "/export personal data/" option from here. This will save a file to your local system, which you can import into another friendica node if necessary.
  1806. **** To access from an Android device
  1807. ***** App
  1808. Open a browser on your device and go to https://f-droid.org/ then download and install the F-Droid apk. If you then open F-Droid you can search for and install the Friendica app.
  1809. If you are using a self-signed certificate then at the login screen scroll down to the bottom, select the SSL settings then scroll down and disable SSL certificate checks. You will then be able to log in using https, which at least gives you some protection via the encryption.
  1810. More information about the Friendica app can be found on http://friendica-for-android.wiki-lab.net/
  1811. ***** Mobile Theme
  1812. Another way to access Friendica from a mobile device is to just use the web browser. If you have selected a mobile theme within your settings then when viewing from an Android system the mobile theme will be displayed.
  1813. *** Movim
  1814. #+BEGIN_VERSE
  1815. /The way we communicate with others and with ourselves ultimately determines the quality of our lives/
  1816. -- Anthony Robbins
  1817. #+END_VERSE
  1818. Movim is another social networking system based around the XMPP protocol.
  1819. You will need to have previously [[Install a Jabber/XMPP server][installed the Jabber/XMPP server]].
  1820. Edit your Apache configuration and disable the port 80 (HTTP) version of the site. We only want to log into Movim via HTTPS, so to prevent anyone from accidentally logging in insecurely:
  1821. #+BEGIN_SRC: bash
  1822. emacs /etc/apache2/sites-available/mydomainname.com
  1823. #+END_SRC
  1824. Within the section which begins with *<VirtualHost *:80>* add the following:
  1825. #+BEGIN_SRC: bash
  1826. <Directory /var/www/mydomainname.com/htdocs/movim>
  1827. deny from all
  1828. </Directory>
  1829. #+END_SRC
  1830. Within the section which begins with *<VirtualHost *:443>* add the following:
  1831. #+BEGIN_SRC: bash
  1832. <Directory /var/www/mydomainname.com/htdocs/movim>
  1833. Options Indexes FollowSymLinks MultiViews
  1834. AllowOverride All
  1835. Order allow,deny
  1836. allow from all
  1837. </Directory>
  1838. #+END_SRC
  1839. Save and exit, then restart the apache server.
  1840. #+BEGIN_SRC: bash
  1841. service apache2 restart
  1842. #+END_SRC
  1843. Download the source.
  1844. #+BEGIN_SRC: bash
  1845. cd /tmp
  1846. wget http://freedombone.uk.to/movim.tar.gz
  1847. #+END_SRC
  1848. Verify it.
  1849. #+BEGIN_SRC: bash
  1850. sha256sum movim.tar.gz
  1851. 2740ddbedf6cefcc2934759374376643b6cdea4fb7f944ec25098a6868cb499e movim.tar.gz
  1852. #+END_SRC
  1853. Install it.
  1854. #+BEGIN_SRC: bash
  1855. tar -xzvf movim.tar.gz
  1856. export HOSTNAME=mydomainname.com
  1857. cp -r movim-* /var/www/$HOSTNAME/htdocs/movim
  1858. chmod 755 /var/www/$HOSTNAME/htdocs/movim
  1859. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/movim
  1860. #+END_SRC
  1861. Install some MySql prerequisites.
  1862. #+BEGIN_SRC: bash
  1863. apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt
  1864. #+END_SRC
  1865. If necessary, enter an admin password for MySQL.
  1866. Create a mysql database.
  1867. #+BEGIN_SRC: bash
  1868. mysql -u root -p
  1869. create database movim;
  1870. CREATE USER 'movimadmin'@'localhost' IDENTIFIED BY 'movimadminpassword';
  1871. GRANT ALL PRIVILEGES ON movim.* TO 'movimadmin'@'localhost';
  1872. quit
  1873. #+END_SRC
  1874. With a web browser navigate to:
  1875. https://mydomainname.com/movim/admin
  1876. Enter /admin/ as the username and /password/ as the password.
  1877. Click on /General Settings/ and alter the administrator username to /movimadmin/ and password to some long random string (using a password manager such as KeepassX).
  1878. Change the /Environment/ from /Development/ to /Production/.
  1879. The /BOSH URL/ should be http://localhost:5280/http-bind (TODO: should this be https://localhost:5281/http-bind and if so do certificate warnings need to be disabled?)
  1880. Click /Submit/ followed by /Resend/.
  1881. Click on /Database Settings/ and alter the MySql movim database username to /movimadmin/ and password to the password you specified in the previous step.
  1882. Click /Submit/ followed by /Resend/. If you get a lot of orange warnings about database fields being created then hit /Submit/ again until you see "Movim database is up to date".
  1883. If everything on all three tabs looks green then you are ready to go. Click on the Movim logo at the top left and then log in with your Jabber ID (JID).
  1884. *** Red Matrix
  1885. **** Introduction
  1886. Red Matrix is the current version of the Friendica social networking system. It's more general than Friendica in that it's designed as a generic communication system based around a protocol called "zot". At the time of writing in early 2014 Red Matrix remains at an alpha stage of development and so it's not advised that you install it unless you're willing to put up with bugs and frustrations. In the large majority of cases it's better to stick with Friendica for now.
  1887. **** Prerequisites
  1888. The main problem with Red Matrix is that in order to install it you will need to have purchased a domain name (i.e. not a FreeDNS subdomain) and a SSL certificate for it.
  1889. You could join some other Red Matrix server, but this suffers from "/The Levison Problem/" in which some goons show up with a gagging order demanding coppies of the SSL private key. In that scenario unless the owner of the server is exceptionally brave users may never be informed that the site has been compromised or that there is interception hardware attached to the server. Joining another server defeats the object of being digitally self-sufficient and raises legal question marks about the ownership of data which you might upload to a server which doesn't belong to you.
  1890. **** Installation
  1891. See [[Setting up a web site]] for details of how to update the Apache configuration for your Red Matrix site. You should have a separate domain name specifically to run Red Matrix on. It can't be installed in a subdirectory on a domain used for something else.
  1892. Edit your Apache configuration and disable the port 80 (HTTP) version of the site. We only want to log into Red Matrix via HTTPS, so to prevent anyone from accidentally logging in insecurely:
  1893. #+BEGIN_SRC: bash
  1894. emacs /etc/apache2/sites-available/mydomainname.com
  1895. #+END_SRC
  1896. Within the section which begins with *<VirtualHost *:80>* change the following:
  1897. #+BEGIN_SRC: bash
  1898. <Directory /var/www/mydomainname.com/htdocs/>
  1899. deny from all
  1900. </Directory>
  1901. #+END_SRC
  1902. Save and exit, then restart the apache server.
  1903. #+BEGIN_SRC: bash
  1904. service apache2 restart
  1905. #+END_SRC
  1906. Now install some dependencies.
  1907. #+BEGIN_SRC: bash
  1908. apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt
  1909. #+END_SRC
  1910. Enter an admin password for MySQL.
  1911. Create a mysql database.
  1912. #+BEGIN_SRC: bash
  1913. mysql -u root -p
  1914. create database redmatrix;
  1915. CREATE USER 'redmatrixadmin'@'localhost' IDENTIFIED BY 'password';
  1916. GRANT ALL PRIVILEGES ON redmatrix.* TO 'redmatrixadmin'@'localhost';
  1917. quit
  1918. #+END_SRC
  1919. You may need to fix Git SSL problems.
  1920. #+BEGIN_SRC: bash
  1921. git config --global http.sslVerify true
  1922. apt-get install ca-certificates
  1923. cd ~/
  1924. emacs .gitconfig
  1925. #+END_SRC
  1926. The .gitconfig file should look something like this:
  1927. #+BEGIN_SRC: bash
  1928. [http]
  1929. sslVerify = true
  1930. sslCAinfo = /etc/ssl/certs/ca-certificates.crt
  1931. [user]
  1932. email = myusername@mydomainname.com
  1933. name = yourname
  1934. #+END_SRC
  1935. Get the source code.
  1936. #+BEGIN_SRC: bash
  1937. export HOSTNAME=mydomainname.com
  1938. cd /var/www/$HOSTNAME
  1939. mv htdocs htdocs_old
  1940. git clone https://github.com/friendica/red.git htdocs
  1941. chmod -R 755 htdocs
  1942. chown -R www-data:www-data htdocs
  1943. mkdir htdocs/view/tpl/smarty3
  1944. chmod 777 htdocs/view/tpl
  1945. chmod 777 htdocs/view/tpl/smarty3
  1946. git clone https://github.com/friendica/red-addons.git htdocs/addon
  1947. #+END_SRC
  1948. Now visit the URL of your site and you should be taken through the rest of the installation procedure. Note that this may take a few minutes so don't be concerned if it looks as if it has crashed - just leave it running. If you have trouble with "allow override" ensure that "AllowOverride" is set to "all" in your Apache settings for the site (within /etc/apache2/sites-available) and then restart the apache2 service.
  1949. Install the poller.
  1950. #+BEGIN_SRC
  1951. emacs /etc/crontab
  1952. #+END_SRC
  1953. and append the following, changing mydomainname.com to whatever your domain is.
  1954. #+BEGIN_SRC
  1955. */10 * * * * root cd /var/www/mydomainname.com/htdocs; /usr/bin/php include/poller.php
  1956. #+END_SRC
  1957. Save and exit, then restart cron.
  1958. #+BEGIN_SRC: bash
  1959. service cron restart
  1960. #+END_SRC
  1961. **** Backups
  1962. Make sure that the database gets backed up. By using cron if anything goes wrong then you should be able to recover the database either from the previous day or the previous week.
  1963. #+BEGIN_SRC: bash
  1964. emacs /etc/cron.daily/redmatrixbackup
  1965. #+END_SRC
  1966. Enter the following
  1967. #+BEGIN_SRC: bash
  1968. #!/bin/sh
  1969. MYSQL_PASSWORD=<mysql root password>
  1970. umask 0077
  1971. # Backup the database
  1972. mysqldump --password=$MYSQL_PASSWORD redmatrix > /var/backups/redmatrix_daily.sql
  1973. # Make the backup readable only by root
  1974. chmod 600 /var/backups/redmatrix_daily.sql
  1975. #+END_SRC
  1976. Save and exit.
  1977. #+BEGIN_SRC: bash
  1978. chmod 600 /etc/cron.daily/redmatrixbackup
  1979. chmod +x /etc/cron.daily/redmatrixbackup
  1980. emacs /etc/cron.weekly/redmatrixbackup
  1981. #+END_SRC
  1982. Enter the following
  1983. #+BEGIN_SRC: bash
  1984. #!/bin/sh
  1985. MYSQL_PASSWORD=<mysql root password>
  1986. umask 0077
  1987. # Backup the database
  1988. mysqldump --password=$MYSQL_PASSWORD redmatrix > /var/backups/redmatrix_weekly.sql
  1989. # Make the backup readable only by root
  1990. chmod 600 /var/backups/redmatrix_weekly.sql
  1991. #+END_SRC
  1992. Save and exit.
  1993. #+BEGIN_SRC: bash
  1994. chmod 600 /etc/cron.weekly/redmatrixbackup
  1995. chmod +x /etc/cron.weekly/redmatrixbackup
  1996. #+END_SRC
  1997. **** To access from an Android device
  1998. ***** App
  1999. Open a browser on your device and go to https://f-droid.org/ then download and install the F-Droid apk. If you then open F-Droid you can search for and install the Friendica app.
  2000. If you are using a self-signed certificate then at the login screen scroll down to the bottom, select the SSL settings then scroll down and disable SSL certificate checks. You will then be able to log in using https, which at least gives you some protection via the encryption.
  2001. More information about the Friendica app can be found on http://friendica-for-android.wiki-lab.net/
  2002. ** Install Gopher
  2003. Gopher is an old internet protocol which originated a few years before the web and is purely text based. It can be quite fun to build a gopher site and browse the gopherverse. One thing to keep in mind is that there is no security with gopher, so any text transmitted is trivially interceptable by systems such as [[https://en.wikipedia.org/wiki/XKeyscore][Xkeyscore]] or deep packet inspection.
  2004. To set up a gopher server:
  2005. #+BEGIN_SRC: bash
  2006. apt-get install build-essential
  2007. cd /tmp
  2008. wget http://freedombone.uk.to/geomyidae-current.tgz
  2009. #+END_SRC
  2010. Verify the download:
  2011. #+BEGIN_SRC: bash
  2012. sha256sum geomyidae-current.tgz
  2013. 162f55ab059ab0a9be8e840497795293bbd51c34b1f4564dcdf3f0ddd5c0db31 geomyidae-current.tgz
  2014. #+END_SRC
  2015. Then extract and install it.
  2016. #+BEGIN_SRC: bash
  2017. tar -xzvf geomyidae-current.tgz
  2018. cd geomyidae-*
  2019. make
  2020. make install
  2021. mkdir -p /var/gopher
  2022. #+END_SRC
  2023. Your content should be placed within /var/gopher with the index page being named index.gph. The Gopher format is very simple - simpler than HTML - so creating pages is not much more difficult than editing a text file.
  2024. #+BEGIN_SRC: bash
  2025. emacs /etc/init.d/gopher
  2026. #+END_SRC
  2027. Enter the following:
  2028. #+BEGIN_SRC: bash
  2029. #! /bin/sh
  2030. ### BEGIN INIT INFO
  2031. # Provides: gopher
  2032. # Required-Start: $remote_fs $syslog
  2033. # Required-Stop: $remote_fs $syslog
  2034. # Default-Start: 2 3 4 5
  2035. # Default-Stop: 0 1 6
  2036. # Short-Description: Gopher daemon
  2037. # Description: Gopher daemon
  2038. ### END INIT INFO
  2039. # Do NOT "set -e"
  2040. # PATH should only include /usr/* if it runs after the mountnfs.sh script
  2041. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  2042. DESC="Gopher daemon"
  2043. NAME=geomyidae
  2044. DAEMON=/usr/bin/$NAME
  2045. DAEMON_ARGS="-l /var/log/geomyidae.log -b /var/gopher -p 70"
  2046. PIDFILE=/var/run/$NAME.pid
  2047. SCRIPTNAME=/etc/init.d/$NAME
  2048. # Exit if the package is not installed
  2049. [ -x "$DAEMON" ] || exit 0
  2050. # Read configuration variable file if it is present
  2051. [ -r /etc/default/$NAME ] && . /etc/default/$NAME
  2052. # Load the VERBOSE setting and other rcS variables
  2053. . /lib/init/vars.sh
  2054. # Define LSB log_* functions.
  2055. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
  2056. # and status_of_proc is working.
  2057. . /lib/lsb/init-functions
  2058. #
  2059. # Function that starts the daemon/service
  2060. #
  2061. do_start()
  2062. {
  2063. # Return
  2064. # 0 if daemon has been started
  2065. # 1 if daemon was already running
  2066. # 2 if daemon could not be started
  2067. start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
  2068. || return 1
  2069. start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
  2070. $DAEMON_ARGS \
  2071. || return 2
  2072. # Add code here, if necessary, that waits for the process to be ready
  2073. # to handle requests from services started subsequently which depend
  2074. # on this one. As a last resort, sleep for some time.
  2075. }
  2076. #
  2077. # Function that stops the daemon/service
  2078. #
  2079. do_stop()
  2080. {
  2081. # Return
  2082. # 0 if daemon has been stopped
  2083. # 1 if daemon was already stopped
  2084. # 2 if daemon could not be stopped
  2085. # other if a failure occurred
  2086. start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
  2087. RETVAL="$?"
  2088. [ "$RETVAL" = 2 ] && return 2
  2089. # Wait for children to finish too if this is a daemon that forks
  2090. # and if the daemon is only ever run from this initscript.
  2091. # If the above conditions are not satisfied then add some other code
  2092. # that waits for the process to drop all resources that could be
  2093. # needed by services started subsequently. A last resort is to
  2094. # sleep for some time.
  2095. start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
  2096. [ "$?" = 2 ] && return 2
  2097. # Many daemons don't delete their pidfiles when they exit.
  2098. rm -f $PIDFILE
  2099. return "$RETVAL"
  2100. }
  2101. #
  2102. # Function that sends a SIGHUP to the daemon/service
  2103. #
  2104. do_reload() {
  2105. #
  2106. # If the daemon can reload its configuration without
  2107. # restarting (for example, when it is sent a SIGHUP),
  2108. # then implement that here.
  2109. #
  2110. start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
  2111. return 0
  2112. }
  2113. case "$1" in
  2114. start)
  2115. [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
  2116. do_start
  2117. case "$?" in
  2118. 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
  2119. 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
  2120. esac
  2121. ;;
  2122. stop)
  2123. [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
  2124. do_stop
  2125. case "$?" in
  2126. 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
  2127. 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
  2128. esac
  2129. ;;
  2130. status)
  2131. status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
  2132. ;;
  2133. #reload|force-reload)
  2134. #
  2135. # If do_reload() is not implemented then leave this commented out
  2136. # and leave 'force-reload' as an alias for 'restart'.
  2137. #
  2138. #log_daemon_msg "Reloading $DESC" "$NAME"
  2139. #do_reload
  2140. #log_end_msg $?
  2141. #;;
  2142. restart|force-reload)
  2143. #
  2144. # If the "reload" option is implemented then remove the
  2145. # 'force-reload' alias
  2146. #
  2147. log_daemon_msg "Restarting $DESC" "$NAME"
  2148. do_stop
  2149. case "$?" in
  2150. 0|1)
  2151. do_start
  2152. case "$?" in
  2153. 0) log_end_msg 0 ;;
  2154. 1) log_end_msg 1 ;; # Old process is still running
  2155. *) log_end_msg 1 ;; # Failed to start
  2156. esac
  2157. ;;
  2158. *)
  2159. # Failed to stop
  2160. log_end_msg 1
  2161. ;;
  2162. esac
  2163. ;;
  2164. *)
  2165. #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
  2166. echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
  2167. exit 3
  2168. ;;
  2169. esac
  2170. :
  2171. #+END_SRC
  2172. Save and exit. Then start the gopher service.
  2173. #+BEGIN_SRC: bash
  2174. chmod +x /etc/init.d/gopher
  2175. update-rc.d gopher defaults
  2176. service gopher start
  2177. #+END_SRC
  2178. On your internet router change the firewall settings to route port 70 to the BBB, then provided that you have a gopher plugin installed within your browser then you should be able to navigate to your gopher site with:
  2179. #+BEGIN_SRC: bash
  2180. gopher://mydomainname.com
  2181. #+END_SRC
  2182. There is a browser addon for Gopher called "overbite". Installing that should enable you to view your site.
  2183. ** Install Owncloud
  2184. #+BEGIN_VERSE
  2185. /It's not water vapour/
  2186. -- Larry Ellison
  2187. #+END_VERSE
  2188. Owncloud will allow you to upload and download files, share photos, collaboratively edit documents, have a calendar and more. You should be warned that Owncloud runs quite slowly via an ordinary web browser, but it can be a convenient way to access and share your data from any location in a reasonably secure manner.
  2189. *** Server Installation
  2190. Install some dependencies:
  2191. #+BEGIN_SRC: bash
  2192. apt-get install apache2 php5 php5-gd php-xml-parser php5-intl
  2193. apt-get install php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl
  2194. #+END_SRC
  2195. It's very important that /mod_php5/ and not /mod_php5filter/ be installed. If you have /mod_php5filter/ installed then Owncloud will always fail to install.
  2196. #+BEGIN_SRC: bash
  2197. a2dismod php5filter
  2198. apt-get install libapache2-mod-php5
  2199. #+END_SRC
  2200. Ensure that the size of files which may be uploaded or downloaded is large enough.
  2201. #+BEGIN_SRC: bash
  2202. emacs /etc/php5/apache2/php.ini
  2203. #+END_SRC
  2204. Set the following:
  2205. #+BEGIN_SRC: bash
  2206. upload_max_filesize = 512M
  2207. post_max_size = 512M
  2208. #+END_SRC
  2209. Save and exit, then edit your Apache configuration.
  2210. #+BEGIN_SRC: bash
  2211. export HOSTNAME=mydomainname.com
  2212. emacs /etc/apache2/sites-available/$HOSTNAME
  2213. #+END_SRC
  2214. And add the following, to the 443 VirtualHost section. Really we only will want to be using Owncloud with HTTPS to ensure some level of security and avoidance of dragnet surveillance.
  2215. #+BEGIN_SRC: bash
  2216. <Directory /var/www/mydomainname.com/htdocs/owncloud>
  2217. Options Indexes FollowSymLinks MultiViews
  2218. AllowOverride All
  2219. Order allow,deny
  2220. allow from all
  2221. </Directory>
  2222. #+END_SRC
  2223. To ensure that nobody logs in insecurely add the following to the 80 VirtualHost section.
  2224. #+BEGIN_SRC: bash
  2225. <Directory /var/www/mydomainname.com/htdocs/owncloud>
  2226. deny from all
  2227. </Directory>
  2228. #+END_SRC
  2229. Save and exit, then restart apache.
  2230. #+BEGIN_SRC: bash
  2231. service apache2 restart
  2232. #+END_SRC
  2233. Download owncloud.
  2234. #+BEGIN_SRC: bash
  2235. cd /tmp
  2236. wget http://freedombone.uk.to/owncloud.tar.bz2
  2237. #+END_SRC
  2238. Verify the download:
  2239. #+BEGIN_SRC: bash
  2240. sha256sum owncloud.tar.bz2
  2241. 92b53fdfa7c4165b83dd2f8447f63928454a5815d08ff2d6165dd1a8969ecbe1 owncloud.tar.bz2
  2242. #+END_SRC
  2243. Extract the archive. This may take a couple of minutes, so don't be alarmed that the system has crashed.
  2244. #+BEGIN_SRC: bash
  2245. export HOSTNAME=mydomainname.com
  2246. tar -xjf owncloud.tar.bz2
  2247. #+END_SRC
  2248. Move the extracted files to your site and set file permissions.
  2249. #+BEGIN_SRC: bash
  2250. cp -r owncloud /var/www/$HOSTNAME/htdocs
  2251. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/owncloud/apps
  2252. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/owncloud/config
  2253. chown www-data:www-data /var/www/$HOSTNAME/htdocs/owncloud
  2254. #+END_SRC
  2255. Edit the htaccess file for Owncloud.
  2256. #+BEGIN_SRC: bash
  2257. emacs /var/www/$HOSTNAME/htdocs/owncloud/.htaccess
  2258. #+END_SRC
  2259. Set the following.
  2260. #+BEGIN_SRC: bash
  2261. php_value upload_max_filesize 512M
  2262. php_value post_max_size 512M
  2263. php_value memory_limit 32M
  2264. #+END_SRC
  2265. Save and exit.
  2266. With a web browser visit your domain (mydomainname.com/owncloud) and enter an administrator username and password.
  2267. *** Owncloud on Android
  2268. First install [[https://f-droid.org/][F-Droid]] and then search for the current Owncloud app. Once it's installed you'll then be able to log into the BBB with the URL https://mydomainname.com/opencloud, supplying your username and password.
  2269. ** Install a Wiki
  2270. #+BEGIN_VERSE
  2271. /I believe that technology can liberate, but you need to be a master rather than a user. You need to pull technology apart and master it rather than letting it control you./
  2272. -- Tom Barbalet
  2273. #+END_VERSE
  2274. Dokuwiki is based upon flat files, and so is easy to move from one server to another without a lot of database complications.
  2275. Download the wiki.
  2276. #+BEGIN_SRC: bash
  2277. cd /tmp
  2278. wget http://freedombone.uk.to/dokuwiki.tgz
  2279. #+END_SRC
  2280. Verify it.
  2281. #+BEGIN_SRC: bash
  2282. sha256sum dokuwiki.tgz
  2283. 6b126f90979463d9ddaa74acc6f96aa230cfdc789946f241c3646086d9574be8 dokuwiki.tgz
  2284. #+END_SRC
  2285. Then extract and install it.
  2286. #+BEGIN_SRC: bash
  2287. export HOSTNAME=mywikidomainname.com
  2288. tar -xzvf dokuwiki.tgz
  2289. mv /var/www/$HOSTNAME/htdocs /var/www/$HOSTNAME/htdocs_old
  2290. mv dokuwiki /var/www/$HOSTNAME/htdocs
  2291. #+END_SRC
  2292. Edit the Apache configuration for your wiki site.
  2293. #+BEGIN_SRC: bash
  2294. emacs /etc/apache2/sites-available/$HOSTNAME
  2295. #+END_SRC
  2296. The settings should look something like the following. Replace /mywikidomainname.com/ with your wiki domain name.
  2297. #+BEGIN_SRC: bash
  2298. <VirtualHost *:80>
  2299. ServerAdmin myusername@mywikidomainname.com
  2300. ServerName mydomainname.com
  2301. DocumentRoot /var/www/mywikidomainname.com/htdocs
  2302. <Directory /var/www/mywikidomainname.com/htdocs>
  2303. order deny,allow
  2304. allow from all
  2305. </Directory>
  2306. <LocationMatch "/(data|conf|bin|inc)/">
  2307. order allow,deny
  2308. deny from all
  2309. satisfy all
  2310. </LocationMatch>
  2311. <Directory />
  2312. Options FollowSymLinks
  2313. AllowOverride All
  2314. </Directory>
  2315. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  2316. <Directory "/usr/lib/cgi-bin">
  2317. AllowOverride All
  2318. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  2319. Order allow,deny
  2320. Allow from all
  2321. </Directory>
  2322. ErrorLog ${APACHE_LOG_DIR}/error.log
  2323. # Possible values include: debug, info, notice, warn, error, crit,
  2324. # alert, emerg.
  2325. LogLevel error
  2326. CustomLog ${APACHE_LOG_DIR}/access.log combined
  2327. </VirtualHost>
  2328. <IfModule mod_ssl.c>
  2329. <VirtualHost *:443>
  2330. ServerAdmin myusername@mywikidomainname.com
  2331. ServerName mywikidomainname.com
  2332. DocumentRoot /var/www/mywikidomainname.com/htdocs
  2333. <Directory /var/www/mywikidomainname.com/htdocs>
  2334. order deny,allow
  2335. allow from all
  2336. </Directory>
  2337. <LocationMatch "/(data|conf|bin|inc)/">
  2338. order allow,deny
  2339. deny from all
  2340. satisfy all
  2341. </LocationMatch>
  2342. <Directory />
  2343. Options FollowSymLinks
  2344. AllowOverride All
  2345. </Directory>
  2346. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  2347. <Directory "/usr/lib/cgi-bin">
  2348. AllowOverride All
  2349. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  2350. Order allow,deny
  2351. Allow from all
  2352. </Directory>
  2353. ErrorLog ${APACHE_LOG_DIR}/error.log
  2354. # Possible values include: debug, info, notice, warn, error, crit,
  2355. # alert, emerg.
  2356. LogLevel error
  2357. CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
  2358. # SSL Engine Switch:
  2359. # Enable/Disable SSL for this virtual host.
  2360. SSLEngine on
  2361. # A self-signed certificate
  2362. SSLCertificateFile /etc/ssl/certs/mydomainname.com.crt
  2363. SSLCertificateKeyFile /etc/ssl/private/mydomainname.com.key
  2364. # Options based on bettercrypto.org
  2365. SSLProtocol All -SSLv2 -SSLv3
  2366. SSLHonorCipherOrder On
  2367. SSLCompression off
  2368. SSLCipherSuite EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
  2369. # SSL Engine Options:
  2370. # Set various options for the SSL engine.
  2371. # o FakeBasicAuth:
  2372. # Translate the client X.509 into a Basic Authorisation. This means that
  2373. # the standard Auth/DBMAuth methods can be used for access control. The
  2374. # user name is the `one line' version of the client's X.509 certificate.
  2375. # Note that no password is obtained from the user. Every entry in the user
  2376. # file needs this password: `xxj31ZMTZzkVA'.
  2377. # o ExportCertData:
  2378. # This exports two additional environment variables: SSL_CLIENT_CERT and
  2379. # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
  2380. # server (always existing) and the client (only existing when client
  2381. # authentication is used). This can be used to import the certificates
  2382. # into CGI scripts.
  2383. # o StdEnvVars:
  2384. # This exports the standard SSL/TLS related `SSL_*' environment variables.
  2385. # Per default this exportation is switched off for performance reasons,
  2386. # because the extraction step is an expensive operation and is usually
  2387. # useless for serving static content. So one usually enables the
  2388. # exportation for CGI and SSI requests only.
  2389. # o StrictRequire:
  2390. # This denies access when "SSLRequireSSL" or "SSLRequire" applied even
  2391. # under a "Satisfy any" situation, i.e. when it applies access is denied
  2392. # and no other module can change it.
  2393. # o OptRenegotiate:
  2394. # This enables optimized SSL connection renegotiation handling when SSL
  2395. # directives are used in per-directory context.
  2396. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
  2397. <FilesMatch "\.(cgi|shtml|phtml|php)$">
  2398. SSLOptions +StdEnvVars
  2399. </FilesMatch>
  2400. <Directory /usr/lib/cgi-bin>
  2401. SSLOptions +StdEnvVars
  2402. </Directory>
  2403. # SSL Protocol Adjustments:
  2404. # The safe and default but still SSL/TLS standard compliant shutdown
  2405. # approach is that mod_ssl sends the close notify alert but doesn't wait for
  2406. # the close notify alert from client. When you need a different shutdown
  2407. # approach you can use one of the following variables:
  2408. # o ssl-unclean-shutdown:
  2409. # This forces an unclean shutdown when the connection is closed, i.e. no
  2410. # SSL close notify alert is send or allowed to received. This violates
  2411. # the SSL/TLS standard but is needed for some brain-dead browsers. Use
  2412. # this when you receive I/O errors because of the standard approach where
  2413. # mod_ssl sends the close notify alert.
  2414. # o ssl-accurate-shutdown:
  2415. # This forces an accurate shutdown when the connection is closed, i.e. a
  2416. # SSL close notify alert is send and mod_ssl waits for the close notify
  2417. # alert of the client. This is 100% SSL/TLS standard compliant, but in
  2418. # practice often causes hanging connections with brain-dead browsers. Use
  2419. # this only for browsers where you know that their SSL implementation
  2420. # works correctly.
  2421. # Notice: Most problems of broken clients are also related to the HTTP
  2422. # keep-alive facility, so you usually additionally want to disable
  2423. # keep-alive for those clients, too. Use variable "nokeepalive" for this.
  2424. # Similarly, one has to force some clients to use HTTP/1.0 to workaround
  2425. # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
  2426. # "force-response-1.0" for this.
  2427. BrowserMatch "MSIE [2-6]" \
  2428. nokeepalive ssl-unclean-shutdown \
  2429. downgrade-1.0 force-response-1.0
  2430. # MSIE 7 and newer should be able to use keepalive
  2431. BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
  2432. </VirtualHost>
  2433. </IfModule>
  2434. #+END_SRC
  2435. Enable your site with:
  2436. #+BEGIN_SRC: bash
  2437. a2ensite
  2438. #+END_SRC
  2439. then select the domain name and reload.
  2440. #+BEGIN_SRC: bash
  2441. service apache2 reload
  2442. #+END_SRC
  2443. and alter permissions:
  2444. #+BEGIN_SRC: bash
  2445. chmod -R 755 /var/www/$HOSTNAME/htdocs
  2446. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs
  2447. #+END_SRC
  2448. Open a browser and visit http://$HOSTNAME/install.php, then fill out the details. Once everything has been accepted without errors:
  2449. #+BEGIN_SRC: bash
  2450. rm /var/www/$HOSTNAME/htdocs/install.php
  2451. #+END_SRC
  2452. Add a few extra mime types:
  2453. #+BEGIN_SRC: bash
  2454. emacs /var/www/$HOSTNAME/htdocs/conf/mime.conf
  2455. #+END_SRC
  2456. Append the following:
  2457. #+BEGIN_SRC: bash
  2458. ogv video/ogg
  2459. mp4 video/mp4
  2460. webm video/webm
  2461. #+END_SRC
  2462. Save and exit.
  2463. If you need to be able to upload large files to the wiki then edit */etc/php5/apache2/php.ini* and set *upload_max_filesize* accordingly. If the directory */etc/php5/apache2* doesn't exist then you will need to install the package *libapache2-mod-php5*.
  2464. Now you can visit your wiki and begin editing.
  2465. ** Install Bitmessage
  2466. #+BEGIN_VERSE
  2467. /Love your neighbour. Fight the future. If you are reading this you ARE the resistance./
  2468. -- BitChirp
  2469. #+END_VERSE
  2470. *** A new kind of Email
  2471. [[https://bitmessage.org][Bitmessage]] is a new type of messaging system intended to fulfill the same role as email, but without the security problems. In particular, Bitmessage attempts to not just encrypt the content but also the metadata. It's message broadcasting system makes it exceedingly difficult for an attacker to know which computer a message is destined for. The only way you know whether a message has been sent to you is whether you are able to decrypt it from the passing stream of messages.
  2472. Although similar to Bitcoin in some regards, such as "/proof of work/", Bitmessage has no block chain and messages are only buffered for approximately three days after which they are deleted from any given node.
  2473. Installing Bitmessage as a daemon will increase the size of the network, and therefore the level of security for all users.
  2474. *** The Daemon
  2475. Install from the current source code.
  2476. #+BEGIN_SRC: bash
  2477. apt-get install python screen
  2478. cd /tmp
  2479. git clone https://github.com/Bitmessage/PyBitmessage.git
  2480. cd PyBitmessage
  2481. make install
  2482. #+END_SRC
  2483. Now create the daemon.
  2484. #+BEGIN_SRC: bash
  2485. emacs /etc/init.d/pybitmessage
  2486. #+END_SRC
  2487. Add the following text:
  2488. #+BEGIN_SRC: bash
  2489. #!/bin/bash
  2490. # /etc/init.d/bitmessage
  2491. ### BEGIN INIT INFO
  2492. # Provides: pybitmessage
  2493. # Required-Start: $remote_fs $syslog
  2494. # Required-Stop: $remote_fs $syslog
  2495. # Default-Start: 2 3 4 5
  2496. # Default-Stop: 0 1 6
  2497. # Short-Description: starts bitmessage as a background daemon, suitable for servers
  2498. # Description: This file should be used to construct scripts to be
  2499. # placed in /etc/init.d.
  2500. ### END INIT INFO
  2501. # Author: Super-Nathan <BM-Gu2k3Wy2hpTMYBxSoM2937SPcuU6xzEj>
  2502. #Settings
  2503. SERVICE='pybitmessage'
  2504. LOGFILE='/dev/null' # this disables logging
  2505. # LOGFILE='/var/log/bitmessage.log' # comment out the above line and un-comment this line to save a log
  2506. COMMAND="python bitmessagemain.py > $LOGFILE"
  2507. USERNAME='bitmsg'
  2508. NICELEVEL=19 # from 0-19 the bigger the number, the less the impact on system resources
  2509. HISTORY=1024
  2510. PBM_LOCATION="/usr/local/share/pybitmessage"
  2511. INVOCATION="nice -n ${NICELEVEL} ${COMMAND}"
  2512. PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/sbin:/usr/sbin:/bin:/usr/local/share/pybitmessage'
  2513. bm_start() {
  2514. echo "Starting $SERVICE..."
  2515. cd ${PBM_LOCATION}
  2516. su --command "screen -h ${HISTORY} -dmS ${SERVICE} ${INVOCATION}" $USERNAME
  2517. }
  2518. bm_stop() {
  2519. echo "Stopping $SERVICE"
  2520. su --command "screen -p 0 -S ${SERVICE} -X stuff "'^C'"" $USERNAME
  2521. }
  2522. #Start-Stop here
  2523. case "$1" in
  2524. start)
  2525. bm_start
  2526. ;;
  2527. stop)
  2528. bm_stop
  2529. ;;
  2530. restart)
  2531. bm_stop
  2532. sleep 60s
  2533. bm_start
  2534. ;;
  2535. *)
  2536. echo "Usage: $0 {start|stop|restart}"
  2537. exit 1
  2538. ;;
  2539. esac
  2540. exit 0
  2541. #+END_SRC
  2542. Save and exit.
  2543. Add a user which will be specifically for Bitmessage. Since bitmessage is still a relatively young and experimental project, this adds further compartmentalisation such that if there are any bugs within PyBitmessage then an attacker can't neccessarily gain control of root or any other user account. Here we create a user called /bitmsg/ and give it a long random password.
  2544. #+BEGIN_SRC: bash
  2545. adduser bitmsg
  2546. #+END_SRC
  2547. Create a /keys.dat/ file which is used to configure Bitmessage.
  2548. #+BEGIN_SRC: bash
  2549. mkdir /home/bitmsg/.config
  2550. mkdir /home/bitmsg/.config/PyBitmessage
  2551. emacs /home/bitmsg/.config/PyBitmessage/keys.dat
  2552. #+END_SRC
  2553. Add the following:
  2554. #+BEGIN_SRC: bash
  2555. [bitmessagesettings]
  2556. settingsversion = 7
  2557. port = 8444
  2558. timeformat = %%a, %%d %%b %%Y %%I:%%M %%p
  2559. blackwhitelist = black
  2560. startonlogon = false
  2561. minimizetotray = false
  2562. showtraynotifications = false
  2563. startintray = false
  2564. socksproxytype = none
  2565. sockshostname = localhost
  2566. socksport = 9050
  2567. socksauthentication = false
  2568. sockslisten = false
  2569. socksusername =
  2570. sockspassword =
  2571. keysencrypted = false
  2572. messagesencrypted = false
  2573. defaultnoncetrialsperbyte = 640
  2574. defaultpayloadlengthextrabytes = 14000
  2575. minimizeonclose = false
  2576. maxacceptablenoncetrialsperbyte = 0
  2577. maxacceptablepayloadlengthextrabytes = 0
  2578. userlocale = system
  2579. namecoinrpctype = namecoind
  2580. namecoinrpchost = localhost
  2581. namecoinrpcuser =
  2582. namecoinrpcpassword =
  2583. namecoinrpcport = 8336
  2584. sendoutgoingconnections = True
  2585. daemon = true
  2586. #+END_SRC
  2587. Save and exit. Then enable the daemon and run it.
  2588. #+BEGIN_SRC: bash
  2589. rm -f /tmp/-usr-local-share-pybitmessage-*.lock
  2590. chown -R bitmsg:bitmsg /home/bitmsg
  2591. chmod +x /etc/init.d/pybitmessage
  2592. update-rc.d pybitmessage defaults
  2593. service pybitmessage start
  2594. #+END_SRC
  2595. Now open port 8444 on your internet router or firewall and direct it to the BBB.
  2596. *** Using Bitmessage
  2597. Although in principle it would be possible to send Bitmessages directly from the BBB, in practice the /proof of work/ requirement would mean that it would take an infeasibly long time to send messages, and the computational workload would likely greatly impair the performance of other services also running on the system. So to send and receive Bitmessages it's better to just install the client on a laptop or desktop machine.
  2598. The easiest way to install the client is either to download it from [[https://bitmessage.org][bitmessage.org]] or to get the latest build from Github as follows:
  2599. #+BEGIN_SRC: bash
  2600. cd /tmp
  2601. git clone https://github.com/Bitmessage/PyBitmessage.git
  2602. cd PyBitmessage
  2603. make install
  2604. pybitmessage
  2605. #+END_SRC
  2606. *** Connect to Email
  2607. TODO: how to connect Bitmessage to an email client.
  2608. #+BEGIN_SRC: bash
  2609. cd /tmp
  2610. wget http://freedombone.uk.to/notbit.tar.gz
  2611. #+END_SRC
  2612. Verify it.
  2613. #+BEGIN_SRC: bash
  2614. sha256sum notbit.tar.gz
  2615. 972fdc9cbb8034141282337dcd5e557bce57969ff6bd1d607da89bd93cc7bb68
  2616. #+END_SRC
  2617. Extract and install it.
  2618. #+BEGIN_SRC: bash
  2619. tar -xzvf notbit.tar.gz
  2620. cd notbit
  2621. apt-get install dh-autoreconf
  2622. ./autogen.sh --prefix=/home/myusername
  2623. make
  2624. make install
  2625. #+END_SRC
  2626. ** Overcome restrictive environments
  2627. #+BEGIN_VERSE
  2628. /Censorship reflects a society's lack of confidence in itself. It is a hallmark of an authoritarian regime./
  2629. -- Potter Stewart
  2630. #+END_VERSE
  2631. In some environments, such as behind corporate firewalls or under regimes hostile towards the idea of open access to knowledge and information you may find that you're not able to use tools such as /ssh/ to get access to the BBB. In the worst case all ports other than 80 and 443 may be blocked.
  2632. In that scenario you can use a tool called [[http://code.google.com/p/shellinabox/][shellinabox]] to log into your BBB via your web site rather than via a terminal. This means that you can administrate your system from any device which has a web browser and keyboard.
  2633. #+BEGIN_SRC: bash
  2634. apt-get install shellinabox libapache2-mod-proxy-html
  2635. #+END_SRC
  2636. Update your Apache configuration.
  2637. #+BEGIN_SRC: bash
  2638. export HOSTNAME=mydomainname.com
  2639. emacs /etc/apache2/sites-available/$HOSTNAME
  2640. #+END_SRC
  2641. Within the section which begins with *<VirtualHost *:443>* add the following, replacing /mydomainname.com/ with your domain name and /myusername/ with your username.
  2642. #+BEGIN_SRC: bash
  2643. <Location /shell>
  2644. ProxyPass http://localhost:4200/
  2645. Order allow,deny
  2646. Allow from all
  2647. AuthName "Authentication for shellinabox"
  2648. AuthUserFile /home/mydomainname.com/public_html/.htpasswd
  2649. AuthGroupFile /home/mydomainname.com/public_html/.htgroup
  2650. AuthType Basic
  2651. Require group shellinabox
  2652. Require user myusername
  2653. </Location>
  2654. #+END_SRC
  2655. Save and exit, then create a login password. It's recommended that the password be a long random string and that you then access it using a password manager such as KeepassX.
  2656. #+BEGIN_SRC: bash
  2657. mkdir /home/$HOSTNAME
  2658. mkdir /home/$HOSTNAME/public_html
  2659. htpasswd -c /home/$HOSTNAME/public_html/.htpasswd myusername
  2660. #+END_SRC
  2661. Create a user group.
  2662. #+BEGIN_SRC: bash
  2663. emacs /home/$HOSTNAME/public_html/.htgroup
  2664. #+END_SRC
  2665. Add the following:
  2666. #+BEGIN_SRC: bash
  2667. shellinabox: myusername
  2668. #+END_SRC
  2669. Save and exit, then restart Apache.
  2670. #+BEGIN_SRC: bash
  2671. a2enmod proxy_http
  2672. service apache2 restart
  2673. #+END_SRC
  2674. Now with a web browser navigate to https://mydomainname.com/shell and log in.
  2675. If you're in a very locked down environment where access to web sites is severely restricted then as a last resort you may be able to use a command line browser, such as [[https://en.wikipedia.org/wiki/Lynx_%28web_browser%29][lynx]] from within /shellinabox/.
  2676. ** Set up a mailing list
  2677. #+BEGIN_VERSE
  2678. /All over the world there are many people who are united in creating software, content, and culture that is freely available for others to share, enjoy and enrich their lives. Together we believe that freedom is good. We believe it helps people do good things, make better choices, and lead safer and more secure lives. Together we are a community united by this belief./
  2679. -- Jono Bacon
  2680. #+END_VERSE
  2681. *** With Email
  2682. Email mailing lists are old skool but still remain as a common and easy way of communicating on the internet. If you're running a public organisation such as an open source project or community group then you may want to set one up.
  2683. **** Installation
  2684. #+BEGIN_SRC: bash
  2685. export HOSTNAME=mydomainname.com
  2686. apt-get install mailman
  2687. newlist mailman
  2688. #+END_SRC
  2689. Enter an email address for the list administrator and a password.
  2690. #+BEGIN_SRC: bash
  2691. emacs /etc/mailman/mm_cfg.py
  2692. #+END_SRC
  2693. Set *MTA=None* and change *http:* to *https:*, then save and exit.
  2694. Add some settings.
  2695. #+BEGIN_SRC: bash
  2696. emacs /etc/exim4/conf.d/main/04_mailman_options
  2697. #+END_SRC
  2698. Add the following, replacing /mydomainname.com/ with your domain name.
  2699. #+BEGIN_SRC: bash
  2700. # Mailman macro definitions
  2701. # Home dir for the Mailman installation
  2702. MM_HOME=/var/lib/mailman
  2703. # User and group for Mailman
  2704. MM_UID=list
  2705. MM_GID=list
  2706. #
  2707. # Domains that your lists are in - colon separated list
  2708. # you may wish to add these into local_domains as well
  2709. domainlist mm_domains=mydomainname.com
  2710. # The path of the Mailman mail wrapper script
  2711. MM_WRAP=MM_HOME/mail/mailman
  2712. #
  2713. # The path of the list config file (used as a required file when
  2714. # verifying list addresses)
  2715. MM_LISTCHK=MM_HOME/lists/${lc::$local_part}/config.pck
  2716. #+END_SRC
  2717. Save and exit.
  2718. #+BEGIN_SRC: bash
  2719. emacs /etc/exim4/conf.d/main/000_localmacros
  2720. #+END_SRC
  2721. Append the following:
  2722. #+BEGIN_SRC: bash
  2723. SYSTEM_ALIASES_PIPE_TRANSPORT = address_pipe
  2724. SYSTEM_ALIASES_USER = list
  2725. SYSTEM_ALIASES_GROUP = list
  2726. #+END_SRC
  2727. Save and exit.
  2728. #+BEGIN_SRC: bash
  2729. emacs /etc/exim4/conf.d/acl/30_exim4-config_check_rcpt
  2730. #+END_SRC
  2731. Append the following, before the final /accept/:
  2732. #+BEGIN_SRC: bash
  2733. # Do callback verification unless Mailman incoming bounce
  2734. deny !local_parts = *-bounces : *-bounces+*
  2735. !verify = sender/callout=30s,defer_ok
  2736. #+END_SRC
  2737. Save and exit.
  2738. #+BEGIN_SRC: bash
  2739. emacs
  2740. /etc/exim4/conf.d/router/450_mailman_aliases
  2741. #+END_SRC
  2742. Add the following:
  2743. #+BEGIN_SRC: bash
  2744. mailman_router:
  2745. driver = accept
  2746. domains = +mm_domains
  2747. require_files = MM_LISTCHK
  2748. local_part_suffix_optional
  2749. local_part_suffix = -admin : \
  2750. -bounces : -bounces+* : \
  2751. -confirm : -confirm+* : \
  2752. -join : -leave : \
  2753. -owner : -request : \
  2754. -subscribe : -unsubscribe
  2755. transport = mailman_transport
  2756. #+END_SRC
  2757. Save and exit.
  2758. #+BEGIN_SRC: bash
  2759. emacs /etc/exim4/conf.d/transport/40_mailman_pipe
  2760. #+END_SRC
  2761. Add the following:
  2762. #+BEGIN_SRC: bash
  2763. mailman_transport:
  2764. driver = pipe
  2765. command = MM_WRAP \
  2766. '${if def:local_part_suffix \
  2767. {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
  2768. {post}}' \
  2769. $local_part
  2770. current_directory = MM_HOME
  2771. home_directory = MM_HOME
  2772. user = MM_UID
  2773. group = MM_GID
  2774. #+END_SRC
  2775. Save and exit.
  2776. #+BEGIN_SRC: bash
  2777. chown root:list /var/lib/mailman/mail/mailman
  2778. update-exim4.conf.template -r
  2779. update-exim4.conf
  2780. service exim4 restart
  2781. emacs /etc/apache2/conf.d/mailman
  2782. #+END_SRC
  2783. Add the following:
  2784. #+BEGIN_SRC: bash
  2785. Alias /pipermail /var/lib/mailman/archives/public
  2786. Alias /images/mailman /usr/share/images/mailman
  2787. <directory /var/lib/mailman/archives/public>
  2788. DirectoryIndex index.html
  2789. </directory>
  2790. #+END_SRC
  2791. Save and exit.
  2792. #+BEGIN_SRC: bash
  2793. emacs /etc/apache2/sites-available/$HOSTNAME
  2794. #+END_SRC
  2795. Add the following to the 443 section.
  2796. #+BEGIN_SRC: bash
  2797. <Location /mailman>
  2798. Options Indexes FollowSymLinks MultiViews
  2799. Order allow,deny
  2800. Allow from all
  2801. RedirectMatch ^/$ /cgi-bin/mailman/listinfo
  2802. </Location>
  2803. #+END_SRC
  2804. Save and exit.
  2805. #+BEGIN_SRC: bash
  2806. service apache2 restart
  2807. #+END_SRC
  2808. Now add your mailing list. The list name should not include any spaces.
  2809. #+BEGIN_SRC: bash
  2810. newlist mymailinglistname
  2811. #+END_SRC
  2812. With a browser visit https://$HOSTNAME/cgi-bin/mailman/admin/mymailinglistname to configure the mailing list.
  2813. Under *General Options* add an email address for a moderator (could be the same as the administrator) and click *Submit your changes*.
  2814. Under *Privacy Options* set steps required for subscription to *Confirm and approve* and click *Submit your changes*.
  2815. Also change these settings for the account within https://$HOSTNAME/cgi-bin/mailman/admin/mailman
  2816. #+BEGIN_SRC: bash
  2817. emacs /etc/aliases
  2818. #+END_SRC
  2819. Append the following, replacing /mymailinglistname/ with your mailing list name:
  2820. #+BEGIN_SRC: bash
  2821. mymailinglistname: "|/var/lib/mailman/mail/mailman post mymailinglistname"
  2822. mymailinglistname-admin: "|/var/lib/mailman/mail/mailman admin mymailinglistname"
  2823. mymailinglistname-bounces: "|/var/lib/mailman/mail/mailman bounces mymailinglistname"
  2824. mymailinglistname-confirm: "|/var/lib/mailman/mail/mailman confirm mymailinglistname"
  2825. mymailinglistname-join: "|/var/lib/mailman/mail/mailman join mymailinglistname"
  2826. mymailinglistname-leave: "|/var/lib/mailman/mail/mailman leave mymailinglistname"
  2827. mymailinglistname-owner: "|/var/lib/mailman/mail/mailman owner mymailinglistname"
  2828. mymailinglistname-request: "|/var/lib/mailman/mail/mailman request mymailinglistname"
  2829. mymailinglistname-subscribe: "|/var/lib/mailman/mail/mailman subscribe mymailinglistname"
  2830. mymailinglistname-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mymailinglistname"
  2831. #+END_SRC
  2832. Save and exit. Then to test that the mailing list works:
  2833. #+BEGIN_SRC: bash
  2834. exim -d+route -bt mymailinglistname@$HOSTNAME
  2835. #+END_SRC
  2836. If everything is working then this shouldn't show any problems.
  2837. **** Using the mailing list
  2838. Direct subscribers towards:
  2839. #+BEGIN_SRC: bash
  2840. https://mydomainname.com/cgi-bin/mailman/listinfo/mymailinglistname
  2841. #+END_SRC
  2842. To administrate the list visit:
  2843. #+BEGIN_SRC: bash
  2844. https://mydomainname.com/cgi-bin/mailman/admin/mymailinglistname
  2845. #+END_SRC
  2846. To add another mailing list:
  2847. #+BEGIN_SRC: bash
  2848. newlist mymailinglistname
  2849. #+END_SRC
  2850. To delete a mailing list:
  2851. #+BEGIN_SRC: bash
  2852. rmlist -a mymailinglistname
  2853. #+END_SRC
  2854. *** With Bitmessage
  2855. On your local machine (not the BBB) you can make a private mailing list which is difficult to censor and where there is no single point of failure. This type of mailing list is known as a "chan".
  2856. On a Debian based system:
  2857. #+BEGIN_SRC: bash
  2858. sudo apt-get install makepasswd
  2859. #+END_SRC
  2860. or on an RPM based system:
  2861. #+BEGIN_SRC: bash
  2862. sudo yum install makepasswd
  2863. #+END_SRC
  2864. Create a name for your mailing list. This will be a random string.
  2865. #+BEGIN_SRC: bash
  2866. makepasswd -c 40
  2867. #+END_SRC
  2868. Keep a note of this.
  2869. Run the Bitmessage client and on the menu select *File/Join-Create Chan/Create new chan*
  2870. Enter the random string which you created as the name of the mailing list. Also take a note of the BM address which is created.
  2871. You can hand out the random string used to generate the mailing list and its corresponding BM address to fellow members, either within a bitmessage or on paper or via [[https://en.wikipedia.org/wiki/Sneakernet][sneakernet]] or in a GPG/PGP encrypted email or via an XMPP+OTR or Friendica private message. Once others have those two pieces of data then they will be able to join.
  2872. To make the list easier to identify, rather than just appearing as a random string, then under the *Your Identities* tab right click on it and select *Set Avatar* and assign a suitable icon.
  2873. The disadvantage of this type of mailing list is that it's not possible for any one participant to act as a list moderator, or in other words each participant must do their own moderation. That's ok if the size of the group is small, but if it's larger then anyone spamming or trolling the list can make things miserable for the others.
  2874. ** Install Tripwire
  2875. #+BEGIN_VERSE
  2876. /...by the time you get done with all of that, we have a freedom box/
  2877. -- Eben Moglen
  2878. #+END_VERSE
  2879. Tripwire will try to detect any intrusions into your system. It's a good idea to install it after you have installed all of the other programs which you intend to use.
  2880. #+BEGIN_SRC: bash
  2881. apt-get install tripwire
  2882. export HOSTNAME=mydomainname.com
  2883. cd /etc/tripwire
  2884. cp arm-local.key $HOSTNAME-local.key
  2885. cp site.key $HOSTNAME-site.key
  2886. tripwire --init
  2887. tripwire --update-policy --secure-mode low /etc/tripwire/twpol.txt
  2888. tripwire --check --interactive
  2889. #+END_SRC
  2890. you will be asked for two passphrases ("site" and "local"). Make a note of these.
  2891. Turn off reporting of changes to system logs.
  2892. #+BEGIN_SRC: bash
  2893. emacs /etc/tripwire/twcfg.txt
  2894. #+END_SRC
  2895. Set *SYSLOGREPORTING* to false, then save and exit.
  2896. If you subsequently install any more packages or make configuration changes then update the policy again with:
  2897. #+BEGIN_SRC: bash
  2898. tripwire --update-policy --secure-mode low /etc/tripwire/twpol.txt
  2899. #+END_SRC
  2900. Also, to look for any rootkits.
  2901. #+BEGIN_SRC: bash
  2902. apt-get install rkhunter
  2903. #+END_SRC
  2904. * Router/Firewall ports
  2905. The following ports on your internet router/firewall should be forwarded to the BBB.
  2906. | Protocol | Port/s |
  2907. |---------------+------------|
  2908. | Gopher | 70 |
  2909. | HTTP | 80 |
  2910. | HTTPS | 443 |
  2911. | IMAP | 143 |
  2912. | IRC SSL | 6670 |
  2913. | SIP | 5060..5061 |
  2914. | SMTP | 25 |
  2915. | SMTPS | 465 |
  2916. | SSH | 22 |
  2917. | XMPP | 5222..5223 |
  2918. | XMPP (server) | 5269 |
  2919. | XMPP (BOSH) | 5280..5281 |
  2920. | Bitmessage | 8444 |
  2921. * Hints and Tips
  2922. ** Messaging security
  2923. If you're connected to other friends via Friendica then the preferred way to send private messages is via Friendica's built-in messaging system. This is a lot more convenient than using GPG with ordinary email and yet still provides a similar level of protection from unwarranted interception.
  2924. ** Moving Domains
  2925. If you're moving servers and using a different domain name or path then you can search and replace URLs within files in the following way:
  2926. #+BEGIN_SRC: bash
  2927. find /var/www/mynewdomain/htdocs -type f -exec sed -i 's@myolddomain@mynewdomain@g' {} \;
  2928. #+END_SRC
  2929. ** MySql foo
  2930. *** Backup all databases
  2931. To back up all mysql databases:
  2932. #+BEGIN_SRC: bash
  2933. mysqldump -u root -p --all-databases --events > /var/backups/databasebackup.sql
  2934. #+END_SRC
  2935. *** Restoring a particular mysql database
  2936. To restore yesterday's friendica backup:
  2937. #+BEGIN_SRC: bash
  2938. mysql -D friendica -o < /var/backups/friendica_daily.sql
  2939. #+END_SRC
  2940. To restore yesterday's mediawiki backup:
  2941. #+BEGIN_SRC: bash
  2942. mysql -D wikidb -o < /var/backups/wikidb_daily.sql
  2943. #+END_SRC
  2944. *** Removing mysql server
  2945. If you manage to screw up sql server completely then it can be fully deleted with:
  2946. #+BEGIN_SRC: bash
  2947. ps aux | grep mysql
  2948. #+END_SRC
  2949. and use /kill -9 <pid>/ to kill all mysql processes.
  2950. #+BEGIN_SRC: bash
  2951. apt-get remove --purge mysql\*
  2952. apt-get clean
  2953. updatedb
  2954. #+END_SRC
  2955. * Deprecated
  2956. The following items have been deprecated until such time as a successful installation is achieved.
  2957. ** Collaborative Document Editing
  2958. #+BEGIN_VERSE
  2959. /Openness and participation are antidotes to surveillance and control./
  2960. -- Howard Rheingold
  2961. #+END_VERSE
  2962. #+BEGIN_SRC: bash
  2963. apt-get install nodejs-legacy
  2964. curl https://npmjs.org/install.sh | sh
  2965. #+END_SRC
  2966. Create an etherpad database.
  2967. #+BEGIN_SRC: bash
  2968. mysql -p
  2969. CREATE DATABASE etherpad CHARACTER SET utf8 COLLATE utf8_general_ci;
  2970. GRANT ALL PRIVILEGES ON etherpad.* TO etherpad@localhost IDENTIFIED BY '__yourPasswd__';
  2971. FLUSH PRIVILEGES;
  2972. exit
  2973. #+END_SRC
  2974. Download etherpad.
  2975. #+BEGIN_SRC: bash
  2976. export HOSTNAME=mydomainname.com
  2977. cd /var/www/$HOSTNAME/htdocs
  2978. git clone git://github.com/ether/etherpad-lite.git etherpad
  2979. #+END_SRC
  2980. Edit the configuration file
  2981. #+BEGIN_SRC: bash
  2982. cd /var/www/$HOSTNAME/htdocs/etherpad
  2983. cp settings.json.template settings.json
  2984. emacs /var/www/$HOSTNAME/htdocs/etherpad/settings.json
  2985. #+END_SRC
  2986. Change the following settings. /rAnD0m5tRIng/ should be altered to a random string 10 characters in length.
  2987. #+BEGIN_SRC: bash
  2988. //IP and port which etherpad should bind at
  2989. "ip": "127.0.0.1",
  2990. // set a session key
  2991. "sessionKey" : "rAnD0m5tRIng",
  2992. //configure the connection settings
  2993. "dbType" : "mysql",
  2994. "dbSettings" : {
  2995. "user" : "etherpad",
  2996. "host" : "localhost",
  2997. "password": "__yourPassword__",
  2998. "database": "etherpad"
  2999. },
  3000. // add admin user
  3001. "users": {
  3002. "admin": {
  3003. "password": "__yourAdminPassword__",
  3004. "is_admin": true
  3005. }
  3006. },
  3007. #+END_SRC
  3008. Save and exit, then create a system user.
  3009. #+BEGIN_SRC: bash
  3010. adduser --system --home=/var/www/$HOSTNAME/htdocs/etherpad/ --group etherpad
  3011. chown -R etherpad: /var/www/$HOSTNAME/htdocs/etherpad/
  3012. #+END_SRC
  3013. Create an init script using your favorite editor.
  3014. #+BEGIN_SRC: bash
  3015. emacs /etc/init.d/etherpad
  3016. #+END_SRC
  3017. Add the following, replacing /mydomainname.com/ with your domain name:
  3018. #+BEGIN_SRC: bash
  3019. #!/bin/sh
  3020. ### BEGIN INIT INFO
  3021. # Provides: etherpad-lite
  3022. # Required-Start: $local_fs $remote_fs $network $syslog
  3023. # Required-Stop: $local_fs $remote_fs $network $syslog
  3024. # Default-Start: 2 3 4 5
  3025. # Default-Stop: 0 1 6
  3026. # Short-Description: starts etherpad lite
  3027. # Description: starts etherpad lite using start-stop-daemon
  3028. ### END INIT INFO
  3029. PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
  3030. LOGFILE="/var/www/mydomainname.com/htdocs/etherpad/etherpad-lite.log"
  3031. EPLITE_DIR="/var/www/mydomainname.com/htdocs/etherpad"
  3032. EPLITE_BIN="bin/safeRun.sh"
  3033. USER="etherpad"
  3034. GROUP="etherpad"
  3035. DESC="Etherpad Lite"
  3036. NAME="etherpad-lite"
  3037. set -e
  3038. . /lib/lsb/init-functions
  3039. start() {
  3040. echo "Starting $DESC... "
  3041. start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE || true
  3042. echo "done"
  3043. }
  3044. #We need this function to ensure the whole process tree will be killed
  3045. killtree() {
  3046. local _pid=$1
  3047. local _sig=${2-TERM}
  3048. for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
  3049. killtree ${_child} ${_sig}
  3050. done
  3051. kill -${_sig} ${_pid}
  3052. }
  3053. stop() {
  3054. echo "Stopping $DESC... "
  3055. while test -d /proc/$(cat /var/run/$NAME.pid); do
  3056. killtree $(cat /var/run/$NAME.pid) 15
  3057. sleep 0.5
  3058. done
  3059. rm /var/run/$NAME.pid
  3060. echo "done"
  3061. }
  3062. status() {
  3063. status_of_proc -p /var/run/$NAME.pid "" "etherpad-lite" && exit 0 || exit $?
  3064. }
  3065. case "$1" in
  3066. start)
  3067. start
  3068. ;;
  3069. stop)
  3070. stop
  3071. ;;
  3072. restart)
  3073. stop
  3074. start
  3075. ;;
  3076. status)
  3077. status
  3078. ;;
  3079. *)
  3080. echo "Usage: $NAME {start|stop|restart|status}" >&2
  3081. exit 1
  3082. ;;
  3083. esac
  3084. exit 0
  3085. #+END_SRC
  3086. Save and exit, then enable the daemon.
  3087. #+BEGIN_SRC: bash
  3088. chmod +x /etc/init.d/etherpad
  3089. update-rc.d etherpad defaults
  3090. service etherpad start
  3091. #+END_SRC
  3092. Update your Apache configuration.
  3093. #+BEGIN_SRC: bash
  3094. emacs /etc/apache2/sites-available/$HOSTNAME
  3095. #+END_SRC
  3096. Within the section which begins with *<VirtualHost *:443>* add the following:
  3097. #+BEGIN_SRC: bash
  3098. <Location /etherpad>
  3099. ProxyPass http://localhost:9001/
  3100. ProxyPassReverse http://localhost:9001/
  3101. Order allow,deny
  3102. allow from all
  3103. AuthName "Welcome to Etherpad"
  3104. AuthUserFile /home/mydomainname.com/public_html/.htpasswd
  3105. AuthGroupFile /home/mydomainname.com/public_html/.htgroup
  3106. AuthType Basic
  3107. Require group etherpad
  3108. </Location>
  3109. #+END_SRC
  3110. Save and exit, then restart Apache.
  3111. #+BEGIN_SRC: bash
  3112. apt-get install libapache2-mod-proxy-html
  3113. a2enmod proxy proxy_http headers deflate
  3114. service apache2 restart
  3115. #+END_SRC
  3116. Create some passwords for users.
  3117. #+BEGIN_SRC: bash
  3118. mkdir /home/$HOSTNAME
  3119. mkdir /home/$HOSTNAME/public_html
  3120. htpasswd -c /home/$HOSTNAME/public_html/.htpasswd myusername
  3121. #+END_SRC
  3122. Create a user group.
  3123. #+BEGIN_SRC: bash
  3124. emacs /home/$HOSTNAME/public_html/.htgroup
  3125. #+END_SRC
  3126. Add the following:
  3127. #+BEGIN_SRC: bash
  3128. etherpad: myusername
  3129. #+END_SRC
  3130. Save and exit.
  3131. ** Install a VoIP server
  3132. #+BEGIN_VERSE
  3133. /Our core principles, whether in software or sovereignty, have always been about freedom and dignity, for all people, on an equal basis/
  3134. -- David Sugar, GNU Telephony
  3135. #+END_VERSE
  3136. *** The server
  3137. Sipwitch is like an introduction service or phone book for SIP VoIP clients. Once introduced the clients can then talk directly, and this means that sipwitch is very lightweight and can run on low power systems such as the BBB.
  3138. Edit your package sources:
  3139. #+BEGIN_SRC: bash
  3140. emacs /etc/apt/sources.list
  3141. #+END_SRC
  3142. Append the following line:
  3143. #+BEGIN_SRC: bash
  3144. deb http://dev.gnutelephony.org/archive/ wheezy/
  3145. #+END_SRC
  3146. Save and exit.
  3147. To load the repository the first time after adding it to the sources.list, since you do not have the verification keys already installed yet. Then do
  3148. #+BEGIN_SRC: bash
  3149. apt-get install gnutelephony-keyring
  3150. #+END_SRC
  3151. After that it will be happy to accept it as a signed repository. The verification keys can also be directly fetched with
  3152. #+BEGIN_SRC: bash
  3153. cd /tmp
  3154. wget http://dev.gnutelephony.org/archive/wheezy/public.key
  3155. #+END_SRC
  3156. and manually added instead with
  3157. #+BEGIN_SRC: bash
  3158. apt-key add public.key
  3159. #+END_SRC
  3160. To make sure you have all dependencies, do
  3161. #+BEGIN_SRC: bash
  3162. apt-get update;apt-get dist-upgrade
  3163. #+END_SRC
  3164. Before we install anything, let's inspect what is available to us by using
  3165. #+BEGIN_SRC: bash
  3166. dpkg -l sipwitch
  3167. #+END_SRC
  3168. To see the main application. The columns will indicate if the package is installed, which version and a description of the package. Then do
  3169. #+BEGIN_SRC: bash
  3170. dpkg -l sipwitch-*
  3171. #+END_SRC
  3172. to see available supporting applications and plugins. Again, the columns will indicate if the package is installed, which version and a description of each of these.
  3173. To install only the main application, do
  3174. #+BEGIN_SRC: bash
  3175. apt-get install sipwitch
  3176. #+END_SRC
  3177. and to install all supporting plugins:
  3178. #+BEGIN_SRC: bash
  3179. apt-get install sipwitch-plugin-scripting sipwitch-plugin-subscriber sipwitch-plugin-forward sipwitch-plugin-zeroconf
  3180. #+END_SRC
  3181. Add your user into the sipwitch group
  3182. #+BEGIN_SRC: bash
  3183. groupadd sipwitch
  3184. groupadd sipusers
  3185. usermod -aG sipwitch myusername
  3186. usermod -aG sipusers myusername
  3187. #+END_SRC
  3188. Then edit the configuration
  3189. #+BEGIN_SRC: bash
  3190. emacs /etc/sipwitch.conf
  3191. #+END_SRC
  3192. Change the *mapped* value from 200 to 20, since we don't want to be serving huge numbers of calls.
  3193. Alter the *range* value to 10, since we don't need a large number of extensions. This will mean that exension numbers 200 to 209 are available.
  3194. Do not set the *realm* value, as doing so seems to prevent the server from working.
  3195. Save and exit.
  3196. Create a digest string for your username:
  3197. #+BEGIN_SRC: bash
  3198. sipwitch digest myusername
  3199. #+END_SRC
  3200. Make a note of the resulting string because you're going to use it in the users file you'll now create.
  3201. #+BEGIN_SRC: bash
  3202. export HOSTNAME=mydomainname.com
  3203. touch /etc/sipwitch.d/$HOSTNAME.xml
  3204. chmod 600 /etc/sipwitch.d/$HOSTNAME.xml
  3205. emacs /etc/sipwitch.d/$HOSTNAME.xml
  3206. #+END_SRC
  3207. It should look something like the following:
  3208. #+BEGIN_SRC: bash
  3209. <provision>
  3210. <user id="myusername">
  3211. <digest>yourdigeststring</digest>
  3212. <extension>201</extension>
  3213. <display>Your full name</display>
  3214. </user>
  3215. </provision>
  3216. #+END_SRC
  3217. Save and exit. Now edit the configuration.
  3218. #+BEGIN_SRC: bash
  3219. emacs /etc/default/sipwitch
  3220. #+END_SRC
  3221. Change "desktop" to "server", then save and exit.
  3222. Update the IP settings:
  3223. #+BEGIN_SRC: bash
  3224. iptables -A INPUT -p tcp --dport 5060 -j ACCEPT
  3225. iptables -A INPUT -p udp --dport 5060 -j ACCEPT
  3226. iptables -A INPUT -p tcp --dport 5061 -j ACCEPT
  3227. iptables -A INPUT -p udp --dport 5061 -j ACCEPT
  3228. iptables-save
  3229. #+END_SRC
  3230. Test that it's working:
  3231. #+BEGIN_SRC: bash
  3232. pkill -9 sipw
  3233. sipw -x9 -f
  3234. #+END_SRC
  3235. Then try to register with the server using a SIP client (such as Jitsi). If everything worked then use CTRL-C to exit. Then start the service.
  3236. #+BEGIN_SRC: bash
  3237. service sipwitch start
  3238. #+END_SRC
  3239. *** Clients
  3240. **** Jitsi
  3241. Download the latst version from https://jitsi.org/index.php/Main/Download
  3242. TODO
  3243. **** Twinkle client
  3244. The client should have a user profile as following:
  3245. The "user name" is the xxx id used in the <user id="xxx"> entry of /etc/sipwitch.conf
  3246. The "domain" is the yyy domain in the main config <stack><domain>yyy entry of /etc/sipwitch.conf
  3247. The SIP Authentication should have:
  3248. realm = realm as set in <registry><realm> of /etc/sipwitch.conf
  3249. authentication name = <user id="xx"> entry, same as "User Name" field.
  3250. password = value of <secret>zzz in <user> entry of /etc/sipwitch.conf
  3251. Under security tab, set "Enable ZRTP/SRTP encryption"
  3252. **** Android
  3253. TODO
  3254. CSipSimple?
  3255. ** Install Mediagoblin
  3256. #+BEGIN_SRC: bash
  3257. apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv apache2-suexec libapache2-mod-fcgid
  3258. #+END_SRC
  3259. #+BEGIN_SRC: bash
  3260. adduser --system mediagoblin
  3261. addgroup mediagoblin
  3262. adduser mediagoblin mediagoblin
  3263. export HOSTNAME=mydomainname.com
  3264. cd /var/www/$HOSTNAME/htdocs
  3265. git clone git://gitorious.org/mediagoblin/mediagoblin.git mediagoblin
  3266. chown -hR mediagoblin:mediagoblin /var/www/$HOSTNAME/htdocs/mediagoblin
  3267. cd /var/www/$HOSTNAME/htdocs/mediagoblin
  3268. git submodule init && git submodule update
  3269. cp mediagoblin.ini mediagoblin_local.ini
  3270. emacs mediagoblin.ini
  3271. #+END_SRC
  3272. Set email_sender_address to the address you wish to be used as the sender for system-generated emails
  3273. Edit direct_remote_path, base_dir, and base_url if your mediagoblin directory is not the root directory of your vhost.
  3274. Save and exit.
  3275. #+BEGIN_SRC: bash
  3276. a2enmod suexec
  3277. a2enmod fcgid
  3278. emacs /etc/apache2/sites-available/$HOSTNAME
  3279. #+END_SRC
  3280. Add the following to the 80 virtual host, replacing mydomainname.com with your domain name.
  3281. #+BEGIN_SRC: bash
  3282. <Directory /var/www/mydomainname.com/htdocs/mediagoblin>
  3283. deny from all
  3284. </Directory>
  3285. #+END_SRC
  3286. Add the following to the 443 virtual host.
  3287. #+BEGIN_SRC: bash
  3288. # Serve static and media files via alias
  3289. Alias /mgoblin_static/ /var/www/mydomainname.com/htdocs/mediagoblin/mediagoblin/static/
  3290. Alias /mgoblin_media/ /var/www/mydomainname.com/htdocs/mediagoblin/user_dev/media/public/
  3291. # Rewrite all URLs to fcgi, except for static and media urls
  3292. RewriteEngine On
  3293. RewriteRule ^(mgoblin_static|mgoblin_media)($|/) - [L]
  3294. RewriteCond %{REQUEST_FILENAME} !-f
  3295. RewriteRule ^/(.*)$ /mg.fcgi/$1 [QSA,L]
  3296. # Allow access to static and media directories
  3297. <Directory /var/www/mydomainname.com/htdocs/mediagoblin/mediagoblin/static>
  3298. Order allow,deny
  3299. Allow from all
  3300. </Directory>
  3301. <Directory /var/www/mydomainname.com/htdocs/mediagoblin/mediagoblin/user_dev/media/public>
  3302. Order allow,deny
  3303. Allow from all
  3304. </Directory>
  3305. # Connect to fcgi server
  3306. FastCGIExternalServer /var/www/mg.fcgi -host 127.0.0.1:26543
  3307. #+END_SRC
  3308. Save and exit
  3309. #+BEGIN_SRC: bash
  3310. cd /var/www/$HOSTNAME/htdocs/mediagoblin
  3311. ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
  3312. #+END_SRC
  3313. https://github.com/joar/mediagoblin-init-scripts
  3314. ** Kune
  3315. Kune is a collaboration tool aimed at not just socialising but also getting stuff done within a community. It's based upon Apache Wave (formerly Google Wave).
  3316. #+BEGIN_SRC: bash
  3317. apt-get install openjdk-6-jdk openjdk-7-jre mysql-server adduser dbconfig-common libjmagick6-jni
  3318. #+END_SRC
  3319. Add the Kune repository:
  3320. #+BEGIN_SRC: bash
  3321. emacs /etc/apt/sources.list
  3322. #+END_SRC
  3323. Append the following:
  3324. #+BEGIN_SRC: bash
  3325. deb ftp://ftp.kune.ourproject.org/pub/kune/debian/ stable/
  3326. #+END_SRC
  3327. Save and exit, then install the Kune package.
  3328. #+BEGIN_SRC: bash
  3329. gpg --keyserver pgp.mit.edu --recv-keys 9E358A05
  3330. gpg --armor --export 9E358A05 | apt-key add -
  3331. apt-get update
  3332. apt-get install kune
  3333. #+END_SRC
  3334. You will be asked for the MySql root password and another password to be used with the Kune database.
  3335. Allow the system to start automatically at boot.
  3336. #+BEGIN_SRC: bash
  3337. emacs /etc/default/kune
  3338. #+END_SRC
  3339. Set /START=yes/, then save and exit.
  3340. #+BEGIN_SRC: bash
  3341. service kune start
  3342. #+END_SRC
  3343. Now configure Apache.
  3344. #+BEGIN_SRC: bash
  3345. a2enmod expires
  3346. a2enmod proxy
  3347. a2enmod proxy_connect
  3348. a2enmod proxy_http
  3349. #+END_SRC
  3350. Upgrade the database.
  3351. #+BEGIN_SRC: bash
  3352. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.1.0+b5
  3353. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.1.0+b6
  3354. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.2.0+b12
  3355. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.2.0+b23
  3356. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.2.0+b25
  3357. #+END_SRC
  3358. Edit the Apache configuration.
  3359. #+BEGIN_SRC: bash
  3360. emacs /etc/apache2/sites-available/$HOSTNAME
  3361. #+END_SRC
  3362. <VirtualHost *:80>
  3363. ServerName YOURSERVERNAME
  3364. ProxyRequests Off
  3365. <Proxy *>
  3366. Order deny,allow
  3367. Allow from all
  3368. </Proxy>
  3369. <Files *.cache.*>
  3370. ExpiresActive On
  3371. ExpiresDefault "modification plus 2 years"
  3372. </Files>
  3373. <Files *.nocache.*>
  3374. ExpiresActive Off
  3375. </Files>
  3376. ProxyPass /kune/ http://localhost:8888/
  3377. ProxyPassReverse /kune/ http://localhost:8888/
  3378. <Location /var/www/mydomainname.com/htdocs/kune/>
  3379. Order allow,deny
  3380. Allow from all
  3381. </Location>
  3382. </VirtualHost>
  3383. Within a browser open https://mydomainname.com:8888
  3384. See documentation in /usr/share/doc/kune/INSTALL.gz
  3385. * Related projects
  3386. * [[https://freedomboxfoundation.org/][Freedombox]]
  3387. * [[https://arkos.io/][ArkOS]]