beaglebone.txt 145KB

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