beaglebone.txt 160KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142
  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 ; /usr/bin/timeout 120 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. ip6tables -P INPUT ACCEPT
  345. iptables -F
  346. ip6tables -F
  347. iptables -X
  348. ip6tables -X
  349. # Drop any IPv6 traffic
  350. ip6tables -A INPUT -p icmp -j DROP
  351. ip6tables -A INPUT -p tcp -j DROP
  352. ip6tables -A INPUT -p udp -j DROP
  353. # Drop access to unused ports
  354. iptables -A INPUT -p tcp --destination-port 1 -j DROP
  355. iptables -A INPUT -p tcp --destination-port 7 -j DROP
  356. iptables -A INPUT -p tcp --destination-port 109:111 -j DROP
  357. iptables -A INPUT -p tcp --destination-port 995 -j DROP
  358. iptables -A INPUT -p tcp --destination-port 139 -j DROP
  359. iptables -A INPUT -p tcp --destination-port 6000:6001 -j DROP
  360. iptables -A INPUT -p tcp --destination-port 9 -j DROP
  361. iptables -A INPUT -p tcp --destination-port 79 -j DROP
  362. iptables -A INPUT -p tcp --destination-port 515 -j DROP
  363. iptables -A INPUT -p tcp --destination-port 4001 -j DROP
  364. iptables -A INPUT -p tcp --destination-port 1524 -j DROP
  365. iptables -A INPUT -p tcp --destination-port 1080 -j DROP
  366. iptables -A INPUT -p tcp --destination-port 512:514 -j DROP
  367. iptables -A INPUT -p tcp --destination-port 31337 -j DROP
  368. iptables -A INPUT -p tcp --destination-port 2000:2001 -j DROP
  369. iptables -A INPUT -p tcp --destination-port 12345 -j DROP
  370. iptables -A INPUT -p tcp --destination-port 32771:32774 -j DROP
  371. iptables -A INPUT -p tcp --destination-port 4000 -j DROP
  372. iptables -A INPUT -p tcp --destination-port 119 -j DROP
  373. iptables -A INPUT -p tcp --destination-port 137 -j DROP
  374. iptables -A INPUT -p udp --destination-port 1 -j DROP
  375. iptables -A INPUT -p udp --destination-port 7 -j DROP
  376. iptables -A INPUT -p udp --destination-port 109:111 -j DROP
  377. iptables -A INPUT -p udp --destination-port 995 -j DROP
  378. iptables -A INPUT -p udp --destination-port 139 -j DROP
  379. iptables -A INPUT -p udp --destination-port 6000:6001 -j DROP
  380. iptables -A INPUT -p udp --destination-port 9 -j DROP
  381. iptables -A INPUT -p udp --destination-port 79 -j DROP
  382. iptables -A INPUT -p udp --destination-port 515 -j DROP
  383. iptables -A INPUT -p udp --destination-port 4001 -j DROP
  384. iptables -A INPUT -p udp --destination-port 1524 -j DROP
  385. iptables -A INPUT -p udp --destination-port 1080 -j DROP
  386. iptables -A INPUT -p udp --destination-port 512:514 -j DROP
  387. iptables -A INPUT -p udp --destination-port 31337 -j DROP
  388. iptables -A INPUT -p udp --destination-port 2000:2001 -j DROP
  389. iptables -A INPUT -p udp --destination-port 12345 -j DROP
  390. iptables -A INPUT -p udp --destination-port 32771:32774 -j DROP
  391. iptables -A INPUT -p udp --destination-port 4000 -j DROP
  392. iptables -A INPUT -p udp --destination-port 119 -j DROP
  393. iptables -A INPUT -p udp --destination-port 137 -j DROP
  394. # Make sure NEW incoming tcp connections are SYN packets
  395. iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
  396. # Drop packets with incoming fragments
  397. iptables -A INPUT -f -j DROP
  398. # Incoming malformed XMAS packets drop them
  399. iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
  400. iptables -A INPUT -p tcp --tcp-flags ALL FIN,PSH,URG -j DROP
  401. iptables -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
  402. # Incoming malformed NULL packets:
  403. iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
  404. # Drop UDP to used ports
  405. iptables -A INPUT -p udp --match multiport --dports 70,80,443,143,6670,993,5060,5061,25 -j DROP
  406. iptables -A INPUT -p udp --match multiport --dports 465,22,5222,5223,5269,5280,5281,8444 -j DROP
  407. # Limit ssh logins
  408. iptables -A INPUT -p tcp --dport 22 -m limit --limit 3/minute --limit-burst 1 -j ACCEPT
  409. # Limit web connections
  410. iptables -A INPUT -p tcp --dport 80 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  411. iptables -A INPUT -p tcp --dport 443 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  412. # Limit number of XMPP connections
  413. iptables -A INPUT -p tcp --match multiport --dports 5222:5223,5269,5280:5281 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  414. # Limit IRC connections
  415. iptables -A INPUT -p tcp --dport 6666:6670 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  416. # Limit gopher connections
  417. iptables -A INPUT -p tcp --dport 70 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  418. # Limit IMAP connections
  419. iptables -A INPUT -p tcp --dport 143 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  420. iptables -A INPUT -p tcp --dport 993 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  421. # Limit SIP connections
  422. iptables -A INPUT -p tcp --dport 5060:5061 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  423. # Limit SMTP/SMTPS connections
  424. iptables -A INPUT -p tcp --dport 25 -m limit --limit 3/minute --limit-burst 1 -j ACCEPT
  425. iptables -A INPUT -p tcp --dport 465 -m limit --limit 3/minute --limit-burst 1 -j ACCEPT
  426. # Limit Bitmessage connections
  427. iptables -A INPUT -p tcp --dport 8444 -m limit --limit 10/minute --limit-burst 1 -j ACCEPT
  428. # Limit the number of incoming tcp connections
  429. # Interface 0 incoming syn-flood protection
  430. iptables -N syn_flood
  431. iptables -A INPUT -p tcp --syn -j syn_flood
  432. iptables -A syn_flood -m limit --limit 1/s --limit-burst 3 -j RETURN
  433. iptables -A syn_flood -j DROP
  434. # Limiting the incoming icmp ping request:
  435. #iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j ACCEPT
  436. #iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j LOG --log-prefix PING-DROP:
  437. iptables -A INPUT -p icmp -j DROP
  438. #iptables -A OUTPUT -p icmp -j ACCEPT
  439. # Save the settings
  440. iptables-save > /etc/firewall.conf
  441. ip6tables-save > /etc/firewall6.conf
  442. printf '#!/bin/sh\n' > /etc/network/if-up.d/iptables
  443. printf 'iptables-restore < /etc/firewall.conf\n' >> /etc/network/if-up.d/iptables
  444. printf 'ip6tables-restore < /etc/firewall6.conf\n' >> /etc/network/if-up.d/iptables
  445. chmod +x /etc/network/if-up.d/iptables
  446. #+END_SRC
  447. Save and exit.
  448. Note that this will disable IP version 6. At the time of writing it is expected that the average internet user is running on IP version 4.
  449. #+BEGIN_SRC: bash
  450. chmod +x /tmp/firewall.sh
  451. . /tmp/firewall.sh
  452. rm /tmp/firewall.sh
  453. #+END_SRC
  454. 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.
  455. #+BEGIN_SRC: bash
  456. emacs /etc/sysctl.conf
  457. #+END_SRC
  458. Uncomment or change the following:
  459. #+BEGIN_SRC: bash
  460. net.ipv4.conf.all.accept_redirects = 0
  461. net.ipv6.conf.all.accept_redirects = 0
  462. net.ipv4.conf.all.send_redirects = 0
  463. net.ipv4.conf.all.accept_source_route = 0
  464. net.ipv6.conf.all.accept_source_route = 0
  465. net.ipv4.conf.default.rp_filter=1
  466. net.ipv4.conf.all.rp_filter=1
  467. net.ipv4.ip_forward=0
  468. net.ipv6.conf.all.forwarding=0
  469. #+END_SRC
  470. And append the following:
  471. #+BEGIN_SRC: bash
  472. # ignore pings
  473. net.ipv4.icmp_echo_ignore_all = 1
  474. # disable ipv6
  475. net.ipv6.conf.all.disable_ipv6 = 1
  476. #+END_SRC
  477. 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:
  478. #+BEGIN_SRC: bash
  479. reboot
  480. #+END_SRC
  481. ** Install Email
  482. #+BEGIN_VERSE
  483. /If you knew what I know about email, you might not use it/
  484. -- Ladar Levison
  485. #+END_VERSE
  486. 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.
  487. Exim4 seems much easier to install and configure than Postfix.
  488. #+BEGIN_SRC: bash
  489. aptitude install exim4 sasl2-bin swaks libnet-ssleay-perl procmail
  490. #+END_SRC
  491. You will be prompted to remove postfix. Say yes and yes again.
  492. #+BEGIN_SRC: bash
  493. dpkg-reconfigure exim4-config
  494. #+END_SRC
  495. Settings as follows:
  496. #+BEGIN_SRC: bash
  497. internet site
  498. System mail name: mydomainname.com
  499. IP addresses to listen on: blank
  500. Destinations: mydomainname.com
  501. Domains to relay mail: blank
  502. Smarthost Relay: 192.168.1.0/60 (the range of addresses on your LAN)
  503. Dial on demand = no
  504. Maildir format in home directory
  505. Split configuration = no
  506. Root and postmaster: root email
  507. #+END_SRC
  508. To test the installation:
  509. #+BEGIN_SRC: bash
  510. telnet 192.168.1.60 25
  511. ehlo xxx
  512. quit
  513. #+END_SRC
  514. #+BEGIN_SRC: bash
  515. emacs /etc/default/saslauthd
  516. #+END_SRC
  517. set START=yes then save and exit.
  518. #+BEGIN_SRC: bash
  519. /etc/init.d/saslauthd start
  520. emacs exim-gencert
  521. #+END_SRC
  522. #+BEGIN_SRC: bash
  523. #!/bin/sh -e
  524. if [ -n "$EX4DEBUG" ]; then
  525. echo "now debugging $0 $@"
  526. set -x
  527. fi
  528. DIR=/etc/exim4
  529. CERT=$DIR/exim.crt
  530. KEY=$DIR/exim.key
  531. # This exim binary was built with GnuTLS which does not support dhparams
  532. # from a file. See /usr/share/doc/exim4-base/README.Debian.gz
  533. #DH=$DIR/exim.dhparam
  534. if ! which openssl > /dev/null ;then
  535. echo "$0: openssl is not installed, exiting" 1>&2
  536. exit 1
  537. fi
  538. # valid for ten years
  539. DAYS=3650
  540. if [ "$1" != "--force" ] && [ -f $CERT ] && [ -f $KEY ]; then
  541. echo "[*] $CERT and $KEY exists!"
  542. echo " Use \"$0 --force\" to force generation!"
  543. exit 0
  544. fi
  545. if [ "$1" = "--force" ]; then
  546. shift
  547. fi
  548. #SSLEAY=/tmp/exim.ssleay.$$.cnf
  549. SSLEAY="$(tempfile -m600 -pexi)"
  550. cat > $SSLEAY <<EOM
  551. RANDFILE = $HOME/.rnd
  552. [ req ]
  553. default_bits = 4096
  554. default_keyfile = exim.key
  555. distinguished_name = req_distinguished_name
  556. [ req_distinguished_name ]
  557. countryName = Country Code (2 letters)
  558. countryName_default = GB
  559. countryName_min = 2
  560. countryName_max = 2
  561. stateOrProvinceName = State or Province Name (full name)
  562. localityName = Locality Name (eg, city)
  563. organizationName = Organization Name (eg, company; recommended)
  564. organizationName_max = 64
  565. organizationalUnitName = Organizational Unit Name (eg, section)
  566. organizationalUnitName_max = 64
  567. commonName = Server name (eg. ssl.domain.tld; required!!!)
  568. commonName_max = 64
  569. emailAddress = Email Address
  570. emailAddress_max = 40
  571. EOM
  572. echo "[*] Creating a self signed SSL certificate for Exim!"
  573. echo " This may be sufficient to establish encrypted connections but for"
  574. echo " secure identification you need to buy a real certificate!"
  575. echo " "
  576. echo " Please enter the hostname of your MTA at the Common Name (CN) prompt!"
  577. echo " "
  578. openssl req -config $SSLEAY -x509 -sha256 -newkey rsa:4096 -keyout $KEY -out $CERT -days $DAYS -nodes
  579. #see README.Debian.gz*# openssl dhparam -check -text -5 512 -out $DH
  580. rm -f $SSLEAY
  581. chown root:Debian-exim $KEY $CERT $DH
  582. chmod 640 $KEY $CERT $DH
  583. echo "[*] Done generating self signed certificates for exim!"
  584. echo " Refer to the documentation and example configuration files"
  585. echo " over at /usr/share/doc/exim4-base/ for an idea on how to enable TLS"
  586. echo " support in your mail transfer agent."
  587. #+END_SRC
  588. Save and exit
  589. #+BEGIN_SRC: bash
  590. chmod +x exim-gencert
  591. ./exim-gencert
  592. #+END_SRC
  593. 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.
  594. #+BEGIN_SRC: bash
  595. emacs /etc/exim4/exim4.conf.template
  596. #+END_SRC
  597. Append the following:
  598. #+BEGIN_SRC: bash
  599. login_saslauthd_server:
  600. driver = plaintext
  601. public_name = LOGIN
  602. server_prompts = "Username:: : Password::"
  603. # don't send system passwords over unencrypted connections
  604. server_condition = ${if saslauthd{{$auth1}{$auth2}}{1}{0}}
  605. server_set_id = $auth1
  606. .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  607. server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}
  608. .endif
  609. #+END_SRC
  610. Search for the line *.ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME* and above it insert the line:
  611. #+BEGIN_SRC: bash
  612. MAIN_HARDCODE_PRIMARY_HOSTNAME = mydomainname.com
  613. #+END_SRC
  614. Save and exit.
  615. #+BEGIN_SRC: bash
  616. emacs /etc/exim4/exim4.conf.template
  617. #+END_SRC
  618. Add the line:
  619. #+BEGIN_SRC: bash
  620. MAIN_TLS_ENABLE = true
  621. #+END_SRC
  622. Save and exit.
  623. #+BEGIN_SRC: bash
  624. emacs /etc/default/exim4
  625. change SMTPLISTENEROPTIONS to:
  626. SMTPLISTENEROPTIONS='-oX 465:25 -oP /var/run/exim4/exim.pid'
  627. #+END_SRC
  628. save and exit
  629. #+BEGIN_SRC: bash
  630. emacs /etc/exim4/exim4.conf.template
  631. under the section "main/03_exim4-config_tlsoptions"
  632. Add the following:
  633. tls_on_connect_ports=465
  634. #+END_SRC
  635. save and exit
  636. #+BEGIN_SRC: bash
  637. adduser myusername sasl
  638. addgroup Debian-exim sasl
  639. /etc/init.d/exim4 restart
  640. mkdir -m 700 /etc/skel/Maildir
  641. mkdir -m 700 /etc/skel/Maildir/Sent
  642. mkdir -m 700 /etc/skel/Maildir/Sent/tmp
  643. mkdir -m 700 /etc/skel/Maildir/Sent/cur
  644. mkdir -m 700 /etc/skel/Maildir/Sent/new
  645. mkdir -m 700 /etc/skel/Maildir/.learn-spam
  646. mkdir -m 700 /etc/skel/Maildir/.learn-spam/cur
  647. mkdir -m 700 /etc/skel/Maildir/.learn-spam/new
  648. mkdir -m 700 /etc/skel/Maildir/.learn-spam/tmp
  649. mkdir -m 700 /etc/skel/Maildir/.learn-ham
  650. mkdir -m 700 /etc/skel/Maildir/.learn-ham/cur
  651. mkdir -m 700 /etc/skel/Maildir/.learn-ham/new
  652. mkdir -m 700 /etc/skel/Maildir/.learn-ham/tmp
  653. ln -s /etc/skel/Maildir/.learn-spam /etc/skel/Maildir/spam
  654. ln -s /etc/skel/Maildir/.learn-ham /etc/skel/Maildir/ham
  655. #+END_SRC
  656. If you're starting from scratch and don't already have a /Maildir/ directory in your home directory, then create one as follows:
  657. #+BEGIN_SRC: bash
  658. export MYUSERNAME=myusername
  659. mkdir -m 700 /home/$MYUSERNAME/Maildir
  660. mkdir -m 700 /home/$MYUSERNAME/Maildir/cur
  661. mkdir -m 700 /home/$MYUSERNAME/Maildir/tmp
  662. mkdir -m 700 /home/$MYUSERNAME/Maildir/new
  663. mkdir -m 700 /home/$MYUSERNAME/Maildir/Sent
  664. mkdir -m 700 /home/$MYUSERNAME/Maildir/Sent/cur
  665. mkdir -m 700 /home/$MYUSERNAME/Maildir/Sent/tmp
  666. mkdir -m 700 /home/$MYUSERNAME/Maildir/Sent/new
  667. mkdir -m 700 /home/$MYUSERNAME/Maildir/.learn-spam
  668. mkdir -m 700 /home/$MYUSERNAME/Maildir/.learn-spam/cur
  669. mkdir -m 700 /home/$MYUSERNAME/Maildir/.learn-spam/new
  670. mkdir -m 700 /home/$MYUSERNAME/Maildir/.learn-spam/tmp
  671. mkdir -m 700 /home/$MYUSERNAME/Maildir/.learn-ham
  672. mkdir -m 700 /home/$MYUSERNAME/Maildir/.learn-ham/cur
  673. mkdir -m 700 /home/$MYUSERNAME/Maildir/.learn-ham/new
  674. mkdir -m 700 /home/$MYUSERNAME/Maildir/.learn-ham/tmp
  675. ln -s /home/$MYUSERNAME/Maildir/.learn-spam /home/$MYUSERNAME/Maildir/spam
  676. ln -s /home/$MYUSERNAME/Maildir/.learn-ham /home/$MYUSERNAME/Maildir/ham
  677. chown -R $MYUSERNAME:$MYUSERNAME /home/$MYUSERNAME/Maildir
  678. #+END_SRC
  679. ** Spam filtering
  680. #+BEGIN_SRC: bash
  681. apt-get install spamassassin exim4-daemon-heavy
  682. emacs /etc/default/spamassassin
  683. #+END_SRC
  684. Set ENABLED=1 then save and exit.
  685. #+BEGIN_SRC: bash
  686. emacs /etc/exim4/exim4.conf.template
  687. #+END_SRC
  688. uncomment or change according to your configuration
  689. #+BEGIN_SRC: bash
  690. # For spam scanning, there is a similar option that defines the interface to
  691. # SpamAssassin. You do not need to set this if you are using the default, which
  692. # is shown in this commented example. As for virus scanning, you must also
  693. # modify the acl_check_data access control list to enable spam scanning.
  694. spamd_address = 127.0.0.1 783
  695. #+END_SRC
  696. add spam header in the /acl_check_data/ section:
  697. #+BEGIN_SRC: bash
  698. ### acl/40_exim4-config_check_data
  699. #################################
  700. # This ACL is used after the contents of a message have been received. This
  701. # is the ACL in which you can test a message's headers or body, and in
  702. # particular, this is where you can invoke external virus or spam scanners.
  703. acl_check_data:
  704. ...
  705. ...
  706. ...
  707. # See the exim docs and the exim wiki for more suitable examples.
  708. #
  709. # warn
  710. # spam = Debian-exim:true
  711. # add_header = X-Spam_score: $spam_score\n\
  712. # X-Spam_score_int: $spam_score_int\n\
  713. # X-Spam_bar: $spam_bar\n\
  714. # X-Spam_report: $spam_report
  715. # put headers in all messages (no matter if spam or not)
  716. warn spam = nobody:true
  717. add_header = X-Spam-Score: $spam_score ($spam_bar)
  718. add_header = X-Spam-Report: $spam_report
  719. # add second subject line with *SPAM* marker when message
  720. # is over threshold
  721. warn spam = nobody
  722. add_header = Subject: ***SPAM (score:$spam_score)*** $h_Subject:
  723. #+END_SRC
  724. Save and exit.
  725. Then restart
  726. #+BEGIN_SRC: bash
  727. exit
  728. emacs ~/.procmailrc
  729. #+END_SRC
  730. The text should look like the following.
  731. #+BEGIN_SRC: sh
  732. MAILDIR=$HOME/Maildir
  733. DEFAULT=$MAILDIR/
  734. LOGFILE=$HOME/log/procmail.log
  735. LOGABSTRACT=all
  736. # get spamassassin to check emails
  737. :0fw: .spamassassin.lock
  738. * < 256000
  739. | spamc
  740. # strong spam are discarded
  741. :0
  742. * ^X-Spam-Level: \*\*\*\*\*\*
  743. /dev/null
  744. # weak spam are kept just in case - clear this out every now and then
  745. :0
  746. * ^X-Spam-Level: \*\*\*\*\*
  747. .0-spam/
  748. # otherwise, marginal spam goes here for revision
  749. :0
  750. * ^X-Spam-Level: \*\*
  751. .spam/
  752. #+END_SRC
  753. Save and exit.
  754. #+BEGIN_SRC: bash
  755. su
  756. emacs /usr/bin/filterspam
  757. #+END_SRC
  758. Add the following contents:
  759. #+BEGIN_SRC: bash
  760. #!/bin/bash
  761. USERNAME=$1
  762. MAILDIR=/home/$USERNAME/Maildir/.learn-spam
  763. if [ ! -d "$MAILDIR" ]; then
  764. exit
  765. fi
  766. for f in `ls $MAILDIR/cur`
  767. do
  768. spamc -L spam < "$MAILDIR/cur/$f" > /dev/null
  769. rm "$MAILDIR/cur/$f"
  770. done
  771. for f in `ls $MAILDIR/new`
  772. do
  773. spamc -L spam < "$MAILDIR/new/$f" > /dev/null
  774. rm "$MAILDIR/new/$f"
  775. done
  776. #+END_SRC
  777. Save and exit.
  778. #+BEGIN_SRC: bash
  779. emacs /usr/bin/filterham
  780. #+END_SRC
  781. Add the following contents:
  782. #+BEGIN_SRC: bash
  783. #!/bin/bash
  784. USERNAME=$1
  785. MAILDIR=/home/$USERNAME/Maildir/.learn-ham
  786. if [ ! -d "$MAILDIR" ]; then
  787. exit
  788. fi
  789. for f in `ls $MAILDIR/cur`
  790. do
  791. spamc -L ham < "$MAILDIR/cur/$f" > /dev/null
  792. rm "$MAILDIR/cur/$f"
  793. done
  794. for f in `ls $MAILDIR/new`
  795. do
  796. spamc -L ham < "$MAILDIR/new/$f" > /dev/null
  797. rm "$MAILDIR/new/$f"
  798. done
  799. #+END_SRC
  800. Save and exit.
  801. #+BEGIN_SRC: bash
  802. emacs /etc/crontab
  803. #+END_SRC
  804. Append the following, replacing *myusername* with your username.
  805. #+BEGIN_SRC: bash
  806. */3 * * * * root /usr/bin/timeout 120 /usr/bin/filterspam myusername
  807. */3 * * * * root /usr/bin/timeout 120 /usr/bin/filterham myusername
  808. #+END_SRC
  809. Save and exit.
  810. #+BEGIN_SRC: bash
  811. chmod 655 /usr/bin/filterspam /usr/bin/filterham
  812. service spamassassin restart
  813. service exim4 restart
  814. service cron restart
  815. #+END_SRC
  816. ** Install Dovecot
  817. Install the required packages.
  818. #+BEGIN_SRC: bash
  819. aptitude -y install dovecot-common dovecot-pop3d dovecot-imapd
  820. #+END_SRC
  821. Edit the configuration file.
  822. #+BEGIN_SRC: bash
  823. emacs /etc/dovecot/dovecot.conf
  824. #+END_SRC
  825. Line 26: change:
  826. #+BEGIN_SRC: bash
  827. listen = *
  828. #+END_SRC
  829. Save and exit.
  830. #+BEGIN_SRC: bash
  831. emacs /etc/dovecot/conf.d/10-auth.conf
  832. #+END_SRC
  833. Line 9: uncomment and change (allow plain text auth)
  834. #+BEGIN_SRC: bash
  835. disable_plaintext_auth = no
  836. #+END_SRC
  837. Line 99: add:
  838. #+BEGIN_SRC: bash
  839. auth_mechanisms = plain login
  840. #+END_SRC
  841. Save and exit.
  842. #+BEGIN_SRC: bash
  843. emacs /etc/dovecot/conf.d/10-mail.conf
  844. #+END_SRC
  845. Line 30: uncomment and add:
  846. #+BEGIN_SRC: bash
  847. mail_location = maildir:~/Maildir:LAYOUT=fs
  848. #+END_SRC
  849. Save and exit, then start the dovecot service.
  850. #+BEGIN_SRC: bash
  851. service dovecot restart
  852. #+END_SRC
  853. ** Create Email folders and rules
  854. *** Rules for mailing lists
  855. 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.
  856. We can make a script to make adding mailing list rules easy:
  857. #+BEGIN_SRC: bash
  858. emacs /usr/bin/mailinglistrule
  859. #+END_SRC
  860. Add the following:
  861. #+BEGIN_SRC: bash
  862. #!/bin/bash
  863. MYUSERNAME=$1
  864. MAILINGLIST=$2
  865. SUBJECTTAG=$3
  866. MUTTRC=/home/$MYUSERNAME/.muttrc
  867. PM=/home/$MYUSERNAME/.procmailrc
  868. LISTDIR=/home/$MYUSERNAME/Maildir/$MAILINGLIST
  869. if [ ! -d "$LISTDIR" ]; then
  870. mkdir -m 700 $LISTDIR
  871. mkdir -m 700 $LISTDIR/tmp
  872. mkdir -m 700 $LISTDIR/new
  873. mkdir -m 700 $LISTDIR/cur
  874. fi
  875. chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR
  876. echo "" >> $PM
  877. echo ":0" >> $PM
  878. echo " * ^Subject:.*()\[$SUBJECTTAG\]" >> $PM
  879. echo "$LISTDIR/new" >> $PM
  880. chown $MYUSERNAME:$MYUSERNAME $PM
  881. if [ ! -f "$MUTTRC" ]; then
  882. cp /etc/Muttrc $MUTTRC
  883. chown $MYUSERNAME:$MYUSERNAME $MUTTRC
  884. fi
  885. #+END_SRC
  886. Save and exit, then make the script executable.
  887. #+BEGIN_SRC: bash
  888. chmod +x /usr/bin/mailinglistrule
  889. #+END_SRC
  890. 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.
  891. #+BEGIN_SRC: bash
  892. mailinglistrule [myusername] [mailinglistname] [subjecttag]
  893. #+END_SRC
  894. Repeat this command for as many mailing lists as you need. Then edit your local Mutt configuration.
  895. #+BEGIN_SRC: bash
  896. emacs /home/myusername/.muttrc
  897. #+END_SRC
  898. Search for the *mailboxes* variable and add entries for the mailing lists you just created. For example:
  899. #+BEGIN_SRC: bash
  900. mailboxes = =Sent =mailinglistname
  901. #+END_SRC
  902. Then save and exit.
  903. *** Rules for specific email addresses
  904. You can also make a script which will allow you to move mail from specific email addresses to a folder.
  905. #+BEGIN_SRC: bash
  906. emacs /usr/bin/emailrule
  907. #+END_SRC
  908. Add the following:
  909. #+BEGIN_SRC: bash
  910. #!/bin/bash
  911. MYUSERNAME=$1
  912. EMAILADDRESS=$2
  913. MAILINGLIST=$3
  914. MUTTRC=/home/$MYUSERNAME/.muttrc
  915. PM=/home/$MYUSERNAME/.procmailrc
  916. LISTDIR=/home/$MYUSERNAME/Maildir/$MAILINGLIST
  917. if [ ! -d "$LISTDIR" ]; then
  918. mkdir -m 700 $LISTDIR
  919. mkdir -m 700 $LISTDIR/tmp
  920. mkdir -m 700 $LISTDIR/new
  921. mkdir -m 700 $LISTDIR/cur
  922. fi
  923. chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR
  924. echo "" >> $PM
  925. echo ":0" >> $PM
  926. echo " * ^From: $EMAILADDRESS" >> $PM
  927. echo "$LISTDIR/new" >> $PM
  928. chown $MYUSERNAME:$MYUSERNAME $PM
  929. if [ ! -f "$MUTTRC" ]; then
  930. cp /etc/Muttrc $MUTTRC
  931. chown $MYUSERNAME:$MYUSERNAME $MUTTRC
  932. fi
  933. #+END_SRC
  934. Save and exit, then make the script executable.
  935. #+BEGIN_SRC: bash
  936. chmod +x /usr/bin/emailrule
  937. #+END_SRC
  938. Then to add a particular email address to a folder run the command:
  939. #+BEGIN_SRC: bash
  940. emailrule [myusername] [emailaddress] [foldername]
  941. #+END_SRC
  942. If you want any mail from the given email address to be deleted then set the /foldername/ to /Trash/.
  943. To ensure that the folder appears within Mutt.
  944. #+BEGIN_SRC: bash
  945. emacs /home/myusername/.muttrc
  946. #+END_SRC
  947. Search for the *mailboxes* variable and add entries for the mailing lists you just created. For example:
  948. #+BEGIN_SRC: bash
  949. mailboxes = =Sent =foldername
  950. #+END_SRC
  951. Then save and exit.
  952. ** Setting up a web site
  953. #+BEGIN_VERSE
  954. /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./
  955. -- Tim Berners-Lee
  956. #+END_VERSE
  957. Edit the apache configuration so that it doesn't run out of memory if there are a lot of connections.
  958. #+BEGIN_SRC: bash
  959. su
  960. emacs /etc/apache2/apache2.conf
  961. #+END_SRC
  962. Search for MaxClients and replace the value with 6. As an example the settings should look something like this:
  963. #+BEGIN_SRC: bash
  964. <IfModule mpm_prefork_module>
  965. StartServers 3
  966. MinSpareServers 3
  967. MaxSpareServers 5
  968. MaxClients 6
  969. MaxRequestsPerChild 0
  970. </IfModule>
  971. <IfModule mpm_worker_module>
  972. StartServers 2
  973. MinSpareThreads 25
  974. MaxSpareThreads 75
  975. ThreadLimit 64
  976. ThreadsPerChild 25
  977. MaxClients 6
  978. MaxRequestsPerChild 0
  979. </IfModule>
  980. <IfModule mpm_event_module>
  981. StartServers 2
  982. MinSpareThreads 25
  983. MaxSpareThreads 75
  984. ThreadLimit 64
  985. ThreadsPerChild 25
  986. MaxClients 6
  987. MaxRequestsPerChild 0
  988. </IfModule>
  989. #+END_SRC
  990. Then save and exit In the examples below replace /mydomainname.com/ with your own domain name.
  991. #+BEGIN_SRC: bash
  992. export HOSTNAME=mydomainname.com
  993. mkdir /var/www/$HOSTNAME
  994. mkdir /var/www/$HOSTNAME/htdocs
  995. emacs /etc/apache2/sites-available/$HOSTNAME
  996. #+END_SRC
  997. The Apache configuration for the site should look something like the following. Replace /mydonainname.com/ with the site domain name.
  998. #+BEGIN_SRC: bash
  999. <VirtualHost *:80>
  1000. ServerAdmin myusername@mydomainname.com
  1001. ServerName mydomainname.com
  1002. DocumentRoot /var/www/mydomainname.com/htdocs
  1003. <Directory />
  1004. Options FollowSymLinks
  1005. AllowOverride All
  1006. </Directory>
  1007. <Directory /var/www/mydomainname.com/htdocs/>
  1008. Options All
  1009. AllowOverride All
  1010. Order allow,deny
  1011. allow from all
  1012. </Directory>
  1013. # Don't serve .php~ or .php# files created by emacs
  1014. <Files ~ "(^#.*#|~|\.sw[op])$">
  1015. Order allow,deny
  1016. Deny from all
  1017. </Files>
  1018. <IfModule headers_module>
  1019. Header set X-Content-Type-Options nosniff
  1020. Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate, private"
  1021. Header set Pragma no-cache
  1022. </IfModule>
  1023. <Files .htaccess>
  1024. deny from all
  1025. </Files>
  1026. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  1027. <Directory "/usr/lib/cgi-bin">
  1028. AllowOverride All
  1029. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  1030. Order allow,deny
  1031. Allow from all
  1032. </Directory>
  1033. ErrorLog ${APACHE_LOG_DIR}/error.log
  1034. # Possible values include: debug, info, notice, warn, error, crit,
  1035. # alert, emerg.
  1036. LogLevel error
  1037. CustomLog ${APACHE_LOG_DIR}/access.log combined
  1038. </VirtualHost>
  1039. <IfModule mod_ssl.c>
  1040. <VirtualHost *:443>
  1041. ServerAdmin myusername@mydomainname.com
  1042. ServerName mydomainname.com
  1043. DocumentRoot /var/www/mydomainname.com/htdocs
  1044. <Directory />
  1045. Options FollowSymLinks
  1046. AllowOverride All
  1047. </Directory>
  1048. <Directory /var/www/mydomainname.com/htdocs/>
  1049. Options All
  1050. AllowOverride All
  1051. Order allow,deny
  1052. allow from all
  1053. </Directory>
  1054. # Don't serve .php~ or .php# files created by emacs
  1055. <Files ~ "(^#.*#|~|\.sw[op])$">
  1056. Order allow,deny
  1057. Deny from all
  1058. </Files>
  1059. <IfModule headers_module>
  1060. Header set X-Content-Type-Options nosniff
  1061. Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate, private"
  1062. Header set Pragma no-cache
  1063. </IfModule>
  1064. <Files .htaccess>
  1065. deny from all
  1066. </Files>
  1067. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  1068. <Directory "/usr/lib/cgi-bin">
  1069. AllowOverride All
  1070. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  1071. Order allow,deny
  1072. Allow from all
  1073. </Directory>
  1074. ErrorLog ${APACHE_LOG_DIR}/error.log
  1075. # Possible values include: debug, info, notice, warn, error, crit,
  1076. # alert, emerg.
  1077. LogLevel error
  1078. CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
  1079. # SSL Engine Switch:
  1080. # Enable/Disable SSL for this virtual host.
  1081. SSLEngine on
  1082. # A self-signed certificate
  1083. SSLCertificateFile /etc/ssl/certs/mydomainname.com.crt
  1084. SSLCertificateKeyFile /etc/ssl/private/mydomainname.com.key
  1085. # Options based on bettercrypto.org
  1086. SSLProtocol All -SSLv2 -SSLv3
  1087. SSLHonorCipherOrder On
  1088. SSLCompression off
  1089. 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
  1090. # Add six earth month HSTS header for all users ...
  1091. Header add Strict-Transport-Security "max-age=15768000"
  1092. # If you want to protect all subdomains , use the following header
  1093. # ALL subdomains HAVE TO support https if you use this !
  1094. # Strict-Transport-Security: max-age=15768000 ; includeSubDomains
  1095. # SSL Engine Options:
  1096. # Set various options for the SSL engine.
  1097. # o FakeBasicAuth:
  1098. # Translate the client X.509 into a Basic Authorisation. This means that
  1099. # the standard Auth/DBMAuth methods can be used for access control. The
  1100. # user name is the `one line' version of the client's X.509 certificate.
  1101. # Note that no password is obtained from the user. Every entry in the user
  1102. # file needs this password: `xxj31ZMTZzkVA'.
  1103. # o ExportCertData:
  1104. # This exports two additional environment variables: SSL_CLIENT_CERT and
  1105. # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
  1106. # server (always existing) and the client (only existing when client
  1107. # authentication is used). This can be used to import the certificates
  1108. # into CGI scripts.
  1109. # o StdEnvVars:
  1110. # This exports the standard SSL/TLS related `SSL_*' environment variables.
  1111. # Per default this exportation is switched off for performance reasons,
  1112. # because the extraction step is an expensive operation and is usually
  1113. # useless for serving static content. So one usually enables the
  1114. # exportation for CGI and SSI requests only.
  1115. # o StrictRequire:
  1116. # This denies access when "SSLRequireSSL" or "SSLRequire" applied even
  1117. # under a "Satisfy any" situation, i.e. when it applies access is denied
  1118. # and no other module can change it.
  1119. # o OptRenegotiate:
  1120. # This enables optimized SSL connection renegotiation handling when SSL
  1121. # directives are used in per-directory context.
  1122. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
  1123. <FilesMatch "\.(cgi|shtml|phtml|php)$">
  1124. SSLOptions +StdEnvVars
  1125. </FilesMatch>
  1126. <Directory /usr/lib/cgi-bin>
  1127. SSLOptions +StdEnvVars
  1128. </Directory>
  1129. # SSL Protocol Adjustments:
  1130. # The safe and default but still SSL/TLS standard compliant shutdown
  1131. # approach is that mod_ssl sends the close notify alert but doesn't wait for
  1132. # the close notify alert from client. When you need a different shutdown
  1133. # approach you can use one of the following variables:
  1134. # o ssl-unclean-shutdown:
  1135. # This forces an unclean shutdown when the connection is closed, i.e. no
  1136. # SSL close notify alert is send or allowed to received. This violates
  1137. # the SSL/TLS standard but is needed for some brain-dead browsers. Use
  1138. # this when you receive I/O errors because of the standard approach where
  1139. # mod_ssl sends the close notify alert.
  1140. # o ssl-accurate-shutdown:
  1141. # This forces an accurate shutdown when the connection is closed, i.e. a
  1142. # SSL close notify alert is send and mod_ssl waits for the close notify
  1143. # alert of the client. This is 100% SSL/TLS standard compliant, but in
  1144. # practice often causes hanging connections with brain-dead browsers. Use
  1145. # this only for browsers where you know that their SSL implementation
  1146. # works correctly.
  1147. # Notice: Most problems of broken clients are also related to the HTTP
  1148. # keep-alive facility, so you usually additionally want to disable
  1149. # keep-alive for those clients, too. Use variable "nokeepalive" for this.
  1150. # Similarly, one has to force some clients to use HTTP/1.0 to workaround
  1151. # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
  1152. # "force-response-1.0" for this.
  1153. BrowserMatch "MSIE [2-6]" \
  1154. nokeepalive ssl-unclean-shutdown \
  1155. downgrade-1.0 force-response-1.0
  1156. # MSIE 7 and newer should be able to use keepalive
  1157. BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
  1158. </VirtualHost>
  1159. </IfModule>
  1160. #+END_SRC
  1161. Then to enable the site:
  1162. #+BEGIN_SRC: bash
  1163. a2ensite
  1164. a2dissite default
  1165. a2dissite default-ssl
  1166. a2enmod rewrite
  1167. a2enmod headers
  1168. #+END_SRC
  1169. Ensure that "NameVirtualHost *:443" is added to /etc/apache2/ports.conf. It should look something like the following:
  1170. #+BEGIN_SRC: bash
  1171. NameVirtualHost *:80
  1172. Listen 80
  1173. <IfModule mod_ssl.c>
  1174. NameVirtualHost *:443
  1175. Listen 443
  1176. </IfModule>
  1177. <IfModule mod_gnutls.c>
  1178. NameVirtualHost *:443
  1179. Listen 443
  1180. </IfModule>
  1181. #+END_SRC
  1182. Create a self-signed certificate. The passphrase isn't important and will be removed, so make it easy (such as "password").
  1183. #+BEGIN_SRC: bash
  1184. emacs makecert
  1185. #+END_SRC
  1186. Enter the following:
  1187. #+BEGIN_SRC: bash
  1188. #!/bin/bash
  1189. HOSTNAME=$1
  1190. openssl genrsa -des3 -out $HOSTNAME.key 1024
  1191. openssl req -new -x509 -nodes -sha1 -days 3650 -key $HOSTNAME.key -out $HOSTNAME.crt
  1192. openssl rsa -in $HOSTNAME.key -out $HOSTNAME.new.key
  1193. cp $HOSTNAME.new.key $HOSTNAME.key
  1194. rm $HOSTNAME.new.key
  1195. cp $HOSTNAME.key /etc/ssl/private
  1196. chmod 400 /etc/ssl/private/$HOSTNAME.key
  1197. cp $HOSTNAME.crt /etc/ssl/certs
  1198. shred -zu $HOSTNAME.key $HOSTNAME.crt
  1199. a2enmod ssl
  1200. service apache2 restart
  1201. #+END_SRC
  1202. Save and exit.
  1203. #+BEGIN_SRC: bash
  1204. chmod +x makecert
  1205. ./makecert mydomainname.com
  1206. #+END_SRC
  1207. 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.
  1208. 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.
  1209. ** Accessing your Email
  1210. *** Mutt email client
  1211. #+BEGIN_VERSE
  1212. /I dreamt last night that I was living in a surveillance state. I woke up and… I’m still in a surveillance state./
  1213. -- Conrad Kramer
  1214. #+END_VERSE
  1215. #+BEGIN_SRC: bash
  1216. apt-get install mutt-patched lynx abook
  1217. exit
  1218. mkdir ~/.mutt
  1219. echo "text/html; lynx -dump -width=78 -nolist %s | sed ‘s/^ //’; copiousoutput; needsterminal; nametemplate=%s.html" > ~/.mutt/mailcap
  1220. #+END_SRC
  1221. Save and exit.
  1222. #+BEGIN_SRC: bash
  1223. su
  1224. emacs /etc/Muttrc
  1225. #+END_SRC
  1226. Append the following:
  1227. #+BEGIN_SRC: bash
  1228. set mbox_type=Maildir
  1229. set folder="~/Maildir"
  1230. set mask="!^\\.[^.]"
  1231. set mbox="~/Maildir"
  1232. set record="+Sent"
  1233. set postponed="+Drafts"
  1234. set trash="+Trash"
  1235. set spoolfile="~/Maildir"
  1236. auto_view text/x-vcard text/html text/enriched
  1237. set editor="emacsclient %s"
  1238. set header_cache="+.cache"
  1239. macro index S "<tag-prefix><save-message>=.learn-spam<enter>" "move to learn-spam"
  1240. macro pager S "<save-message>=.learn-spam<enter>" "move to learn-spam"
  1241. macro index H "<tag-prefix><copy-message>=.learn-ham<enter>" "copy to learn-ham"
  1242. macro pager H "<copy-message>=.learn-ham<enter>" "copy to learn-ham"
  1243. # set up the sidebar
  1244. set sidebar_width=12
  1245. set sidebar_visible=yes
  1246. set sidebar_delim='|'
  1247. set sidebar_sort=yes
  1248. set rfc2047_parameters
  1249. # Show inbox and sent items
  1250. mailboxes = =Sent
  1251. # Alter these colours as needed for maximum bling
  1252. color sidebar_new yellow default
  1253. color normal white default
  1254. color hdrdefault brightcyan default
  1255. color signature green default
  1256. color attachment brightyellow default
  1257. color quoted green default
  1258. color quoted1 white default
  1259. color tilde blue default
  1260. # ctrl-n, ctrl-p to select next, prev folder
  1261. # ctrl-o to open selected folder
  1262. bind index \Cp sidebar-prev
  1263. bind index \Cn sidebar-next
  1264. bind index \Co sidebar-open
  1265. bind pager \Cp sidebar-prev
  1266. bind pager \Cn sidebar-next
  1267. bind pager \Co sidebar-open
  1268. # ctrl-b toggles sidebar visibility
  1269. macro index \Cb '<enter-command>toggle sidebar_visible<enter><refresh>' "toggle sidebar"
  1270. macro pager \Cb '<enter-command>toggle sidebar_visible<enter><redraw-screen>' "toggle sidebar"
  1271. # esc-m Mark new messages as read
  1272. macro index <esc>m "T~N<enter>;WNT~O<enter>;WO\CT~T<enter>" "mark all messages read"
  1273. #+END_SRC
  1274. Save and exit.
  1275. #+BEGIN_SRC: bash
  1276. emacs /etc/mail/spamassassin/local.cf
  1277. #+END_SRC
  1278. Uncomment *use_bayes*, *bayes_auto_learn*
  1279. Save and exit, then run:
  1280. #+BEGIN_SRC: bash
  1281. service spamassassin restart
  1282. #+END_SRC
  1283. Now to add an address book:
  1284. #+BEGIN_SRC: bash
  1285. emacs ~/.muttrc
  1286. #+END_SRC
  1287. Append the following:
  1288. #+BEGIN_SRC: bash
  1289. set alias_file=~/.mutt-alias
  1290. source ~/.mutt-alias
  1291. set query_command= "abook --mutt-query '%s'"
  1292. macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook"
  1293. #+END_SRC
  1294. Then save and exit.
  1295. #+BEGIN_SRC: bash
  1296. touch ~/.mutt-alias
  1297. #+END_SRC
  1298. 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.
  1299. 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.
  1300. Some useful keys to know are:
  1301. | ESC / | Search for text within message contents |
  1302. | "/" | Search for text within headers |
  1303. | * | Move to the last message |
  1304. | TAB | Move to the next unread message |
  1305. | d | Delete a message |
  1306. | u | Undelete a mail which is pending deletion |
  1307. | $ | Delete all messages selected and check for new messages |
  1308. | a | Add to the address book |
  1309. | m | Send a new mail |
  1310. | ESC-m | Mark all messages as having been read |
  1311. | S | Mark a message as spam |
  1312. | H | Mark a message as ham |
  1313. | CTRL-b | Toggle side bar on/off |
  1314. | CTRL-n | Next mailbox (on side bar) |
  1315. | CTRL-p | Previous mailbox (on side bar) |
  1316. | CTRL-o | Open mailbox (on side bar) |
  1317. *** K9 Android client
  1318. #+BEGIN_VERSE
  1319. /The surveillance state is robust. It is robust politically, legally, and technically./
  1320. -- Bruce Schneier
  1321. #+END_VERSE
  1322. **** Incoming server settings
  1323. * Select settings/account settings
  1324. * Select Fetching mail/incoming server
  1325. * Enter your username and password
  1326. * IMAP server should be your domain name
  1327. * Security: SSL/TLS (always)
  1328. * Authentication: Plain
  1329. * Port: 993
  1330. **** Outgoing (SMTP) server settings
  1331. * Select settings/account settings
  1332. * Select Sending mail/outgoing server
  1333. * Set SMTP server to your domain name
  1334. * Set Security to SSL/TLS (always)
  1335. * Set port to 465
  1336. * Set authentication to PLAIN
  1337. * Enter your username and password
  1338. * Accept the SSL certificate
  1339. **** Folders
  1340. To view any new folders which you may have created using the /mailinglistrule/ script from your inbox press the *K9 icon* at the top left to access folders, then press the *menu button* and select *refresh folder list*.
  1341. If your folder still doesn't show up then press the *menu button*, select *show folders* and select *all folders*.
  1342. *** Webmail
  1343. #+BEGIN_VERSE
  1344. /Most of the information extracted is "content", such as recordings of phone calls or the substance of email messages./
  1345. -- From a 2013 Guardian article on GCHQ/NSA bulk internet data interception.
  1346. #+END_VERSE
  1347. 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.
  1348. Install dependencies.
  1349. #+BEGIN_SRC: bash
  1350. apt-get install libapache2-mod-authz-unixgroup
  1351. #+END_SRC
  1352. Create a mysql database, specifying a password which should be a long random string generated with a password manager such as KeepassX.
  1353. #+BEGIN_SRC: bash
  1354. mysql -u root -p
  1355. create database roundcubemail;
  1356. CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'roundcubepassword';
  1357. GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost';
  1358. quit
  1359. #+END_SRC
  1360. Download roundcube.
  1361. #+BEGIN_SRC: bash
  1362. cd /tmp
  1363. wget http://freedombone.uk.to/roundcubemail.tar.gz
  1364. #+END_SRC
  1365. Verify it.
  1366. #+BEGIN_SRC: bash
  1367. sha256sum roundcubemail.tar.gz
  1368. e8a311b22a8e1f70abb72ed9551cc9233cf6c5221f1eebf1ae64974117e3148b roundcubemail.tar.gz
  1369. #+END_SRC
  1370. Extract the files.
  1371. #+BEGIN_SRC: bash
  1372. tar -xzvf roundcubemail.tar.gz
  1373. export HOSTNAME=mydomainname.com
  1374. cp -r roundcubemail-* /var/www/$HOSTNAME/htdocs/mail
  1375. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/mail/temp
  1376. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/mail/logs
  1377. rm /var/www/$HOSTNAME/htdocs/mail/.htaccess
  1378. #+END_SRC
  1379. Edit your web site configuration.
  1380. #+BEGIN_SRC: bash
  1381. emacs /etc/apache2/sites-available/$HOSTNAME
  1382. #+END_SRC
  1383. Within the 80 VirtualHost section add the following:
  1384. #+BEGIN_SRC: bash
  1385. <Directory /var/www/mydomainname.com/htdocs/mail>
  1386. deny from all
  1387. </Directory>
  1388. #+END_SRC
  1389. Within the 443 VirtualHost section add the following:
  1390. #+BEGIN_SRC: bash
  1391. <Directory /var/www/mydomainname.com/htdocs/mail>
  1392. Options Indexes FollowSymLinks MultiViews
  1393. AllowOverride All
  1394. Order allow,deny
  1395. allow from all
  1396. </Directory>
  1397. #+END_SRC
  1398. Save and exit, then restart Apache.
  1399. #+BEGIN_SRC: bash
  1400. service apache2 restart
  1401. #+END_SRC
  1402. Now with a browser visit https://mydomainname.com/mail/installer. Scroll down and click "next". Give your webmail site a product name.
  1403. The *spellcheck_engine* option being limited to Google is slightly concerning in terms of privacy and security, but seems not to be implemented.
  1404. Change the *database password* to the password you gave when creating the MySql database above.
  1405. Set *smtp_port* to 465.
  1406. Click *create config*
  1407. Click download to download the file.
  1408. In a terminal on your local machine (not logged into the BBB):
  1409. #+BEGIN_SRC: bash
  1410. cd ~/Downloads
  1411. scp config.inc.php myusername@mydomainname.com:/home/myusername
  1412. #+END_SRC
  1413. Then in a terminal ssh'd into the BBB:
  1414. #+BEGIN_SRC: bash
  1415. mv /home/myusername/config.inc.php /var/www/$HOSTNAME/htdocs/mail/config
  1416. chmod 755 /var/www/$HOSTNAME/htdocs/mail/config/config.inc.php
  1417. #+END_SRC
  1418. Click *continue*.
  1419. Click *initialize database*.
  1420. Under *Test SMTP config* you can use a [[mailinator.com]] address to check that mail can be sent.
  1421. Now we can delete the installer.
  1422. #+BEGIN_SRC: bash
  1423. rm -rf /var/www/$HOSTNAME/htdocs/mail/installer
  1424. #+END_SRC
  1425. Now with a browser navigate to https://mydomainname.com/mail and log in.
  1426. You'll notice that you may not be able to see any mailing list folders which you may have created earlier using the /mailinglistrule/ script. To make folders visible click on the cog-like settings icon at the bottom left of the screen then select *manage folders*. You will then be able to select which folders you wish to become visible. Make sure that the *Sent*, *spam* and *ham* folders are selected.
  1427. Click on the *Mail* icon to go back to your main mail screen then click on the *Settings* icon at the top right of the screen and select *special folders*. Set *Junk* to *spam* then click the save button. Also select *identities* and make sure that your email address is correct.
  1428. *** Thunderbird
  1429. #+BEGIN_VERSE
  1430. /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./
  1431. -- Brian Spector, on the shutting down of the PrivateSky encrypted email service
  1432. #+END_VERSE
  1433. 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.
  1434. The following instructions should be carried out on the client machines (laptop, etc), not on the BBB itself.
  1435. **** Initial setup
  1436. Install *Thunderbird* and *Enigmail*. How you do this just depends upon your distro and software manager or "app store".
  1437. Open Thinderbird
  1438. Select "*Skip this and use existing email*"
  1439. Enter your name, email address (myusername@mydomainname.com) and the password for your user (the one from [[Add a user]]).
  1440. You'll get a message saying "/Thunderbird failed to find the settings/"
  1441. The settings should be as follows, substituting /mydomainname.com/ for your domain name and /myusername/ for the username given previously in [[Add a user]].
  1442. * Incoming: IMAP, mydomainname.com, 993, SSL/TLS, Normal Password
  1443. * Outgoing: SMTP, mydomainname.com, 465, SSL/TLS, Normal Password
  1444. * Username: myusername
  1445. Click *Done*.
  1446. Click *Get Certificate* and make sure "*permanently store this exception*" is selected", then click *Store Security Exception*.
  1447. 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.
  1448. Select "*Yes, I want to sign all of my email*"
  1449. Select "*No, I will create per-recipient rules*"
  1450. Select "*yes*" to change default settings.
  1451. **** If you have existing GPG key
  1452. Export your GPG public and private keys.
  1453. #+BEGIN_SRC: bash
  1454. gpg --output ~/public_key.txt --armor --export KEY_ID
  1455. gpg --output ~/private_key.txt --armor --export-secret-key KEY_ID
  1456. #+END_SRC
  1457. Select "*I have existing public and private keys*".
  1458. Select your public and private GPG exported key files.
  1459. Select the account which you want to use and click *Next*, *Next* and *Finish*.
  1460. Remove your exported key files.
  1461. #+BEGIN_SRC: bash
  1462. shred -zu ~/public_key.txt
  1463. shred -zu ~/private_key.txt
  1464. #+END_SRC
  1465. **** If you don't have any existing GPG or PGP key
  1466. Select "*I want to create a new key pair*"
  1467. Enter a passphrase and click *Next* a couple of times.
  1468. Click *Generate Certificate* to generate a revocation certificate.
  1469. Enter the passphrase which you gave previously.
  1470. Click *Finish*
  1471. 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.
  1472. 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.
  1473. **** Using for the first time
  1474. Click on the Thunderbird menu, which looks like three horizontal bars on the right hand side.
  1475. Hover over *preferences* and then *Account settings*.
  1476. Select *Synchronization & Storage*.
  1477. Make sure that *Keep messages for this account on this computer* is unticked, then click *Ok*.
  1478. Click on *Inbox*. Depending upon how much email you have it may take a while to import the subject lines.
  1479. Note that when sending an email for the first time you will also need to accept the SSL certificate.
  1480. 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.
  1481. **** Making folders visible
  1482. 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:
  1483. *Menu*, hover over *Preferences*, select *Account Settings*, select *Server Settings* then click on the *Advanced* button.
  1484. Make sure that "*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.
  1485. ** Install a Blog
  1486. #+BEGIN_VERSE
  1487. /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./
  1488. -- Nick Cohen
  1489. #+END_VERSE
  1490. 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.
  1491. 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.
  1492. Download flatpress.
  1493. #+BEGIN_SRC: bash
  1494. cd /tmp
  1495. wget http://freedombone.uk.to/flatpress.tar.gz
  1496. #+END_SRC
  1497. Verify the download:
  1498. #+BEGIN_SRC: bash
  1499. sha256sum flatpress.tar.gz
  1500. 6312a49aab5aabd6371518dcaf081f489dff04d001bc34b4fe3f2a81170bbd4e flatpress.tar.gz
  1501. #+END_SRC
  1502. Extract and install it.
  1503. #+BEGIN_SRC: bash
  1504. tar -xzvf flatpress.tar.gz
  1505. cd flatpress-*
  1506. cp -r * /var/www/$HOSTNAME/htdocs
  1507. rm -rf flatpress-*
  1508. rm -f flatpress.tar.gz
  1509. #+END_SRC
  1510. 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
  1511. ** Install an IRC server
  1512. #+BEGIN_VERSE
  1513. /Give me the liberty to know, to utter, and to argue freely according to conscience, above all liberties./
  1514. -- John Milton
  1515. #+END_VERSE
  1516. *** Base install
  1517. 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.
  1518. First install some dependencies.
  1519. #+BEGIN_SRC: bash
  1520. apt-get update
  1521. apt-get install build-essential openssl libssl-dev
  1522. #+END_SRC
  1523. Then get the source code for ircd-hybrid.
  1524. #+BEGIN_SRC: bash
  1525. cd /tmp
  1526. mkdir hybrid
  1527. cd hybrid
  1528. apt-get source ircd-hybrid
  1529. #+END_SRC
  1530. Modify the source code to include SSL security.
  1531. #+BEGIN_SRC: bash
  1532. emacs ircd-hybrid-*/debian/rules
  1533. #+END_SRC
  1534. Beneath MAXCLIENTS add the line:
  1535. #+BEGIN_SRC: bash
  1536. USE_OPENSSL = 1
  1537. #+END_SRC
  1538. Then save and exit. Now we can build the debian package for ircd-hybrid and install it.
  1539. #+BEGIN_SRC: bash
  1540. cd ircd-hybrid-*
  1541. dpkg-buildpackage -rfakeroot -uc -b
  1542. cd ..
  1543. dpkg -i ircd-hybrid_*.deb
  1544. #+END_SRC
  1545. 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.
  1546. #+BEGIN_SRC: bash
  1547. emacs /etc/ircd-hybrid/ircd.conf
  1548. #+END_SRC
  1549. Set *name* to the name of your server, and set a description.
  1550. Set a *network_name* and *network_desc*. The network name should not contain any spaces.
  1551. Set max_clients to 20, or however many you expect that you'll typically need.
  1552. Within the admin section set your *name* and *email*.
  1553. Within the *listen* section set host to your fixed IP address (in the earlier
  1554. sections it was 192.168.1.60).
  1555. Within the *auth* section set user = "*@192.168.1.60" - or whatever the fixed IP address of the BBB is on your network.
  1556. 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.
  1557. Save and exit, then restart the IRC server. Open port 6670 on your internet router and forward it to the BBB.
  1558. Ensure that the configuration is only readable by the root user.
  1559. #+BEGIN_SRC: bash
  1560. chmod 600 /etc/ircd-hybrid/ircd.conf
  1561. #+END_SRC
  1562. *** Channel management
  1563. To to install channel management tools.
  1564. #+BEGIN_SRC: bash
  1565. cd /tmp
  1566. wget http://freedombone.uk.to/hybserv_1.9.4-1_armhf.deb
  1567. #+END_SRC
  1568. Verify it.
  1569. #+BEGIN_SRC: bash
  1570. sha256sum hybserv_1.9.4-1_armhf.deb
  1571. 41bf4eb6e24c87610a80bc14db1103a57484835510eea7e4ba9709c523318615 hybserv_1.9.4-1_armhf.deb
  1572. #+END_SRC
  1573. Install it.
  1574. #+BEGIN_SRC: bash
  1575. dpkg -i hybserv_1.9.4-1_armhf.deb
  1576. #+END_SRC
  1577. Make a md5 version of the password for the IRC server operator.
  1578. #+BEGIN_SRC: bash
  1579. /usr/bin/mkpasswd <myoperatorpassword>
  1580. #+END_SRC
  1581. Edit the ircd-hybrid configuration.
  1582. #+BEGIN_SRC: bash
  1583. emacs /etc/ircd-hybrid/ircd.conf
  1584. #+END_SRC
  1585. Enter the md5 password which you previously created within the /operator/ section. Also change /user/ to:
  1586. #+BEGIN_SRC: bash
  1587. user = "*@*";
  1588. #+END_SRC
  1589. Then save and exit.
  1590. #+BEGIN_SRC: bash
  1591. emacs /etc/hybserv/hybserv.conf
  1592. #+END_SRC
  1593. 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/.
  1594. #+BEGIN_SRC: bash
  1595. A:mynickname <myemailaddress>
  1596. N:irc.mydomainname.com:Hybrid services
  1597. O:*@*:#MD5 PASSWORD HERE#:root:segj (comment out other Q: lines)
  1598. S:mysendacceptpassword:192.168.1.60:6670 (remove the other two services)
  1599. #+END_SRC
  1600. Also remove the line *#NOT-EDITED#*, then save and exit.
  1601. Now we need to restart the ircd and hybrid server to make things work:
  1602. #+BEGIN_SRC: bash
  1603. service ircd-hybrid restart
  1604. service hybserv start
  1605. #+END_SRC
  1606. *** Usage with Irssi
  1607. On another computer (not the BBB).
  1608. #+BEGIN_SRC: bash
  1609. sudo apt-get install irssi
  1610. irssi
  1611. #+END_SRC
  1612. Connect to the IRC and identify yourself as an operator. Here /mynetwork/ should be the same as *network_name* specified earlier within /ircd.conf/. The network name is something equivalent to "freenode".
  1613. #+BEGIN_SRC: bash
  1614. /network add -nick mynick mynetwork
  1615. /channel add -auto #mychannel mynetwork channelpassword
  1616. /server add -auto -network mynetwork -ssl mydonainname.com 6670 mysendacceptpassword
  1617. /connect mydomainname.com
  1618. /join #mychannel
  1619. /msg -servername chanserv REGISTER #mychannel channelpassword
  1620. /msg -servername chanserv set #mychannel mlock +k channelpassword
  1621. #+END_SRC
  1622. If you edit the irssi config file:
  1623. #+BEGIN_SRC: bash
  1624. emacs ~/.irssi/config
  1625. #+END_SRC
  1626. It should look something like this:
  1627. #+BEGIN_SRC: bash
  1628. {
  1629. address = "mydomainname.com";
  1630. chatnet = "mynetwork";
  1631. port = "6670";
  1632. password = "mysendacceptpassword";
  1633. use_ssl = "yes";
  1634. ssl_verify = "no";
  1635. autoconnect = "yes";
  1636. },
  1637. #+END_SRC
  1638. If you're not using a self-signed certificate (self-signed is the default) then you can set *ssl_verify* to "yes".
  1639. By default Irssi does not look especially attractive. To improve it's looks:
  1640. #+BEGIN_SRC: bash
  1641. cd ~/.irssi
  1642. wget http://freedombone.uk.to/irssi/xchat.theme
  1643. mkdir ~/.irssi/scripts
  1644. mkdir ~/.irssi/scripts/autorun
  1645. cd ~/.irssi/scripts/autorun
  1646. wget http://freedombone.uk.to/irssi/xchatnickcolor.pl
  1647. wget http://freedombone.uk.to/irssi/adv_windowlist.pl
  1648. #+END_SRC
  1649. Verify the files:
  1650. #+BEGIN_SRC: bash
  1651. sha256sum ~/.irssi/xchat.theme
  1652. 7a84130ad55aabd0b043a03b013628438e6c7f82a58e15267633bc7eb443e60b
  1653. sha256sum ~/.irssi/scripts/autorun/xchatnickcolor.pl
  1654. 8293e867a22d42ce5a28cd755237509b6f3587fd2b21d7d20af4a832081610ca
  1655. sha256sum ~/.irssi/scripts/autorun/adv_windowlist.pl
  1656. e4dd8f6d384bf4f2d0ab5ccf06df06e4a69d2647b08d37c8fc6cfd9326688395
  1657. #+END_SRC
  1658. Then run Irssi and enter the commands:
  1659. #+BEGIN_SRC: bash
  1660. /set theme xchat
  1661. /statusbar window remove act
  1662. /set awl
  1663. /set awl_block -14
  1664. /set awl_display_key $Q%K|$N%n $H$C$S
  1665. /set awl_display_key_active $Q%K|$N%n $H%U$C%n$S
  1666. /set awl_display_nokey [$N]$H$C$S
  1667. /run autorun/adv_windowlist.pl
  1668. /set awl_viewer off
  1669. /save
  1670. #+END_SRC
  1671. *** Usage with XChat
  1672. Within the network list click, *Add* and enter your domain name then click *Edit*.
  1673. Select the entry within the servers box, then enter *mydomainname.com/6670* and press *Enter*.
  1674. Uncheck *use global user information*.
  1675. Enter first and second nicknames and check *auto connect to this network on startup*.
  1676. Check *use SSL* and *accept invalid SSL certificate*.
  1677. Enter some favourite channels and within *server password* enter /mysendacceptpassword/ which you defined earlier when setting up the server.
  1678. Click *close* and then *connect*.
  1679. *** Install Irssi as a daemon
  1680. It may be useful to run a persistent Irssi session on the BBB. This will enable you to log in and see any entries which occurred previously so that you don't find yourself in an argument without knowledge of what was said in the last few minutes or hours. This feature only works for a single user on the BBB - typically the administrator.
  1681. First install some prerequisites.
  1682. #+BEGIN_SRC: bash
  1683. apt-get install irssi screen
  1684. #+END_SRC
  1685. Create an initialisation script.
  1686. #+BEGIN_SRC: bash
  1687. emacs /etc/init.d/irssid
  1688. #+END_SRC
  1689. Add the following:
  1690. #+BEGIN_SRC: bash
  1691. #!/bin/bash
  1692. ### BEGIN INIT INFO
  1693. # Provides: irssid
  1694. # Required-Start: $network
  1695. # Required-Stop: $network
  1696. # Default-Start: 2 3 4 5
  1697. # Default-Stop: 0 1 6
  1698. # Short-Description: Start irssi daemon within screen session at boot time
  1699. # Description: This init script will start an irssi session under screen using the settings provided in /etc/irssid.conf
  1700. ### END INIT INFO
  1701. # Include the LSB library functions
  1702. . /lib/lsb/init-functions
  1703. # Setup static variables
  1704. configFile='/etc/irssid.conf'
  1705. daemonExec='/usr/bin/screen'
  1706. daemonArgs='-D -m'
  1707. daemonName="$(basename "$daemonExec")"
  1708. pidFile='/var/run/irssid.pid'
  1709. #
  1710. # Checks if the environment is capable of running the script (such as
  1711. # availability of programs etc).
  1712. #
  1713. # Return: 0 if the environmnt is properly setup for execution of init script, 1
  1714. # if not all conditions have been met.
  1715. #
  1716. function checkEnvironment() {
  1717. # Verify that the necessary binaries are available for execution.
  1718. local binaries=(irssi screen)
  1719. for bin in "${binaries[@]}"; do
  1720. if ! which "$bin" > /dev/null; then
  1721. log_failure_msg "Binary '$bin' is not available. Please install \
  1722. package containing it."
  1723. exit 5
  1724. fi
  1725. done
  1726. }
  1727. #
  1728. # Checks if the configuration files are available and properly setup.
  1729. #
  1730. # Return: 0 if irssid if properly configured, 1 otherwise.
  1731. #
  1732. function checkConfig() {
  1733. # Make sure the configuration file has been created
  1734. if ! [[ -f $configFile ]]; then
  1735. log_failure_msg "Please populate the configuration file '$configFile' \
  1736. before running."
  1737. exit 6
  1738. fi
  1739. # Make sure the required options have been set
  1740. local reqOptions=(user group session)
  1741. for option in "${reqOptions[@]}"; do
  1742. if ! grep -q -e "^[[:blank:]]*$option=" "$configFile"; then
  1743. log_failure_msg "Mandatory option '$option' was not specified in \
  1744. '$configFile'"
  1745. exit 6
  1746. fi
  1747. done
  1748. }
  1749. #
  1750. # Loads the configuration file and performs any additional configuration steps.
  1751. #
  1752. function configure() {
  1753. . "$configFile"
  1754. daemonArgs="$daemonArgs -S $session irssi"
  1755. [[ -n $args ]] && daemonArgs="$daemonArgs $args"
  1756. daemonCommand="$daemonExec $daemonArgs"
  1757. }
  1758. #
  1759. # Starts the daemon.
  1760. #
  1761. # Return: LSB-compliant code.
  1762. #
  1763. function start() {
  1764. start-stop-daemon --start --quiet --oknodo --pidfile "$pidFile" \
  1765. --make-pidfile --chuid "$user:$group" --background \
  1766. --exec "$daemonExec" -- $daemonArgs
  1767. }
  1768. #
  1769. # Stops the daemon.
  1770. #
  1771. # Return: LSB-compliant code.
  1772. #
  1773. function stop() {
  1774. start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile "$pidFile" \
  1775. --chuid "$user:$group" --exec "$daemonExec" -- $daemonArgs
  1776. }
  1777. checkEnvironment
  1778. checkConfig
  1779. configure
  1780. case "$1" in
  1781. start)
  1782. log_daemon_msg "Starting daemon" "irssid"
  1783. start && log_end_msg 0 || log_end_msg $?
  1784. ;;
  1785. stop)
  1786. log_daemon_msg "Stopping daemon" "irssid"
  1787. stop && log_end_msg 0 || log_end_msg $?
  1788. ;;
  1789. restart)
  1790. log_daemon_msg "Restarting daemon" "irssid"
  1791. stop
  1792. start && log_end_msg 0 || log_end_msg $?
  1793. ;;
  1794. force-reload)
  1795. log_daemon_msg "Restarting daemon" "irssid"
  1796. stop
  1797. start && log_end_msg 0 || log_end_msg $?
  1798. ;;
  1799. status)
  1800. status_of_proc -p "$pidFile" "$daemonExec" screen && exit 0 || exit $?
  1801. ;;
  1802. *)
  1803. echo "irssid (start|stop|restart|force-reload|status|help)"
  1804. ;;
  1805. esac
  1806. #+END_SRC
  1807. Save and exit.
  1808. #+BEGIN_SRC: bash
  1809. chmod +x /etc/init.d/irssid
  1810. #+END_SRC
  1811. Create a configuration file, replacing /myusername/ with your username.
  1812. #+BEGIN_SRC: bash
  1813. emacs /etc/irssid.conf
  1814. #+END_SRC
  1815. #+BEGIN_SRC: bash
  1816. #
  1817. # Configuration file for irssid init script
  1818. #
  1819. # Mandatory options:
  1820. #
  1821. # user - Specify user for running irssi.
  1822. # group - Specify group for running irssi.
  1823. # session - Specify screen session name to be used for irssi.
  1824. #
  1825. # Non-mandatory options:
  1826. #
  1827. # args - Pass additional arguments to irssi.
  1828. #
  1829. user='myusername'
  1830. group='irssi'
  1831. session='irssi'
  1832. args='--config /home/myusername/.irssi/config'
  1833. #+END_SRC
  1834. Save and exit. Then add your user to the irssi group and start the daemon.
  1835. #+BEGIN_SRC: bash
  1836. groupadd irssi
  1837. usermod -aG irssi myusername
  1838. update-rc.d irssid defaults
  1839. service irssid start
  1840. #+END_SRC
  1841. Create a script to make running IRC on the server easier.
  1842. #+BEGIN_SRC: bash
  1843. emacs /usr/bin/irc
  1844. #+END_SRC
  1845. Add the following:
  1846. #+BEGIN_SRC: bash
  1847. #!/bin/bash
  1848. screen -r irssi
  1849. #+END_SRC
  1850. Save and exit.
  1851. #+BEGIN_SRC: bash
  1852. chmod +x /usr/bin/irc
  1853. chown myusername:myusername /usr/bin/irc
  1854. #+END_SRC
  1855. Then to subsequently access irssi log into the BBB using ssh and type:
  1856. #+BEGIN_SRC: bash
  1857. irc
  1858. #+END_SRC
  1859. ** Install a Jabber/XMPP server
  1860. #+BEGIN_VERSE
  1861. /Well heck, it isn’t that hard to write an instant messaging system./
  1862. --Jeremie Miller
  1863. #+END_VERSE
  1864. *** The Server
  1865. Generate a SSL certificate.
  1866. #+BEGIN_SRC: bash
  1867. openssl ecparam -out /etc/ssl/private/xmpp.pem -name prime256v1
  1868. openssl genpkey -paramfile /etc/ssl/private/xmpp.pem -out /etc/ssl/private/xmpp.key
  1869. openssl req -new -x509 -key /etc/ssl/private/xmpp.key -out /etc/ssl/certs/xmpp.crt -days 3650
  1870. #+END_SRC
  1871. 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:
  1872. #+BEGIN_SRC: bash
  1873. openssl genrsa -out /etc/ssl/private/xmpp.key 4096
  1874. openssl req -new -x509 -key /etc/ssl/private/xmpp.key -out /etc/ssl/certs/xmpp.crt -days 3650
  1875. #+END_SRC
  1876. Change permissions.
  1877. #+BEGIN_SRC: bash
  1878. chmod 600 /etc/ssl/private/xmpp.key
  1879. chmod 600 /etc/ssl/certs/xmpp.crt
  1880. chown prosody:prosody /etc/ssl/private/xmpp.key
  1881. chown prosody:prosody /etc/ssl/certs/xmpp.crt
  1882. #+END_SRC
  1883. Install Prosody.
  1884. #+BEGIN_SRC: bash
  1885. apt-get install prosody
  1886. cp -a /etc/prosody/conf.avail/example.com.cfg.lua /etc/prosody/conf.avail/xmpp.cfg.lua
  1887. emacs /etc/prosody/conf.avail/xmpp.cfg.lua
  1888. #+END_SRC
  1889. Change the *VirtualHost* name to your domain name and remove the line below it.
  1890. Set the ssl section to:
  1891. #+BEGIN_SRC: bash
  1892. ssl = {
  1893. key = "/etc/ssl/private/xmpp.key";
  1894. certificate = "/etc/ssl/certs/xmpp.crt";
  1895. }
  1896. #+END_SRC
  1897. And also append the following:
  1898. #+BEGIN_SRC: bash
  1899. modules_enabled = {
  1900. "bosh"; -- Enable mod_bosh
  1901. "tls"; -- Enable mod_tls
  1902. }
  1903. c2s_require_encryption = true
  1904. s2s_require_encryption = true
  1905. #+END_SRC
  1906. Save and exit. Create a symbolic link.
  1907. #+BEGIN_SRC: bash
  1908. ln -sf /etc/prosody/conf.avail/xmpp.cfg.lua /etc/prosody/conf.d/xmpp.cfg.lua
  1909. #+END_SRC
  1910. 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).
  1911. #+BEGIN_SRC: bash
  1912. prosodyctl adduser myusername@mydomainname.com
  1913. #+END_SRC
  1914. Restart the server
  1915. #+BEGIN_SRC: bash
  1916. service prosody restart
  1917. #+END_SRC
  1918. On your internet router/firewall open ports 5222, 5223, 5269, 5280 and 5281 and forward them to the BBB.
  1919. 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.
  1920. *** Managing users
  1921. To add a user:
  1922. #+BEGIN_SRC: bash
  1923. prosodyctl adduser myusername@mydomainname.com
  1924. #+END_SRC
  1925. To change a user password:
  1926. #+BEGIN_SRC: bash
  1927. prosodyctl passwd myusername@mydomainname.com
  1928. #+END_SRC
  1929. To remove a user:
  1930. #+BEGIN_SRC: bash
  1931. prosodyctl deluser myusername@mydomainname.com
  1932. #+END_SRC
  1933. Report the status of the XMPP server:
  1934. #+BEGIN_SRC: bash
  1935. prosodyctl status
  1936. #+END_SRC
  1937. *** Using with Jitsi
  1938. 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.
  1939. Jitsi can be downloaded from https://jitsi.org/
  1940. On your desktop/laptop open Jitsi and select *Options* from the *Tools* menu.
  1941. 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).
  1942. 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.
  1943. 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.
  1944. You can also [[https://www.youtube.com/watch?v=vgx7VSrDGjk][see this video]] as an example of using OTR.
  1945. *** Using with Ubuntu
  1946. 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.
  1947. Open *System Settings* and select *Online Accounts*, *Add account* and then *Jabber*.
  1948. Enter your username (myusername@mydomainname.com) and password.
  1949. 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*.
  1950. *** Using with Android
  1951. There are a few XMPP clients available on Android. Ideally choose ones which support off-the-record messaging. Here are some examples.
  1952. **** Xabber
  1953. Install [[https://f-droid.org/][F-Droid]]
  1954. Search for and install Xabber.
  1955. Add an account and enter your Jabber/XMPP ID and password.
  1956. From the menu select *Settings* then *Security* then *OTR mode*. Set the mode to *Required*.
  1957. Make sure that *Check server certificate* is not checked.
  1958. 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.
  1959. **** Gibberbot
  1960. Install [[https://f-droid.org/][F-Droid]]
  1961. Search for and install Gibberbot, otherwise known as ChatSecure.
  1962. From the menu open *Accounts*
  1963. Select *Add account*
  1964. Change the server port from 0 to 5222
  1965. Done
  1966. Accept unknown certificate? Select *Always*
  1967. Go back to the initial screen and then using the menu you can add contacts and begin chatting.
  1968. ** Social Networking
  1969. #+BEGIN_VERSE
  1970. /Facebook is not your friend, it is a surveillance engine./
  1971. -- Richard Stallman, Free Software Foundation
  1972. #+END_VERSE
  1973. *** Friendica
  1974. **** Installation
  1975. 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.
  1976. 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:
  1977. #+BEGIN_SRC: bash
  1978. emacs /etc/apache2/sites-available/mydomainname.com
  1979. #+END_SRC
  1980. Within the section which begins with *<VirtualHost *:80>* change the following:
  1981. #+BEGIN_SRC: bash
  1982. <Directory /var/www/mydomainname.com/htdocs/>
  1983. deny from all
  1984. </Directory>
  1985. #+END_SRC
  1986. Save and exit, then restart the apache server.
  1987. #+BEGIN_SRC: bash
  1988. service apache2 restart
  1989. #+END_SRC
  1990. Now install some dependencies.
  1991. #+BEGIN_SRC: bash
  1992. apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt
  1993. #+END_SRC
  1994. Enter an admin password for MySQL.
  1995. Create a mysql database.
  1996. #+BEGIN_SRC: bash
  1997. mysql -u root -p
  1998. create database friendica;
  1999. CREATE USER 'friendicaadmin'@'localhost' IDENTIFIED BY 'password';
  2000. GRANT ALL PRIVILEGES ON friendica.* TO 'friendicaadmin'@'localhost';
  2001. quit
  2002. #+END_SRC
  2003. You may need to fix Git SSL problems.
  2004. #+BEGIN_SRC: bash
  2005. git config --global http.sslVerify true
  2006. apt-get install ca-certificates
  2007. cd ~/
  2008. emacs .gitconfig
  2009. #+END_SRC
  2010. The .gitconfig file should look something like this:
  2011. #+BEGIN_SRC: bash
  2012. [http]
  2013. sslVerify = true
  2014. sslCAinfo = /etc/ssl/certs/ca-certificates.crt
  2015. [user]
  2016. email = myusername@mydomainname.com
  2017. name = yourname
  2018. #+END_SRC
  2019. Get the source code.
  2020. #+BEGIN_SRC: bash
  2021. export HOSTNAME=mydomainname.com
  2022. cd /var/www/$HOSTNAME
  2023. mv htdocs htdocs_old
  2024. git clone https://github.com/friendica/friendica.git htdocs
  2025. chmod -R 755 htdocs
  2026. chown -R www-data:www-data htdocs
  2027. chown -R www-data:www-data htdocs/view/smarty3
  2028. git clone https://github.com/friendica/friendica-addons.git htdocs/addon
  2029. #+END_SRC
  2030. 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.
  2031. Install the poller.
  2032. #+BEGIN_SRC: bash
  2033. emacs /etc/crontab
  2034. #+END_SRC
  2035. and append the following, changing mydomainname.com to whatever your domain is.
  2036. #+BEGIN_SRC: bash
  2037. */10 * * * * root cd /var/www/mydomainname.com/htdocs; /usr/bin/timeout 120 /usr/bin/php include/poller.php
  2038. #+END_SRC
  2039. Save and exit, then restart cron.
  2040. #+BEGIN_SRC: bash
  2041. service cron restart
  2042. #+END_SRC
  2043. You can improve the speed of Friendica database searches by adding the following indexes:
  2044. #+BEGIN_SRC: bash
  2045. mysql -u root -p
  2046. use friendica;
  2047. CREATE INDEX `uri_received` ON item(`uri`, `received`);
  2048. CREATE INDEX `received_uri` ON item(`received`, `uri`);
  2049. CREATE INDEX `contact-id_created` ON item(`contact-id`, created);
  2050. CREATE INDEX `uid_network_received` ON item(`uid`, `network`, `received`);
  2051. CREATE INDEX `uid_parent` ON item(`uid`, `parent`);
  2052. CREATE INDEX `uid_received` ON item(`uid`, `received`);
  2053. CREATE INDEX `uid_network_commented` ON item(`uid`, `network`, `commented`);
  2054. CREATE INDEX `uid_title` ON item(uid, `title`);
  2055. CREATE INDEX `created_contact-id` ON item(`created`, `contact-id`);
  2056. quit
  2057. #+END_SRC
  2058. Make sure that Friendica doesn't use too much memory.
  2059. #+BEGIN_SRC: bash
  2060. emacs /var/www/$HOSTNAME/htdocs/.htaccess
  2061. #+END_SRC
  2062. Append the following:
  2063. #+BEGIN_SRC: bash
  2064. php_value memory_limit 32M
  2065. #+END_SRC
  2066. The save ane exit.
  2067. **** Backups
  2068. 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.
  2069. #+BEGIN_SRC: bash
  2070. emacs /etc/cron.daily/friendicabackup
  2071. #+END_SRC
  2072. Enter the following
  2073. #+BEGIN_SRC: bash
  2074. #!/bin/sh
  2075. MYSQL_PASSWORD=<mysql root password>
  2076. umask 0077
  2077. # Backup the database
  2078. mysqldump --password=$MYSQL_PASSWORD friendica > /var/backups/friendica_daily.sql
  2079. # Make the backup readable only by root
  2080. chmod 600 /var/backups/friendica_daily.sql
  2081. #+END_SRC
  2082. Save and exit.
  2083. #+BEGIN_SRC: bash
  2084. chmod 600 /etc/cron.daily/friendicabackup
  2085. chmod +x /etc/cron.daily/friendicabackup
  2086. emacs /etc/cron.weekly/friendicabackup
  2087. #+END_SRC
  2088. Enter the following
  2089. #+BEGIN_SRC: bash
  2090. #!/bin/sh
  2091. MYSQL_PASSWORD=<mysql root password>
  2092. umask 0077
  2093. # Backup the database
  2094. mysqldump --password=$MYSQL_PASSWORD friendica > /var/backups/friendica_weekly.sql
  2095. # Make the backup readable only by root
  2096. chmod 600 /var/backups/friendica_weekly.sql
  2097. #+END_SRC
  2098. Save and exit.
  2099. #+BEGIN_SRC: bash
  2100. chmod 600 /etc/cron.weekly/friendicabackup
  2101. chmod +x /etc/cron.weekly/friendicabackup
  2102. #+END_SRC
  2103. **** Recommended configuration
  2104. ***** Admin
  2105. 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.
  2106. 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.
  2107. Under the *themes* section select a few themes, including mobile themes which are suitable for phones or tablets.
  2108. 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.
  2109. 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]].
  2110. ***** Settings
  2111. Each user has their own customisable settings, typically available either via an icon or by an entry on a drop down menu.
  2112. Under *additional features* enable "/richtext editor/", "/post preview/", "/group filter/", "/network filter/", "/edit sent posts/" and "/dislike posts/".
  2113. Under *display settings* select your desktop and mobile themes.
  2114. 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.
  2115. **** To access from an Android device
  2116. ***** App
  2117. 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.
  2118. 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.
  2119. More information about the Friendica app can be found on http://friendica-for-android.wiki-lab.net/
  2120. ***** Mobile Theme
  2121. 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.
  2122. *** Movim
  2123. #+BEGIN_VERSE
  2124. /The way we communicate with others and with ourselves ultimately determines the quality of our lives/
  2125. -- Anthony Robbins
  2126. #+END_VERSE
  2127. Movim is another social networking system based around the XMPP protocol.
  2128. You will need to have previously [[Install a Jabber/XMPP server][installed the Jabber/XMPP server]].
  2129. 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:
  2130. #+BEGIN_SRC: bash
  2131. emacs /etc/apache2/sites-available/mydomainname.com
  2132. #+END_SRC
  2133. Within the section which begins with *<VirtualHost *:80>* add the following:
  2134. #+BEGIN_SRC: bash
  2135. <Directory /var/www/mydomainname.com/htdocs/movim>
  2136. deny from all
  2137. </Directory>
  2138. #+END_SRC
  2139. Within the section which begins with *<VirtualHost *:443>* add the following:
  2140. #+BEGIN_SRC: bash
  2141. <Directory /var/www/mydomainname.com/htdocs/movim>
  2142. Options Indexes FollowSymLinks MultiViews
  2143. AllowOverride All
  2144. Order allow,deny
  2145. allow from all
  2146. </Directory>
  2147. #+END_SRC
  2148. Save and exit, then restart the apache server.
  2149. #+BEGIN_SRC: bash
  2150. service apache2 restart
  2151. #+END_SRC
  2152. Download the source.
  2153. #+BEGIN_SRC: bash
  2154. cd /tmp
  2155. wget http://freedombone.uk.to/movim.tar.gz
  2156. #+END_SRC
  2157. Verify it.
  2158. #+BEGIN_SRC: bash
  2159. sha256sum movim.tar.gz
  2160. 2740ddbedf6cefcc2934759374376643b6cdea4fb7f944ec25098a6868cb499e movim.tar.gz
  2161. #+END_SRC
  2162. Install it.
  2163. #+BEGIN_SRC: bash
  2164. tar -xzvf movim.tar.gz
  2165. export HOSTNAME=mydomainname.com
  2166. cp -r movim-* /var/www/$HOSTNAME/htdocs/movim
  2167. chmod 755 /var/www/$HOSTNAME/htdocs/movim
  2168. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/movim
  2169. #+END_SRC
  2170. Install some MySql prerequisites.
  2171. #+BEGIN_SRC: bash
  2172. apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt
  2173. #+END_SRC
  2174. If necessary, enter an admin password for MySQL.
  2175. Create a mysql database.
  2176. #+BEGIN_SRC: bash
  2177. mysql -u root -p
  2178. create database movim;
  2179. CREATE USER 'movimadmin'@'localhost' IDENTIFIED BY 'movimadminpassword';
  2180. GRANT ALL PRIVILEGES ON movim.* TO 'movimadmin'@'localhost';
  2181. quit
  2182. #+END_SRC
  2183. With a web browser navigate to:
  2184. https://mydomainname.com/movim/admin
  2185. Enter /admin/ as the username and /password/ as the password.
  2186. 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).
  2187. Change the /Environment/ from /Development/ to /Production/.
  2188. 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?)
  2189. Click /Submit/ followed by /Resend/.
  2190. Click on /Database Settings/ and alter the MySql movim database username to /movimadmin/ and password to the password you specified in the previous step.
  2191. 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".
  2192. 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).
  2193. *** Red Matrix
  2194. **** Introduction
  2195. 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.
  2196. **** Prerequisites
  2197. 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.
  2198. 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.
  2199. **** Installation
  2200. 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.
  2201. 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:
  2202. #+BEGIN_SRC: bash
  2203. emacs /etc/apache2/sites-available/mydomainname.com
  2204. #+END_SRC
  2205. Within the section which begins with *<VirtualHost *:80>* change the following:
  2206. #+BEGIN_SRC: bash
  2207. <Directory /var/www/mydomainname.com/htdocs/>
  2208. deny from all
  2209. </Directory>
  2210. #+END_SRC
  2211. Save and exit, then restart the apache server.
  2212. #+BEGIN_SRC: bash
  2213. service apache2 restart
  2214. #+END_SRC
  2215. Now install some dependencies.
  2216. #+BEGIN_SRC: bash
  2217. apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt
  2218. #+END_SRC
  2219. Enter an admin password for MySQL.
  2220. Create a mysql database.
  2221. #+BEGIN_SRC: bash
  2222. mysql -u root -p
  2223. create database redmatrix;
  2224. CREATE USER 'redmatrixadmin'@'localhost' IDENTIFIED BY 'password';
  2225. GRANT ALL PRIVILEGES ON redmatrix.* TO 'redmatrixadmin'@'localhost';
  2226. quit
  2227. #+END_SRC
  2228. You may need to fix Git SSL problems.
  2229. #+BEGIN_SRC: bash
  2230. git config --global http.sslVerify true
  2231. apt-get install ca-certificates
  2232. cd ~/
  2233. emacs .gitconfig
  2234. #+END_SRC
  2235. The .gitconfig file should look something like this:
  2236. #+BEGIN_SRC: bash
  2237. [http]
  2238. sslVerify = true
  2239. sslCAinfo = /etc/ssl/certs/ca-certificates.crt
  2240. [user]
  2241. email = myusername@mydomainname.com
  2242. name = yourname
  2243. #+END_SRC
  2244. Get the source code.
  2245. #+BEGIN_SRC: bash
  2246. export HOSTNAME=mydomainname.com
  2247. cd /var/www/$HOSTNAME
  2248. mv htdocs htdocs_old
  2249. git clone https://github.com/friendica/red.git htdocs
  2250. chmod -R 755 htdocs
  2251. chown -R www-data:www-data htdocs
  2252. mkdir htdocs/view/tpl/smarty3
  2253. chmod 777 htdocs/view/tpl
  2254. chmod 777 htdocs/view/tpl/smarty3
  2255. git clone https://github.com/friendica/red-addons.git htdocs/addon
  2256. #+END_SRC
  2257. 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.
  2258. Install the poller.
  2259. #+BEGIN_SRC
  2260. emacs /etc/crontab
  2261. #+END_SRC
  2262. and append the following, changing mydomainname.com to whatever your domain is.
  2263. #+BEGIN_SRC
  2264. */10 * * * * root cd /var/www/mydomainname.com/htdocs; /usr/bin/php include/poller.php
  2265. #+END_SRC
  2266. Save and exit, then restart cron.
  2267. #+BEGIN_SRC: bash
  2268. service cron restart
  2269. #+END_SRC
  2270. **** Backups
  2271. 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.
  2272. #+BEGIN_SRC: bash
  2273. emacs /etc/cron.daily/redmatrixbackup
  2274. #+END_SRC
  2275. Enter the following
  2276. #+BEGIN_SRC: bash
  2277. #!/bin/sh
  2278. MYSQL_PASSWORD=<mysql root password>
  2279. umask 0077
  2280. # Backup the database
  2281. mysqldump --password=$MYSQL_PASSWORD redmatrix > /var/backups/redmatrix_daily.sql
  2282. # Make the backup readable only by root
  2283. chmod 600 /var/backups/redmatrix_daily.sql
  2284. #+END_SRC
  2285. Save and exit.
  2286. #+BEGIN_SRC: bash
  2287. chmod 600 /etc/cron.daily/redmatrixbackup
  2288. chmod +x /etc/cron.daily/redmatrixbackup
  2289. emacs /etc/cron.weekly/redmatrixbackup
  2290. #+END_SRC
  2291. Enter the following
  2292. #+BEGIN_SRC: bash
  2293. #!/bin/sh
  2294. MYSQL_PASSWORD=<mysql root password>
  2295. umask 0077
  2296. # Backup the database
  2297. mysqldump --password=$MYSQL_PASSWORD redmatrix > /var/backups/redmatrix_weekly.sql
  2298. # Make the backup readable only by root
  2299. chmod 600 /var/backups/redmatrix_weekly.sql
  2300. #+END_SRC
  2301. Save and exit.
  2302. #+BEGIN_SRC: bash
  2303. chmod 600 /etc/cron.weekly/redmatrixbackup
  2304. chmod +x /etc/cron.weekly/redmatrixbackup
  2305. #+END_SRC
  2306. **** To access from an Android device
  2307. ***** App
  2308. 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.
  2309. 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.
  2310. More information about the Friendica app can be found on http://friendica-for-android.wiki-lab.net/
  2311. ** Install Gopher
  2312. *** Server setup
  2313. 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.
  2314. To set up a gopher server:
  2315. #+BEGIN_SRC: bash
  2316. apt-get install build-essential
  2317. cd /tmp
  2318. wget http://freedombone.uk.to/geomyidae-current.tgz
  2319. #+END_SRC
  2320. Verify the download:
  2321. #+BEGIN_SRC: bash
  2322. sha256sum geomyidae-current.tgz
  2323. 162f55ab059ab0a9be8e840497795293bbd51c34b1f4564dcdf3f0ddd5c0db31 geomyidae-current.tgz
  2324. #+END_SRC
  2325. Then extract and install it.
  2326. #+BEGIN_SRC: bash
  2327. tar -xzvf geomyidae-current.tgz
  2328. cd geomyidae-*
  2329. make
  2330. make install
  2331. mkdir -p /var/gopher
  2332. #+END_SRC
  2333. 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.
  2334. #+BEGIN_SRC: bash
  2335. emacs /etc/init.d/gopher
  2336. #+END_SRC
  2337. Enter the following:
  2338. #+BEGIN_SRC: bash
  2339. #! /bin/sh
  2340. ### BEGIN INIT INFO
  2341. # Provides: gopher
  2342. # Required-Start: $remote_fs $syslog
  2343. # Required-Stop: $remote_fs $syslog
  2344. # Default-Start: 2 3 4 5
  2345. # Default-Stop: 0 1 6
  2346. # Short-Description: Gopher daemon
  2347. # Description: Gopher daemon
  2348. ### END INIT INFO
  2349. # Do NOT "set -e"
  2350. # PATH should only include /usr/* if it runs after the mountnfs.sh script
  2351. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  2352. DESC="Gopher daemon"
  2353. NAME=geomyidae
  2354. DAEMON=/usr/bin/$NAME
  2355. DAEMON_ARGS="-l /var/log/geomyidae.log -b /var/gopher -p 70"
  2356. PIDFILE=/var/run/$NAME.pid
  2357. SCRIPTNAME=/etc/init.d/$NAME
  2358. # Exit if the package is not installed
  2359. [ -x "$DAEMON" ] || exit 0
  2360. # Read configuration variable file if it is present
  2361. [ -r /etc/default/$NAME ] && . /etc/default/$NAME
  2362. # Load the VERBOSE setting and other rcS variables
  2363. . /lib/init/vars.sh
  2364. # Define LSB log_* functions.
  2365. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
  2366. # and status_of_proc is working.
  2367. . /lib/lsb/init-functions
  2368. #
  2369. # Function that starts the daemon/service
  2370. #
  2371. do_start()
  2372. {
  2373. # Return
  2374. # 0 if daemon has been started
  2375. # 1 if daemon was already running
  2376. # 2 if daemon could not be started
  2377. start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
  2378. || return 1
  2379. start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
  2380. $DAEMON_ARGS \
  2381. || return 2
  2382. # Add code here, if necessary, that waits for the process to be ready
  2383. # to handle requests from services started subsequently which depend
  2384. # on this one. As a last resort, sleep for some time.
  2385. }
  2386. #
  2387. # Function that stops the daemon/service
  2388. #
  2389. do_stop()
  2390. {
  2391. # Return
  2392. # 0 if daemon has been stopped
  2393. # 1 if daemon was already stopped
  2394. # 2 if daemon could not be stopped
  2395. # other if a failure occurred
  2396. start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
  2397. RETVAL="$?"
  2398. [ "$RETVAL" = 2 ] && return 2
  2399. # Wait for children to finish too if this is a daemon that forks
  2400. # and if the daemon is only ever run from this initscript.
  2401. # If the above conditions are not satisfied then add some other code
  2402. # that waits for the process to drop all resources that could be
  2403. # needed by services started subsequently. A last resort is to
  2404. # sleep for some time.
  2405. start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
  2406. [ "$?" = 2 ] && return 2
  2407. # Many daemons don't delete their pidfiles when they exit.
  2408. rm -f $PIDFILE
  2409. return "$RETVAL"
  2410. }
  2411. #
  2412. # Function that sends a SIGHUP to the daemon/service
  2413. #
  2414. do_reload() {
  2415. #
  2416. # If the daemon can reload its configuration without
  2417. # restarting (for example, when it is sent a SIGHUP),
  2418. # then implement that here.
  2419. #
  2420. start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
  2421. return 0
  2422. }
  2423. case "$1" in
  2424. start)
  2425. [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
  2426. do_start
  2427. case "$?" in
  2428. 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
  2429. 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
  2430. esac
  2431. ;;
  2432. stop)
  2433. [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
  2434. do_stop
  2435. case "$?" in
  2436. 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
  2437. 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
  2438. esac
  2439. ;;
  2440. status)
  2441. status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
  2442. ;;
  2443. #reload|force-reload)
  2444. #
  2445. # If do_reload() is not implemented then leave this commented out
  2446. # and leave 'force-reload' as an alias for 'restart'.
  2447. #
  2448. #log_daemon_msg "Reloading $DESC" "$NAME"
  2449. #do_reload
  2450. #log_end_msg $?
  2451. #;;
  2452. restart|force-reload)
  2453. #
  2454. # If the "reload" option is implemented then remove the
  2455. # 'force-reload' alias
  2456. #
  2457. log_daemon_msg "Restarting $DESC" "$NAME"
  2458. do_stop
  2459. case "$?" in
  2460. 0|1)
  2461. do_start
  2462. case "$?" in
  2463. 0) log_end_msg 0 ;;
  2464. 1) log_end_msg 1 ;; # Old process is still running
  2465. *) log_end_msg 1 ;; # Failed to start
  2466. esac
  2467. ;;
  2468. *)
  2469. # Failed to stop
  2470. log_end_msg 1
  2471. ;;
  2472. esac
  2473. ;;
  2474. *)
  2475. #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
  2476. echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
  2477. exit 3
  2478. ;;
  2479. esac
  2480. :
  2481. #+END_SRC
  2482. Save and exit. Then start the gopher service.
  2483. #+BEGIN_SRC: bash
  2484. chmod +x /etc/init.d/gopher
  2485. update-rc.d gopher defaults
  2486. service gopher start
  2487. #+END_SRC
  2488. 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:
  2489. #+BEGIN_SRC: bash
  2490. gopher://mydomainname.com
  2491. #+END_SRC
  2492. There is a browser addon for Gopher called "overbite". Installing that should enable you to view your site.
  2493. *** A phlogging script
  2494. A phlog is the gopher equivalent of a blog on the web. You can create a script which makes phlogging easy.
  2495. #+BEGIN_SRC: bash
  2496. emacs /usr/bin/mkphlog
  2497. #+END_SRC
  2498. Add the following:
  2499. #+BEGIN_SRC: bash
  2500. #!/bin/sh
  2501. # mkphlog - a utility to ease the creation of phlogs.
  2502. # Organizes phlog posts in separate directories.
  2503. # Created by octotep; anyone can distribute, modify, and
  2504. # share this file however they please.
  2505. #
  2506. # Version 0.3
  2507. #
  2508. # Modified by Bob Mottram
  2509. #
  2510. # Please note, all date strings are in the form of mm/dd/yy(yy)
  2511. # The base of the entire gopher site.
  2512. gopherRoot="/var/gopher"
  2513. # The name of the phlog directory (contained in $gopherHome)
  2514. phlogDirName="phlog"
  2515. # Default editor, unless the user has one specified in env
  2516. editor=${EDITOR:-emacs}
  2517. # Default timezone, unless the user has one specified in env
  2518. TZ=${TZ:-UTC}
  2519. # Tells the script how many lines the title of the main page spans.
  2520. # Used to insert the newest post at the top.
  2521. # Titles created by mkphlog are 3 lines.
  2522. # Isn't used if $addTitleToMain is false
  2523. titleLineCount=3
  2524. entryDate=`date +%Y-%m-%d`
  2525. # Creates the phlog directory if it dosen't already exist.
  2526. CreatePhlogDir() {
  2527. mkdir $phlogDirName
  2528. chmod 755 $phlogDirName
  2529. cd $phlogDirName
  2530. echo "Phlog directory created."
  2531. }
  2532. # Updates the main phlog listing
  2533. UpdatePhlogListing() {
  2534. # Just in case the user didn't specify a title
  2535. if [ "$postTitleAns" = "" ] ; then
  2536. echo -n "Do you want to create a blank post? (y/n) "
  2537. read blankPostAns
  2538. case $blankPostAns in
  2539. y* | Y* ) $postTitleAns="New Post" ;;
  2540. n* | N* ) echo "Goodbye, then." ; exit 1 ;;
  2541. * ) exit 1 ;;
  2542. esac
  2543. fi
  2544. cd $gopherRoot/$phlogDirName/
  2545. title2=$(echo "${postTitleAns}" | tr " " _)
  2546. postfilename="${entryDate}_${title2}.txt"
  2547. touch ${postfilename}
  2548. echo $postTitleAns >> ${postfilename}
  2549. date "+%A %b %e %l:%M:%S %Y" >> ${postfilename}
  2550. echo "------------------------------" >> ${postfilename}
  2551. echo >> ${postfilename}
  2552. }
  2553. if [ -d $gopherRoot ] ; then
  2554. cd $gopherRoot
  2555. else
  2556. echo "You don't have a gopherspace set-up. Please run the gopher server setup instructions."
  2557. exit 1
  2558. fi
  2559. if [ -d $phlogDirName ] ; then
  2560. cd $phlogDirName
  2561. else
  2562. echo -n "Do you want to create a phlog directory? (y/n) "
  2563. read phlogDirAns
  2564. case $phlogDirAns in
  2565. y* | Y* ) CreatePhlogDir ;;
  2566. n* | N* ) exit 1 ;;
  2567. * ) exit 1 ;;
  2568. esac
  2569. fi
  2570. echo -n "Would you like to create a phlog entry for today? (y/n) "
  2571. read phlogAns
  2572. case $phlogAns in
  2573. y* | Y* ) echo "Creating today's phlog entry..." ;;
  2574. n* | N* ) exit 0 ;;
  2575. * ) exit 1 ;;
  2576. esac
  2577. # Make sure there isn't a post for that day, lest we overwrite it.
  2578. if [ ! -d $entryDate ]; then
  2579. echo -n "Title: "
  2580. read postTitleAns
  2581. title2=$(echo "${postTitleAns}" | tr " " _)
  2582. postfilename="${entryDate}_${title2}.txt"
  2583. touch ${postfilename}
  2584. chmod 644 ${postfilename}
  2585. UpdatePhlogListing
  2586. echo -n "Would you like to edit the post with $editor? (y/n) "
  2587. read editorAns
  2588. case $editorAns in
  2589. y* | Y* ) $editor $gopherRoot/$phlogDirName/${postfilename} ;;
  2590. n* | N* ) exit 0 ;;
  2591. * ) exit 0 ;;
  2592. esac
  2593. rm $gopherRoot/$phlogDirName/${postfilename}~
  2594. else
  2595. echo "There is already a post for today."
  2596. echo -n "Would you like to edit the post with $editor? (y/n) "
  2597. read editorAns
  2598. case $editorAns in
  2599. y* | Y* ) $editor $gopherRoot/$phlogDirName/$entryDate*.txt ;;
  2600. n* | N* ) exit 0 ;;
  2601. * ) exit 1 ;;
  2602. esac
  2603. rm $gopherRoot/$phlogDirName/${postfilename}.txt~
  2604. fi
  2605. exit 0
  2606. #+END_SRC
  2607. Save and exit.
  2608. #+BEGIN_SRC: bash
  2609. chmod +x /usr/bin/mkphlog
  2610. #+END_SRC
  2611. Now entering the command /mkphlog/ will allow you to create a phlog entry.
  2612. ** Install Owncloud
  2613. #+BEGIN_VERSE
  2614. /It's not water vapour/
  2615. -- Larry Ellison
  2616. #+END_VERSE
  2617. 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.
  2618. *** Server Installation
  2619. Install some dependencies:
  2620. #+BEGIN_SRC: bash
  2621. apt-get install apache2 php5 php5-gd php-xml-parser php5-intl
  2622. apt-get install php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl
  2623. #+END_SRC
  2624. 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.
  2625. #+BEGIN_SRC: bash
  2626. a2dismod php5filter
  2627. apt-get install libapache2-mod-php5
  2628. #+END_SRC
  2629. Ensure that the size of files which may be uploaded or downloaded is large enough.
  2630. #+BEGIN_SRC: bash
  2631. emacs /etc/php5/apache2/php.ini
  2632. #+END_SRC
  2633. Set the following:
  2634. #+BEGIN_SRC: bash
  2635. upload_max_filesize = 512M
  2636. post_max_size = 512M
  2637. #+END_SRC
  2638. Save and exit, then edit your Apache configuration.
  2639. #+BEGIN_SRC: bash
  2640. export HOSTNAME=mydomainname.com
  2641. emacs /etc/apache2/sites-available/$HOSTNAME
  2642. #+END_SRC
  2643. 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.
  2644. #+BEGIN_SRC: bash
  2645. <Directory /var/www/mydomainname.com/htdocs/owncloud>
  2646. Options Indexes FollowSymLinks MultiViews
  2647. AllowOverride All
  2648. Order allow,deny
  2649. allow from all
  2650. </Directory>
  2651. #+END_SRC
  2652. To ensure that nobody logs in insecurely add the following to the 80 VirtualHost section.
  2653. #+BEGIN_SRC: bash
  2654. <Directory /var/www/mydomainname.com/htdocs/owncloud>
  2655. deny from all
  2656. </Directory>
  2657. #+END_SRC
  2658. Save and exit, then restart apache.
  2659. #+BEGIN_SRC: bash
  2660. service apache2 restart
  2661. #+END_SRC
  2662. Download owncloud.
  2663. #+BEGIN_SRC: bash
  2664. cd /tmp
  2665. wget http://freedombone.uk.to/owncloud.tar.bz2
  2666. #+END_SRC
  2667. Verify the download:
  2668. #+BEGIN_SRC: bash
  2669. sha256sum owncloud.tar.bz2
  2670. 92b53fdfa7c4165b83dd2f8447f63928454a5815d08ff2d6165dd1a8969ecbe1 owncloud.tar.bz2
  2671. #+END_SRC
  2672. Extract the archive. This may take a couple of minutes, so don't be alarmed that the system has crashed.
  2673. #+BEGIN_SRC: bash
  2674. export HOSTNAME=mydomainname.com
  2675. tar -xjf owncloud.tar.bz2
  2676. #+END_SRC
  2677. Move the extracted files to your site and set file permissions.
  2678. #+BEGIN_SRC: bash
  2679. cp -r owncloud /var/www/$HOSTNAME/htdocs
  2680. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/owncloud/apps
  2681. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs/owncloud/config
  2682. chown www-data:www-data /var/www/$HOSTNAME/htdocs/owncloud
  2683. #+END_SRC
  2684. Edit the htaccess file for Owncloud.
  2685. #+BEGIN_SRC: bash
  2686. emacs /var/www/$HOSTNAME/htdocs/owncloud/.htaccess
  2687. #+END_SRC
  2688. Set the following.
  2689. #+BEGIN_SRC: bash
  2690. php_value upload_max_filesize 512M
  2691. php_value post_max_size 512M
  2692. php_value memory_limit 32M
  2693. #+END_SRC
  2694. Save and exit.
  2695. With a web browser visit your domain (mydomainname.com/owncloud) and enter an administrator username and password.
  2696. *** Owncloud on Android
  2697. 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.
  2698. ** Install a Wiki
  2699. #+BEGIN_VERSE
  2700. /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./
  2701. -- Tom Barbalet
  2702. #+END_VERSE
  2703. Dokuwiki is based upon flat files, and so is easy to move from one server to another without a lot of database complications.
  2704. Download the wiki.
  2705. #+BEGIN_SRC: bash
  2706. cd /tmp
  2707. wget http://freedombone.uk.to/dokuwiki.tgz
  2708. #+END_SRC
  2709. Verify it.
  2710. #+BEGIN_SRC: bash
  2711. sha256sum dokuwiki.tgz
  2712. 6b126f90979463d9ddaa74acc6f96aa230cfdc789946f241c3646086d9574be8 dokuwiki.tgz
  2713. #+END_SRC
  2714. Then extract and install it.
  2715. #+BEGIN_SRC: bash
  2716. export HOSTNAME=mywikidomainname.com
  2717. tar -xzvf dokuwiki.tgz
  2718. mv /var/www/$HOSTNAME/htdocs /var/www/$HOSTNAME/htdocs_old
  2719. mv dokuwiki /var/www/$HOSTNAME/htdocs
  2720. #+END_SRC
  2721. Edit the Apache configuration for your wiki site.
  2722. #+BEGIN_SRC: bash
  2723. emacs /etc/apache2/sites-available/$HOSTNAME
  2724. #+END_SRC
  2725. The settings should look something like the following. Replace /mywikidomainname.com/ with your wiki domain name.
  2726. #+BEGIN_SRC: bash
  2727. <VirtualHost *:80>
  2728. ServerAdmin myusername@mywikidomainname.com
  2729. ServerName mydomainname.com
  2730. DocumentRoot /var/www/mywikidomainname.com/htdocs
  2731. <Directory /var/www/mywikidomainname.com/htdocs>
  2732. order deny,allow
  2733. allow from all
  2734. </Directory>
  2735. <LocationMatch "/(data|conf|bin|inc)/">
  2736. order allow,deny
  2737. deny from all
  2738. satisfy all
  2739. </LocationMatch>
  2740. <Directory />
  2741. Options FollowSymLinks
  2742. AllowOverride All
  2743. </Directory>
  2744. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  2745. <Directory "/usr/lib/cgi-bin">
  2746. AllowOverride All
  2747. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  2748. Order allow,deny
  2749. Allow from all
  2750. </Directory>
  2751. ErrorLog ${APACHE_LOG_DIR}/error.log
  2752. # Possible values include: debug, info, notice, warn, error, crit,
  2753. # alert, emerg.
  2754. LogLevel error
  2755. CustomLog ${APACHE_LOG_DIR}/access.log combined
  2756. </VirtualHost>
  2757. <IfModule mod_ssl.c>
  2758. <VirtualHost *:443>
  2759. ServerAdmin myusername@mywikidomainname.com
  2760. ServerName mywikidomainname.com
  2761. DocumentRoot /var/www/mywikidomainname.com/htdocs
  2762. <Directory /var/www/mywikidomainname.com/htdocs>
  2763. order deny,allow
  2764. allow from all
  2765. </Directory>
  2766. <LocationMatch "/(data|conf|bin|inc)/">
  2767. order allow,deny
  2768. deny from all
  2769. satisfy all
  2770. </LocationMatch>
  2771. <Directory />
  2772. Options FollowSymLinks
  2773. AllowOverride All
  2774. </Directory>
  2775. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  2776. <Directory "/usr/lib/cgi-bin">
  2777. AllowOverride All
  2778. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  2779. Order allow,deny
  2780. Allow from all
  2781. </Directory>
  2782. ErrorLog ${APACHE_LOG_DIR}/error.log
  2783. # Possible values include: debug, info, notice, warn, error, crit,
  2784. # alert, emerg.
  2785. LogLevel error
  2786. CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
  2787. # SSL Engine Switch:
  2788. # Enable/Disable SSL for this virtual host.
  2789. SSLEngine on
  2790. # A self-signed certificate
  2791. SSLCertificateFile /etc/ssl/certs/mydomainname.com.crt
  2792. SSLCertificateKeyFile /etc/ssl/private/mydomainname.com.key
  2793. # Options based on bettercrypto.org
  2794. SSLProtocol All -SSLv2 -SSLv3
  2795. SSLHonorCipherOrder On
  2796. SSLCompression off
  2797. 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
  2798. # SSL Engine Options:
  2799. # Set various options for the SSL engine.
  2800. # o FakeBasicAuth:
  2801. # Translate the client X.509 into a Basic Authorisation. This means that
  2802. # the standard Auth/DBMAuth methods can be used for access control. The
  2803. # user name is the `one line' version of the client's X.509 certificate.
  2804. # Note that no password is obtained from the user. Every entry in the user
  2805. # file needs this password: `xxj31ZMTZzkVA'.
  2806. # o ExportCertData:
  2807. # This exports two additional environment variables: SSL_CLIENT_CERT and
  2808. # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
  2809. # server (always existing) and the client (only existing when client
  2810. # authentication is used). This can be used to import the certificates
  2811. # into CGI scripts.
  2812. # o StdEnvVars:
  2813. # This exports the standard SSL/TLS related `SSL_*' environment variables.
  2814. # Per default this exportation is switched off for performance reasons,
  2815. # because the extraction step is an expensive operation and is usually
  2816. # useless for serving static content. So one usually enables the
  2817. # exportation for CGI and SSI requests only.
  2818. # o StrictRequire:
  2819. # This denies access when "SSLRequireSSL" or "SSLRequire" applied even
  2820. # under a "Satisfy any" situation, i.e. when it applies access is denied
  2821. # and no other module can change it.
  2822. # o OptRenegotiate:
  2823. # This enables optimized SSL connection renegotiation handling when SSL
  2824. # directives are used in per-directory context.
  2825. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
  2826. <FilesMatch "\.(cgi|shtml|phtml|php)$">
  2827. SSLOptions +StdEnvVars
  2828. </FilesMatch>
  2829. <Directory /usr/lib/cgi-bin>
  2830. SSLOptions +StdEnvVars
  2831. </Directory>
  2832. # SSL Protocol Adjustments:
  2833. # The safe and default but still SSL/TLS standard compliant shutdown
  2834. # approach is that mod_ssl sends the close notify alert but doesn't wait for
  2835. # the close notify alert from client. When you need a different shutdown
  2836. # approach you can use one of the following variables:
  2837. # o ssl-unclean-shutdown:
  2838. # This forces an unclean shutdown when the connection is closed, i.e. no
  2839. # SSL close notify alert is send or allowed to received. This violates
  2840. # the SSL/TLS standard but is needed for some brain-dead browsers. Use
  2841. # this when you receive I/O errors because of the standard approach where
  2842. # mod_ssl sends the close notify alert.
  2843. # o ssl-accurate-shutdown:
  2844. # This forces an accurate shutdown when the connection is closed, i.e. a
  2845. # SSL close notify alert is send and mod_ssl waits for the close notify
  2846. # alert of the client. This is 100% SSL/TLS standard compliant, but in
  2847. # practice often causes hanging connections with brain-dead browsers. Use
  2848. # this only for browsers where you know that their SSL implementation
  2849. # works correctly.
  2850. # Notice: Most problems of broken clients are also related to the HTTP
  2851. # keep-alive facility, so you usually additionally want to disable
  2852. # keep-alive for those clients, too. Use variable "nokeepalive" for this.
  2853. # Similarly, one has to force some clients to use HTTP/1.0 to workaround
  2854. # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
  2855. # "force-response-1.0" for this.
  2856. BrowserMatch "MSIE [2-6]" \
  2857. nokeepalive ssl-unclean-shutdown \
  2858. downgrade-1.0 force-response-1.0
  2859. # MSIE 7 and newer should be able to use keepalive
  2860. BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
  2861. </VirtualHost>
  2862. </IfModule>
  2863. #+END_SRC
  2864. Enable your site with:
  2865. #+BEGIN_SRC: bash
  2866. a2ensite
  2867. #+END_SRC
  2868. then select the domain name and reload.
  2869. #+BEGIN_SRC: bash
  2870. service apache2 reload
  2871. #+END_SRC
  2872. and alter permissions:
  2873. #+BEGIN_SRC: bash
  2874. chmod -R 755 /var/www/$HOSTNAME/htdocs
  2875. chown -R www-data:www-data /var/www/$HOSTNAME/htdocs
  2876. #+END_SRC
  2877. Open a browser and visit http://$HOSTNAME/install.php, then fill out the details. Once everything has been accepted without errors:
  2878. #+BEGIN_SRC: bash
  2879. rm /var/www/$HOSTNAME/htdocs/install.php
  2880. #+END_SRC
  2881. Add a few extra mime types:
  2882. #+BEGIN_SRC: bash
  2883. emacs /var/www/$HOSTNAME/htdocs/conf/mime.conf
  2884. #+END_SRC
  2885. Append the following:
  2886. #+BEGIN_SRC: bash
  2887. ogv video/ogg
  2888. mp4 video/mp4
  2889. webm video/webm
  2890. #+END_SRC
  2891. Save and exit.
  2892. 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*.
  2893. Now you can visit your wiki and begin editing.
  2894. ** Install Bitmessage
  2895. #+BEGIN_VERSE
  2896. /Love your neighbour. Fight the future. If you are reading this you ARE the resistance./
  2897. -- BitChirp
  2898. #+END_VERSE
  2899. *** A new kind of Email
  2900. [[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.
  2901. 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.
  2902. Installing Bitmessage as a daemon will increase the size of the network, and therefore the level of security for all users.
  2903. *** The Daemon
  2904. Install from the current source code.
  2905. #+BEGIN_SRC: bash
  2906. apt-get install python screen
  2907. cd /tmp
  2908. git clone https://github.com/Bitmessage/PyBitmessage.git
  2909. cd PyBitmessage
  2910. make install
  2911. #+END_SRC
  2912. Now create the daemon.
  2913. #+BEGIN_SRC: bash
  2914. emacs /etc/init.d/pybitmessage
  2915. #+END_SRC
  2916. Add the following text:
  2917. #+BEGIN_SRC: bash
  2918. #!/bin/bash
  2919. # /etc/init.d/bitmessage
  2920. ### BEGIN INIT INFO
  2921. # Provides: pybitmessage
  2922. # Required-Start: $remote_fs $syslog
  2923. # Required-Stop: $remote_fs $syslog
  2924. # Default-Start: 2 3 4 5
  2925. # Default-Stop: 0 1 6
  2926. # Short-Description: starts bitmessage as a background daemon, suitable for servers
  2927. # Description: This file should be used to construct scripts to be
  2928. # placed in /etc/init.d.
  2929. ### END INIT INFO
  2930. # Author: Super-Nathan <BM-Gu2k3Wy2hpTMYBxSoM2937SPcuU6xzEj>
  2931. #Settings
  2932. SERVICE='pybitmessage'
  2933. LOGFILE='/dev/null' # this disables logging
  2934. # LOGFILE='/var/log/bitmessage.log' # comment out the above line and un-comment this line to save a log
  2935. COMMAND="python bitmessagemain.py > $LOGFILE"
  2936. USERNAME='bitmsg'
  2937. NICELEVEL=19 # from 0-19 the bigger the number, the less the impact on system resources
  2938. HISTORY=1024
  2939. PBM_LOCATION="/usr/local/share/pybitmessage"
  2940. INVOCATION="nice -n ${NICELEVEL} ${COMMAND}"
  2941. PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/sbin:/usr/sbin:/bin:/usr/local/share/pybitmessage'
  2942. bm_start() {
  2943. echo "Starting $SERVICE..."
  2944. cd ${PBM_LOCATION}
  2945. su --command "screen -h ${HISTORY} -dmS ${SERVICE} ${INVOCATION}" $USERNAME
  2946. }
  2947. bm_stop() {
  2948. echo "Stopping $SERVICE"
  2949. su --command "screen -p 0 -S ${SERVICE} -X stuff "'^C'"" $USERNAME
  2950. }
  2951. #Start-Stop here
  2952. case "$1" in
  2953. start)
  2954. bm_start
  2955. ;;
  2956. stop)
  2957. bm_stop
  2958. ;;
  2959. restart)
  2960. bm_stop
  2961. sleep 60s
  2962. bm_start
  2963. ;;
  2964. *)
  2965. echo "Usage: $0 {start|stop|restart}"
  2966. exit 1
  2967. ;;
  2968. esac
  2969. exit 0
  2970. #+END_SRC
  2971. Save and exit.
  2972. 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.
  2973. #+BEGIN_SRC: bash
  2974. adduser bitmsg
  2975. #+END_SRC
  2976. Create a /keys.dat/ file which is used to configure Bitmessage.
  2977. #+BEGIN_SRC: bash
  2978. mkdir /home/bitmsg/.config
  2979. mkdir /home/bitmsg/.config/PyBitmessage
  2980. emacs /home/bitmsg/.config/PyBitmessage/keys.dat
  2981. #+END_SRC
  2982. Add the following:
  2983. #+BEGIN_SRC: bash
  2984. [bitmessagesettings]
  2985. settingsversion = 7
  2986. port = 8444
  2987. timeformat = %%a, %%d %%b %%Y %%I:%%M %%p
  2988. blackwhitelist = black
  2989. startonlogon = false
  2990. minimizetotray = false
  2991. showtraynotifications = false
  2992. startintray = false
  2993. socksproxytype = none
  2994. sockshostname = localhost
  2995. socksport = 9050
  2996. socksauthentication = false
  2997. sockslisten = false
  2998. socksusername =
  2999. sockspassword =
  3000. keysencrypted = false
  3001. messagesencrypted = false
  3002. defaultnoncetrialsperbyte = 640
  3003. defaultpayloadlengthextrabytes = 14000
  3004. minimizeonclose = false
  3005. maxacceptablenoncetrialsperbyte = 0
  3006. maxacceptablepayloadlengthextrabytes = 0
  3007. userlocale = system
  3008. namecoinrpctype = namecoind
  3009. namecoinrpchost = localhost
  3010. namecoinrpcuser =
  3011. namecoinrpcpassword =
  3012. namecoinrpcport = 8336
  3013. sendoutgoingconnections = True
  3014. daemon = true
  3015. #+END_SRC
  3016. Save and exit. Then enable the daemon and run it.
  3017. #+BEGIN_SRC: bash
  3018. rm -f /tmp/-usr-local-share-pybitmessage-*.lock
  3019. chown -R bitmsg:bitmsg /home/bitmsg
  3020. chmod +x /etc/init.d/pybitmessage
  3021. update-rc.d pybitmessage defaults
  3022. service pybitmessage start
  3023. #+END_SRC
  3024. Now open port 8444 on your internet router or firewall and direct it to the BBB.
  3025. *** Using Bitmessage
  3026. 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.
  3027. 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:
  3028. #+BEGIN_SRC: bash
  3029. cd /tmp
  3030. git clone https://github.com/Bitmessage/PyBitmessage.git
  3031. cd PyBitmessage
  3032. make install
  3033. pybitmessage
  3034. #+END_SRC
  3035. *** Connect to Email
  3036. TODO: how to connect Bitmessage to an email client.
  3037. #+BEGIN_SRC: bash
  3038. cd /tmp
  3039. wget http://freedombone.uk.to/notbit.tar.gz
  3040. #+END_SRC
  3041. Verify it.
  3042. #+BEGIN_SRC: bash
  3043. sha256sum notbit.tar.gz
  3044. 972fdc9cbb8034141282337dcd5e557bce57969ff6bd1d607da89bd93cc7bb68
  3045. #+END_SRC
  3046. Extract and install it.
  3047. #+BEGIN_SRC: bash
  3048. tar -xzvf notbit.tar.gz
  3049. cd notbit
  3050. apt-get install dh-autoreconf
  3051. ./autogen.sh --prefix=/home/myusername
  3052. make
  3053. make install
  3054. #+END_SRC
  3055. ** Overcome restrictive environments
  3056. #+BEGIN_VERSE
  3057. /Censorship reflects a society's lack of confidence in itself. It is a hallmark of an authoritarian regime./
  3058. -- Potter Stewart
  3059. #+END_VERSE
  3060. 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.
  3061. 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.
  3062. #+BEGIN_SRC: bash
  3063. apt-get install shellinabox libapache2-mod-proxy-html
  3064. #+END_SRC
  3065. Update your Apache configuration.
  3066. #+BEGIN_SRC: bash
  3067. export HOSTNAME=mydomainname.com
  3068. emacs /etc/apache2/sites-available/$HOSTNAME
  3069. #+END_SRC
  3070. Within the section which begins with *<VirtualHost *:443>* add the following, replacing /mydomainname.com/ with your domain name and /myusername/ with your username.
  3071. #+BEGIN_SRC: bash
  3072. <Location /shell>
  3073. ProxyPass http://localhost:4200/
  3074. Order allow,deny
  3075. Allow from all
  3076. AuthName "Authentication for shellinabox"
  3077. AuthUserFile /home/mydomainname.com/public_html/.htpasswd
  3078. AuthGroupFile /home/mydomainname.com/public_html/.htgroup
  3079. AuthType Basic
  3080. Require group shellinabox
  3081. Require user myusername
  3082. </Location>
  3083. #+END_SRC
  3084. 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.
  3085. #+BEGIN_SRC: bash
  3086. mkdir /home/$HOSTNAME
  3087. mkdir /home/$HOSTNAME/public_html
  3088. htpasswd -c /home/$HOSTNAME/public_html/.htpasswd myusername
  3089. #+END_SRC
  3090. Create a user group.
  3091. #+BEGIN_SRC: bash
  3092. emacs /home/$HOSTNAME/public_html/.htgroup
  3093. #+END_SRC
  3094. Add the following:
  3095. #+BEGIN_SRC: bash
  3096. shellinabox: myusername
  3097. #+END_SRC
  3098. Save and exit, then restart Apache.
  3099. #+BEGIN_SRC: bash
  3100. a2enmod proxy_http
  3101. service apache2 restart
  3102. #+END_SRC
  3103. Now with a web browser navigate to https://mydomainname.com/shell and log in.
  3104. 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/.
  3105. ** Set up a mailing list
  3106. #+BEGIN_VERSE
  3107. /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./
  3108. -- Jono Bacon
  3109. #+END_VERSE
  3110. *** With Email
  3111. 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.
  3112. **** Installation
  3113. #+BEGIN_SRC: bash
  3114. export HOSTNAME=mydomainname.com
  3115. apt-get install mailman
  3116. newlist mailman
  3117. #+END_SRC
  3118. Enter an email address for the list administrator and a password.
  3119. #+BEGIN_SRC: bash
  3120. emacs /etc/mailman/mm_cfg.py
  3121. #+END_SRC
  3122. Set *MTA=None* and change *http:* to *https:*, then save and exit.
  3123. Add some settings.
  3124. #+BEGIN_SRC: bash
  3125. emacs /etc/exim4/conf.d/main/04_mailman_options
  3126. #+END_SRC
  3127. Add the following, replacing /mydomainname.com/ with your domain name.
  3128. #+BEGIN_SRC: bash
  3129. # Mailman macro definitions
  3130. # Home dir for the Mailman installation
  3131. MM_HOME=/var/lib/mailman
  3132. # User and group for Mailman
  3133. MM_UID=list
  3134. MM_GID=list
  3135. #
  3136. # Domains that your lists are in - colon separated list
  3137. # you may wish to add these into local_domains as well
  3138. domainlist mm_domains=mydomainname.com
  3139. # The path of the Mailman mail wrapper script
  3140. MM_WRAP=MM_HOME/mail/mailman
  3141. #
  3142. # The path of the list config file (used as a required file when
  3143. # verifying list addresses)
  3144. MM_LISTCHK=MM_HOME/lists/${lc::$local_part}/config.pck
  3145. #+END_SRC
  3146. Save and exit.
  3147. #+BEGIN_SRC: bash
  3148. emacs /etc/exim4/conf.d/main/000_localmacros
  3149. #+END_SRC
  3150. Append the following:
  3151. #+BEGIN_SRC: bash
  3152. SYSTEM_ALIASES_PIPE_TRANSPORT = address_pipe
  3153. SYSTEM_ALIASES_USER = list
  3154. SYSTEM_ALIASES_GROUP = list
  3155. #+END_SRC
  3156. Save and exit.
  3157. #+BEGIN_SRC: bash
  3158. emacs /etc/exim4/conf.d/acl/30_exim4-config_check_rcpt
  3159. #+END_SRC
  3160. Append the following, before the final /accept/:
  3161. #+BEGIN_SRC: bash
  3162. # Do callback verification unless Mailman incoming bounce
  3163. deny !local_parts = *-bounces : *-bounces+*
  3164. !verify = sender/callout=30s,defer_ok
  3165. #+END_SRC
  3166. Save and exit.
  3167. #+BEGIN_SRC: bash
  3168. emacs
  3169. /etc/exim4/conf.d/router/450_mailman_aliases
  3170. #+END_SRC
  3171. Add the following:
  3172. #+BEGIN_SRC: bash
  3173. mailman_router:
  3174. driver = accept
  3175. domains = +mm_domains
  3176. require_files = MM_LISTCHK
  3177. local_part_suffix_optional
  3178. local_part_suffix = -admin : \
  3179. -bounces : -bounces+* : \
  3180. -confirm : -confirm+* : \
  3181. -join : -leave : \
  3182. -owner : -request : \
  3183. -subscribe : -unsubscribe
  3184. transport = mailman_transport
  3185. #+END_SRC
  3186. Save and exit.
  3187. #+BEGIN_SRC: bash
  3188. emacs /etc/exim4/conf.d/transport/40_mailman_pipe
  3189. #+END_SRC
  3190. Add the following:
  3191. #+BEGIN_SRC: bash
  3192. mailman_transport:
  3193. driver = pipe
  3194. command = MM_WRAP \
  3195. '${if def:local_part_suffix \
  3196. {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
  3197. {post}}' \
  3198. $local_part
  3199. current_directory = MM_HOME
  3200. home_directory = MM_HOME
  3201. user = MM_UID
  3202. group = MM_GID
  3203. #+END_SRC
  3204. Save and exit.
  3205. #+BEGIN_SRC: bash
  3206. chown root:list /var/lib/mailman/mail/mailman
  3207. update-exim4.conf.template -r
  3208. update-exim4.conf
  3209. service exim4 restart
  3210. emacs /etc/apache2/conf.d/mailman
  3211. #+END_SRC
  3212. Add the following:
  3213. #+BEGIN_SRC: bash
  3214. Alias /pipermail /var/lib/mailman/archives/public
  3215. Alias /images/mailman /usr/share/images/mailman
  3216. <directory /var/lib/mailman/archives/public>
  3217. DirectoryIndex index.html
  3218. </directory>
  3219. #+END_SRC
  3220. Save and exit.
  3221. #+BEGIN_SRC: bash
  3222. emacs /etc/apache2/sites-available/$HOSTNAME
  3223. #+END_SRC
  3224. Add the following to the 443 section.
  3225. #+BEGIN_SRC: bash
  3226. <Location /mailman>
  3227. Options Indexes FollowSymLinks MultiViews
  3228. Order allow,deny
  3229. Allow from all
  3230. RedirectMatch ^/$ /cgi-bin/mailman/listinfo
  3231. </Location>
  3232. #+END_SRC
  3233. Save and exit.
  3234. #+BEGIN_SRC: bash
  3235. service apache2 restart
  3236. #+END_SRC
  3237. Now add your mailing list. The list name should not include any spaces.
  3238. #+BEGIN_SRC: bash
  3239. newlist mymailinglistname
  3240. #+END_SRC
  3241. With a browser visit https://$HOSTNAME/cgi-bin/mailman/admin/mymailinglistname to configure the mailing list.
  3242. Under *General Options* add an email address for a moderator (could be the same as the administrator) and click *Submit your changes*.
  3243. Under *Privacy Options* set steps required for subscription to *Confirm and approve* and click *Submit your changes*.
  3244. Also change these settings for the account within https://$HOSTNAME/cgi-bin/mailman/admin/mailman
  3245. #+BEGIN_SRC: bash
  3246. emacs /etc/aliases
  3247. #+END_SRC
  3248. Append the following, replacing /mymailinglistname/ with your mailing list name:
  3249. #+BEGIN_SRC: bash
  3250. mymailinglistname: "|/var/lib/mailman/mail/mailman post mymailinglistname"
  3251. mymailinglistname-admin: "|/var/lib/mailman/mail/mailman admin mymailinglistname"
  3252. mymailinglistname-bounces: "|/var/lib/mailman/mail/mailman bounces mymailinglistname"
  3253. mymailinglistname-confirm: "|/var/lib/mailman/mail/mailman confirm mymailinglistname"
  3254. mymailinglistname-join: "|/var/lib/mailman/mail/mailman join mymailinglistname"
  3255. mymailinglistname-leave: "|/var/lib/mailman/mail/mailman leave mymailinglistname"
  3256. mymailinglistname-owner: "|/var/lib/mailman/mail/mailman owner mymailinglistname"
  3257. mymailinglistname-request: "|/var/lib/mailman/mail/mailman request mymailinglistname"
  3258. mymailinglistname-subscribe: "|/var/lib/mailman/mail/mailman subscribe mymailinglistname"
  3259. mymailinglistname-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mymailinglistname"
  3260. #+END_SRC
  3261. Save and exit. Then to test that the mailing list works:
  3262. #+BEGIN_SRC: bash
  3263. exim -d+route -bt mymailinglistname@$HOSTNAME
  3264. #+END_SRC
  3265. If everything is working then this shouldn't show any problems.
  3266. **** Using the mailing list
  3267. Direct subscribers towards:
  3268. #+BEGIN_SRC: bash
  3269. https://mydomainname.com/cgi-bin/mailman/listinfo/mymailinglistname
  3270. #+END_SRC
  3271. To administrate the list visit:
  3272. #+BEGIN_SRC: bash
  3273. https://mydomainname.com/cgi-bin/mailman/admin/mymailinglistname
  3274. #+END_SRC
  3275. To add another mailing list:
  3276. #+BEGIN_SRC: bash
  3277. newlist mymailinglistname
  3278. #+END_SRC
  3279. To delete a mailing list:
  3280. #+BEGIN_SRC: bash
  3281. rmlist -a mymailinglistname
  3282. #+END_SRC
  3283. *** With Bitmessage
  3284. 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".
  3285. On a Debian based system:
  3286. #+BEGIN_SRC: bash
  3287. sudo apt-get install makepasswd
  3288. #+END_SRC
  3289. or on an RPM based system:
  3290. #+BEGIN_SRC: bash
  3291. sudo yum install makepasswd
  3292. #+END_SRC
  3293. Create a name for your mailing list. This will be a random string.
  3294. #+BEGIN_SRC: bash
  3295. makepasswd -c 40
  3296. #+END_SRC
  3297. Keep a note of this.
  3298. Run the Bitmessage client and on the menu select *File/Join-Create Chan/Create new chan*
  3299. 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.
  3300. 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.
  3301. 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.
  3302. 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.
  3303. ** Install Tripwire
  3304. #+BEGIN_VERSE
  3305. /...by the time you get done with all of that, we have a freedom box/
  3306. -- Eben Moglen
  3307. #+END_VERSE
  3308. 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.
  3309. #+BEGIN_SRC: bash
  3310. apt-get install tripwire
  3311. export HOSTNAME=mydomainname.com
  3312. cd /etc/tripwire
  3313. cp arm-local.key $HOSTNAME-local.key
  3314. cp site.key $HOSTNAME-site.key
  3315. tripwire --init
  3316. tripwire --update-policy --secure-mode low /etc/tripwire/twpol.txt
  3317. tripwire --check --interactive
  3318. #+END_SRC
  3319. you will be asked for two passphrases ("site" and "local"). Make a note of these.
  3320. Turn off reporting of changes to system logs.
  3321. #+BEGIN_SRC: bash
  3322. emacs /etc/tripwire/twcfg.txt
  3323. #+END_SRC
  3324. Set *SYSLOGREPORTING* to false and comment out the line, then save and exit.
  3325. #+BEGIN_SRC: bash
  3326. emacs /etc/tripwire/twpol.txt
  3327. #+END_SRC
  3328. Comment out the line:
  3329. #+BEGIN_SRC: bash
  3330. /var/log -> $(SEC_CONFIG) ;
  3331. #+END_SRC
  3332. Then save and exit.
  3333. If you subsequently install any more packages or make configuration changes then update the policy again with:
  3334. #+BEGIN_SRC: bash
  3335. tripwire --update-policy --secure-mode low /etc/tripwire/twpol.txt
  3336. #+END_SRC
  3337. Also, to look for any rootkits.
  3338. #+BEGIN_SRC: bash
  3339. apt-get install rkhunter
  3340. #+END_SRC
  3341. * Router/Firewall ports
  3342. The following ports on your internet router/firewall should be forwarded to the BBB.
  3343. | Protocol | Port/s |
  3344. |---------------+------------|
  3345. | Gopher | 70 |
  3346. | HTTP | 80 |
  3347. | HTTPS | 443 |
  3348. | IMAP | 143 |
  3349. | IRC SSL | 6670 |
  3350. | SIP | 5060..5061 |
  3351. | SMTP | 25 |
  3352. | SMTPS | 465 |
  3353. | SSH | 22 |
  3354. | XMPP | 5222..5223 |
  3355. | XMPP (server) | 5269 |
  3356. | XMPP (BOSH) | 5280..5281 |
  3357. | Bitmessage | 8444 |
  3358. * Hints and Tips
  3359. ** Messaging security
  3360. 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.
  3361. ** Moving Domains
  3362. 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:
  3363. #+BEGIN_SRC: bash
  3364. find /var/www/mynewdomain/htdocs -type f -exec sed -i 's@myolddomain@mynewdomain@g' {} \;
  3365. #+END_SRC
  3366. If you're moving the blog to a new domain then you will need to delete the lock file:
  3367. #+BEGIN_SRC: bash
  3368. rm /var/www/myblogdomainname.com/htdocs/fp-content/%%setup.lock
  3369. #+END_SRC
  3370. Then visit your blog and reinstall it. Your existing content will be unaffected but you will need to delete the welcome post which gets added and also re-select your chosen theme.
  3371. ** MySql foo
  3372. *** Backup all databases
  3373. To back up all mysql databases:
  3374. #+BEGIN_SRC: bash
  3375. mysqldump -u root -p --all-databases --events > /var/backups/databasebackup.sql
  3376. #+END_SRC
  3377. *** Restoring a particular mysql database
  3378. To restore yesterday's friendica backup:
  3379. #+BEGIN_SRC: bash
  3380. mysql -D friendica -o < /var/backups/friendica_daily.sql
  3381. #+END_SRC
  3382. To restore yesterday's mediawiki backup:
  3383. #+BEGIN_SRC: bash
  3384. mysql -D wikidb -o < /var/backups/wikidb_daily.sql
  3385. #+END_SRC
  3386. *** Removing mysql server
  3387. If you manage to screw up sql server completely then it can be fully deleted with:
  3388. #+BEGIN_SRC: bash
  3389. ps aux | grep mysql
  3390. #+END_SRC
  3391. and use /kill -9 <pid>/ to kill all mysql processes.
  3392. #+BEGIN_SRC: bash
  3393. apt-get remove --purge mysql\*
  3394. apt-get clean
  3395. updatedb
  3396. #+END_SRC
  3397. * Deprecated
  3398. The following items have been deprecated until such time as a successful installation is achieved.
  3399. ** Collaborative Document Editing
  3400. #+BEGIN_VERSE
  3401. /Openness and participation are antidotes to surveillance and control./
  3402. -- Howard Rheingold
  3403. #+END_VERSE
  3404. #+BEGIN_SRC: bash
  3405. apt-get install nodejs-legacy
  3406. curl https://npmjs.org/install.sh | sh
  3407. #+END_SRC
  3408. Create an etherpad database.
  3409. #+BEGIN_SRC: bash
  3410. mysql -p
  3411. CREATE DATABASE etherpad CHARACTER SET utf8 COLLATE utf8_general_ci;
  3412. GRANT ALL PRIVILEGES ON etherpad.* TO etherpad@localhost IDENTIFIED BY '__yourPasswd__';
  3413. FLUSH PRIVILEGES;
  3414. exit
  3415. #+END_SRC
  3416. Download etherpad.
  3417. #+BEGIN_SRC: bash
  3418. export HOSTNAME=mydomainname.com
  3419. cd /var/www/$HOSTNAME/htdocs
  3420. git clone git://github.com/ether/etherpad-lite.git etherpad
  3421. #+END_SRC
  3422. Edit the configuration file
  3423. #+BEGIN_SRC: bash
  3424. cd /var/www/$HOSTNAME/htdocs/etherpad
  3425. cp settings.json.template settings.json
  3426. emacs /var/www/$HOSTNAME/htdocs/etherpad/settings.json
  3427. #+END_SRC
  3428. Change the following settings. /rAnD0m5tRIng/ should be altered to a random string 10 characters in length.
  3429. #+BEGIN_SRC: bash
  3430. //IP and port which etherpad should bind at
  3431. "ip": "127.0.0.1",
  3432. // set a session key
  3433. "sessionKey" : "rAnD0m5tRIng",
  3434. //configure the connection settings
  3435. "dbType" : "mysql",
  3436. "dbSettings" : {
  3437. "user" : "etherpad",
  3438. "host" : "localhost",
  3439. "password": "__yourPassword__",
  3440. "database": "etherpad"
  3441. },
  3442. // add admin user
  3443. "users": {
  3444. "admin": {
  3445. "password": "__yourAdminPassword__",
  3446. "is_admin": true
  3447. }
  3448. },
  3449. #+END_SRC
  3450. Save and exit, then create a system user.
  3451. #+BEGIN_SRC: bash
  3452. adduser --system --home=/var/www/$HOSTNAME/htdocs/etherpad/ --group etherpad
  3453. chown -R etherpad: /var/www/$HOSTNAME/htdocs/etherpad/
  3454. #+END_SRC
  3455. Create an init script using your favorite editor.
  3456. #+BEGIN_SRC: bash
  3457. emacs /etc/init.d/etherpad
  3458. #+END_SRC
  3459. Add the following, replacing /mydomainname.com/ with your domain name:
  3460. #+BEGIN_SRC: bash
  3461. #!/bin/sh
  3462. ### BEGIN INIT INFO
  3463. # Provides: etherpad-lite
  3464. # Required-Start: $local_fs $remote_fs $network $syslog
  3465. # Required-Stop: $local_fs $remote_fs $network $syslog
  3466. # Default-Start: 2 3 4 5
  3467. # Default-Stop: 0 1 6
  3468. # Short-Description: starts etherpad lite
  3469. # Description: starts etherpad lite using start-stop-daemon
  3470. ### END INIT INFO
  3471. PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
  3472. LOGFILE="/var/www/mydomainname.com/htdocs/etherpad/etherpad-lite.log"
  3473. EPLITE_DIR="/var/www/mydomainname.com/htdocs/etherpad"
  3474. EPLITE_BIN="bin/safeRun.sh"
  3475. USER="etherpad"
  3476. GROUP="etherpad"
  3477. DESC="Etherpad Lite"
  3478. NAME="etherpad-lite"
  3479. set -e
  3480. . /lib/lsb/init-functions
  3481. start() {
  3482. echo "Starting $DESC... "
  3483. start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE || true
  3484. echo "done"
  3485. }
  3486. #We need this function to ensure the whole process tree will be killed
  3487. killtree() {
  3488. local _pid=$1
  3489. local _sig=${2-TERM}
  3490. for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
  3491. killtree ${_child} ${_sig}
  3492. done
  3493. kill -${_sig} ${_pid}
  3494. }
  3495. stop() {
  3496. echo "Stopping $DESC... "
  3497. while test -d /proc/$(cat /var/run/$NAME.pid); do
  3498. killtree $(cat /var/run/$NAME.pid) 15
  3499. sleep 0.5
  3500. done
  3501. rm /var/run/$NAME.pid
  3502. echo "done"
  3503. }
  3504. status() {
  3505. status_of_proc -p /var/run/$NAME.pid "" "etherpad-lite" && exit 0 || exit $?
  3506. }
  3507. case "$1" in
  3508. start)
  3509. start
  3510. ;;
  3511. stop)
  3512. stop
  3513. ;;
  3514. restart)
  3515. stop
  3516. start
  3517. ;;
  3518. status)
  3519. status
  3520. ;;
  3521. *)
  3522. echo "Usage: $NAME {start|stop|restart|status}" >&2
  3523. exit 1
  3524. ;;
  3525. esac
  3526. exit 0
  3527. #+END_SRC
  3528. Save and exit, then enable the daemon.
  3529. #+BEGIN_SRC: bash
  3530. chmod +x /etc/init.d/etherpad
  3531. update-rc.d etherpad defaults
  3532. service etherpad start
  3533. #+END_SRC
  3534. Update your Apache configuration.
  3535. #+BEGIN_SRC: bash
  3536. emacs /etc/apache2/sites-available/$HOSTNAME
  3537. #+END_SRC
  3538. Within the section which begins with *<VirtualHost *:443>* add the following:
  3539. #+BEGIN_SRC: bash
  3540. <Location /etherpad>
  3541. ProxyPass http://localhost:9001/
  3542. ProxyPassReverse http://localhost:9001/
  3543. Order allow,deny
  3544. allow from all
  3545. AuthName "Welcome to Etherpad"
  3546. AuthUserFile /home/mydomainname.com/public_html/.htpasswd
  3547. AuthGroupFile /home/mydomainname.com/public_html/.htgroup
  3548. AuthType Basic
  3549. Require group etherpad
  3550. </Location>
  3551. #+END_SRC
  3552. Save and exit, then restart Apache.
  3553. #+BEGIN_SRC: bash
  3554. apt-get install libapache2-mod-proxy-html
  3555. a2enmod proxy proxy_http headers deflate
  3556. service apache2 restart
  3557. #+END_SRC
  3558. Create some passwords for users.
  3559. #+BEGIN_SRC: bash
  3560. mkdir /home/$HOSTNAME
  3561. mkdir /home/$HOSTNAME/public_html
  3562. htpasswd -c /home/$HOSTNAME/public_html/.htpasswd myusername
  3563. #+END_SRC
  3564. Create a user group.
  3565. #+BEGIN_SRC: bash
  3566. emacs /home/$HOSTNAME/public_html/.htgroup
  3567. #+END_SRC
  3568. Add the following:
  3569. #+BEGIN_SRC: bash
  3570. etherpad: myusername
  3571. #+END_SRC
  3572. Save and exit.
  3573. ** Install a VoIP server
  3574. #+BEGIN_VERSE
  3575. /Our core principles, whether in software or sovereignty, have always been about freedom and dignity, for all people, on an equal basis/
  3576. -- David Sugar, GNU Telephony
  3577. #+END_VERSE
  3578. *** The server
  3579. 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.
  3580. Edit your package sources:
  3581. #+BEGIN_SRC: bash
  3582. emacs /etc/apt/sources.list
  3583. #+END_SRC
  3584. Append the following line:
  3585. #+BEGIN_SRC: bash
  3586. deb http://dev.gnutelephony.org/archive/ wheezy/
  3587. #+END_SRC
  3588. Save and exit.
  3589. 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
  3590. #+BEGIN_SRC: bash
  3591. apt-get install gnutelephony-keyring
  3592. #+END_SRC
  3593. After that it will be happy to accept it as a signed repository. The verification keys can also be directly fetched with
  3594. #+BEGIN_SRC: bash
  3595. cd /tmp
  3596. wget http://dev.gnutelephony.org/archive/wheezy/public.key
  3597. #+END_SRC
  3598. and manually added instead with
  3599. #+BEGIN_SRC: bash
  3600. apt-key add public.key
  3601. #+END_SRC
  3602. To make sure you have all dependencies, do
  3603. #+BEGIN_SRC: bash
  3604. apt-get update;apt-get dist-upgrade
  3605. #+END_SRC
  3606. Before we install anything, let's inspect what is available to us by using
  3607. #+BEGIN_SRC: bash
  3608. dpkg -l sipwitch
  3609. #+END_SRC
  3610. To see the main application. The columns will indicate if the package is installed, which version and a description of the package. Then do
  3611. #+BEGIN_SRC: bash
  3612. dpkg -l sipwitch-*
  3613. #+END_SRC
  3614. 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.
  3615. To install only the main application, do
  3616. #+BEGIN_SRC: bash
  3617. apt-get install sipwitch
  3618. #+END_SRC
  3619. and to install all supporting plugins:
  3620. #+BEGIN_SRC: bash
  3621. apt-get install sipwitch-plugin-scripting sipwitch-plugin-subscriber sipwitch-plugin-forward sipwitch-plugin-zeroconf
  3622. #+END_SRC
  3623. Add your user into the sipwitch group
  3624. #+BEGIN_SRC: bash
  3625. groupadd sipwitch
  3626. groupadd sipusers
  3627. usermod -aG sipwitch myusername
  3628. usermod -aG sipusers myusername
  3629. #+END_SRC
  3630. Then edit the configuration
  3631. #+BEGIN_SRC: bash
  3632. emacs /etc/sipwitch.conf
  3633. #+END_SRC
  3634. Change the *mapped* value from 200 to 20, since we don't want to be serving huge numbers of calls.
  3635. 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.
  3636. Do not set the *realm* value, as doing so seems to prevent the server from working.
  3637. Save and exit.
  3638. Create a digest string for your username:
  3639. #+BEGIN_SRC: bash
  3640. sipwitch digest myusername
  3641. #+END_SRC
  3642. Make a note of the resulting string because you're going to use it in the users file you'll now create.
  3643. #+BEGIN_SRC: bash
  3644. export HOSTNAME=mydomainname.com
  3645. touch /etc/sipwitch.d/$HOSTNAME.xml
  3646. chmod 600 /etc/sipwitch.d/$HOSTNAME.xml
  3647. emacs /etc/sipwitch.d/$HOSTNAME.xml
  3648. #+END_SRC
  3649. It should look something like the following:
  3650. #+BEGIN_SRC: bash
  3651. <provision>
  3652. <user id="myusername">
  3653. <digest>yourdigeststring</digest>
  3654. <extension>201</extension>
  3655. <display>Your full name</display>
  3656. </user>
  3657. </provision>
  3658. #+END_SRC
  3659. Save and exit. Now edit the configuration.
  3660. #+BEGIN_SRC: bash
  3661. emacs /etc/default/sipwitch
  3662. #+END_SRC
  3663. Change "desktop" to "server", then save and exit.
  3664. Update the IP settings:
  3665. #+BEGIN_SRC: bash
  3666. iptables -A INPUT -p tcp --dport 5060 -j ACCEPT
  3667. iptables -A INPUT -p udp --dport 5060 -j ACCEPT
  3668. iptables -A INPUT -p tcp --dport 5061 -j ACCEPT
  3669. iptables -A INPUT -p udp --dport 5061 -j ACCEPT
  3670. iptables-save
  3671. #+END_SRC
  3672. Test that it's working:
  3673. #+BEGIN_SRC: bash
  3674. pkill -9 sipw
  3675. sipw -x9 -f
  3676. #+END_SRC
  3677. 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.
  3678. #+BEGIN_SRC: bash
  3679. service sipwitch start
  3680. #+END_SRC
  3681. *** Clients
  3682. **** Jitsi
  3683. Download the latst version from https://jitsi.org/index.php/Main/Download
  3684. TODO
  3685. **** Twinkle client
  3686. The client should have a user profile as following:
  3687. The "user name" is the xxx id used in the <user id="xxx"> entry of /etc/sipwitch.conf
  3688. The "domain" is the yyy domain in the main config <stack><domain>yyy entry of /etc/sipwitch.conf
  3689. The SIP Authentication should have:
  3690. realm = realm as set in <registry><realm> of /etc/sipwitch.conf
  3691. authentication name = <user id="xx"> entry, same as "User Name" field.
  3692. password = value of <secret>zzz in <user> entry of /etc/sipwitch.conf
  3693. Under security tab, set "Enable ZRTP/SRTP encryption"
  3694. **** Android
  3695. TODO
  3696. CSipSimple?
  3697. ** Install Mediagoblin
  3698. #+BEGIN_SRC: bash
  3699. apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv apache2-suexec libapache2-mod-fcgid
  3700. #+END_SRC
  3701. #+BEGIN_SRC: bash
  3702. adduser --system mediagoblin
  3703. addgroup mediagoblin
  3704. adduser mediagoblin mediagoblin
  3705. export HOSTNAME=mydomainname.com
  3706. cd /var/www/$HOSTNAME/htdocs
  3707. git clone git://gitorious.org/mediagoblin/mediagoblin.git mediagoblin
  3708. chown -hR mediagoblin:mediagoblin /var/www/$HOSTNAME/htdocs/mediagoblin
  3709. cd /var/www/$HOSTNAME/htdocs/mediagoblin
  3710. git submodule init && git submodule update
  3711. cp mediagoblin.ini mediagoblin_local.ini
  3712. emacs mediagoblin.ini
  3713. #+END_SRC
  3714. Set email_sender_address to the address you wish to be used as the sender for system-generated emails
  3715. Edit direct_remote_path, base_dir, and base_url if your mediagoblin directory is not the root directory of your vhost.
  3716. Save and exit.
  3717. #+BEGIN_SRC: bash
  3718. a2enmod suexec
  3719. a2enmod fcgid
  3720. emacs /etc/apache2/sites-available/$HOSTNAME
  3721. #+END_SRC
  3722. Add the following to the 80 virtual host, replacing mydomainname.com with your domain name.
  3723. #+BEGIN_SRC: bash
  3724. <Directory /var/www/mydomainname.com/htdocs/mediagoblin>
  3725. deny from all
  3726. </Directory>
  3727. #+END_SRC
  3728. Add the following to the 443 virtual host.
  3729. #+BEGIN_SRC: bash
  3730. # Serve static and media files via alias
  3731. Alias /mgoblin_static/ /var/www/mydomainname.com/htdocs/mediagoblin/mediagoblin/static/
  3732. Alias /mgoblin_media/ /var/www/mydomainname.com/htdocs/mediagoblin/user_dev/media/public/
  3733. # Rewrite all URLs to fcgi, except for static and media urls
  3734. RewriteEngine On
  3735. RewriteRule ^(mgoblin_static|mgoblin_media)($|/) - [L]
  3736. RewriteCond %{REQUEST_FILENAME} !-f
  3737. RewriteRule ^/(.*)$ /mg.fcgi/$1 [QSA,L]
  3738. # Allow access to static and media directories
  3739. <Directory /var/www/mydomainname.com/htdocs/mediagoblin/mediagoblin/static>
  3740. Order allow,deny
  3741. Allow from all
  3742. </Directory>
  3743. <Directory /var/www/mydomainname.com/htdocs/mediagoblin/mediagoblin/user_dev/media/public>
  3744. Order allow,deny
  3745. Allow from all
  3746. </Directory>
  3747. # Connect to fcgi server
  3748. FastCGIExternalServer /var/www/mg.fcgi -host 127.0.0.1:26543
  3749. #+END_SRC
  3750. Save and exit
  3751. #+BEGIN_SRC: bash
  3752. cd /var/www/$HOSTNAME/htdocs/mediagoblin
  3753. ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
  3754. #+END_SRC
  3755. https://github.com/joar/mediagoblin-init-scripts
  3756. ** Kune
  3757. 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).
  3758. #+BEGIN_SRC: bash
  3759. apt-get install openjdk-6-jdk openjdk-7-jre mysql-server adduser dbconfig-common libjmagick6-jni
  3760. #+END_SRC
  3761. Add the Kune repository:
  3762. #+BEGIN_SRC: bash
  3763. emacs /etc/apt/sources.list
  3764. #+END_SRC
  3765. Append the following:
  3766. #+BEGIN_SRC: bash
  3767. deb ftp://ftp.kune.ourproject.org/pub/kune/debian/ stable/
  3768. #+END_SRC
  3769. Save and exit, then install the Kune package.
  3770. #+BEGIN_SRC: bash
  3771. gpg --keyserver pgp.mit.edu --recv-keys 9E358A05
  3772. gpg --armor --export 9E358A05 | apt-key add -
  3773. apt-get update
  3774. apt-get install kune
  3775. #+END_SRC
  3776. You will be asked for the MySql root password and another password to be used with the Kune database.
  3777. Allow the system to start automatically at boot.
  3778. #+BEGIN_SRC: bash
  3779. emacs /etc/default/kune
  3780. #+END_SRC
  3781. Set /START=yes/, then save and exit.
  3782. #+BEGIN_SRC: bash
  3783. service kune start
  3784. #+END_SRC
  3785. Now configure Apache.
  3786. #+BEGIN_SRC: bash
  3787. a2enmod expires
  3788. a2enmod proxy
  3789. a2enmod proxy_connect
  3790. a2enmod proxy_http
  3791. #+END_SRC
  3792. Upgrade the database.
  3793. #+BEGIN_SRC: bash
  3794. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.1.0+b5
  3795. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.1.0+b6
  3796. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.2.0+b12
  3797. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.2.0+b23
  3798. mysql -p kune_prod < /usr/share/dbconfig-common/data/kune/upgrade/mysql/0.2.0+b25
  3799. #+END_SRC
  3800. Edit the Apache configuration.
  3801. #+BEGIN_SRC: bash
  3802. emacs /etc/apache2/sites-available/$HOSTNAME
  3803. #+END_SRC
  3804. <VirtualHost *:80>
  3805. ServerName YOURSERVERNAME
  3806. ProxyRequests Off
  3807. <Proxy *>
  3808. Order deny,allow
  3809. Allow from all
  3810. </Proxy>
  3811. <Files *.cache.*>
  3812. ExpiresActive On
  3813. ExpiresDefault "modification plus 2 years"
  3814. </Files>
  3815. <Files *.nocache.*>
  3816. ExpiresActive Off
  3817. </Files>
  3818. ProxyPass /kune/ http://localhost:8888/
  3819. ProxyPassReverse /kune/ http://localhost:8888/
  3820. <Location /var/www/mydomainname.com/htdocs/kune/>
  3821. Order allow,deny
  3822. Allow from all
  3823. </Location>
  3824. </VirtualHost>
  3825. Within a browser open https://mydomainname.com:8888
  3826. See documentation in /usr/share/doc/kune/INSTALL.gz
  3827. * Related projects
  3828. * [[https://freedomboxfoundation.org/][Freedombox]]
  3829. * [[https://arkos.io/][ArkOS]]