From bd229fb11ed90f45e2ad1019aedc411d0bbb5c13 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sat, 23 Mar 2019 12:52:25 +0100 Subject: [PATCH 1/2] Update matrix-appservice-discord config --- roles/matrix-appservice-discord/templates/apt/nodejs.j2 | 5 ----- roles/matrix-appservice-discord/templates/config.yaml.j2 | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 roles/matrix-appservice-discord/templates/apt/nodejs.j2 diff --git a/roles/matrix-appservice-discord/templates/apt/nodejs.j2 b/roles/matrix-appservice-discord/templates/apt/nodejs.j2 deleted file mode 100644 index 65e5110..0000000 --- a/roles/matrix-appservice-discord/templates/apt/nodejs.j2 +++ /dev/null @@ -1,5 +0,0 @@ -# {{ ansible_managed }} - -Package: node* libuv1* -Pin: release a=stretch-backports -Pin-Priority: 600 diff --git a/roles/matrix-appservice-discord/templates/config.yaml.j2 b/roles/matrix-appservice-discord/templates/config.yaml.j2 index 64e17dd..9974565 100644 --- a/roles/matrix-appservice-discord/templates/config.yaml.j2 +++ b/roles/matrix-appservice-discord/templates/config.yaml.j2 @@ -54,7 +54,7 @@ database: room: # Set the default visibility of alias rooms, defaults to "public". # One of: "public", "private" - defaultVisibility: "public" + defaultVisibility: "private" channel: # Pattern of the name given to bridged rooms. # Can use :guild for the guild name and :name for the channel name. From bbc04d971faf6559846462ab25700c930fa3c7b9 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 24 Mar 2019 12:10:35 +0100 Subject: [PATCH 2/2] Working appservice Discord --- group_vars/all/vars.yml | 2 + group_vars/all/vault.yml | 226 +++++++++--------- .../templates/config.yaml.j2 | 16 +- .../matrix-appservice-discord.service.j2 | 2 +- .../nginx/nginx-sites-available-main.j2 | 10 +- 5 files changed, 135 insertions(+), 121 deletions(-) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 4be3759..20336a0 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -33,3 +33,5 @@ monitoring_mail: 'monitoring.aurore@lists.crans.org' # Matrix matrix_webhooks_secret: "{{ vault_matrix_webhooks_secret }}" +matrix_discord_client_id: "559305991494303747" +matrix_discord_bot_token: "{{ vault_matrix_discord_bot_token }}" diff --git a/group_vars/all/vault.yml b/group_vars/all/vault.yml index bcc5e18..116e51c 100644 --- a/group_vars/all/vault.yml +++ b/group_vars/all/vault.yml @@ -1,112 +1,116 @@ $ANSIBLE_VAULT;1.1;AES256 -30643064346235376335653933633134616531356562383833323336316264643335336437376462 -3364343634313734653033343663306565306564623939340a636266646265633634646531323363 -35653136343933303034356333376539353561626638616234636333653764616433393866616536 -3935366266396632340a323866323438653935356265663835393366343833363639313933333464 -32373862303166643331363463656265656531646135653238333566386236316163393738366133 -33653332306664643336323864356364646138616130653861333637373436303433376633366661 -65373636383862306134353738323564393262376561306134303361633161323239303563643934 -63333530653561343862613033343435333336306135373136623139343634616232346364356464 -39363838343538633130363831303064303334353261346239366635363763386262633063303434 -34366531316338326233323634383730623838643535623939306535306634333438653434366662 -35663463306239383835643034343735336131363339666366356138613731333836386266383763 -31666535326630303536376364336432613736353134376230323631326130343262316630373934 -63353166376630336431626530643733623561343335396336616235616532386434626634653631 -35613930393536613633633463393434616131303763613033656262386663663839343662626535 -36373236323733663334306134313433393366653066373464386134303265323564343262336562 -39393738656337316239623466643933663938663433313866626665613263356534386535633837 -61643036666161653434613061653539636137653235663064323766613061333563626563396439 -39323137373162393237356135333632333163613961373533633432333233346463303034366336 -62396363393163363639313763616533333965396162313662626161343362393363313632643031 -35383433343764333238366265313363623561666162633739643232323962316165636436353766 -65666132393366613561363462393966366637613062346337303139666439323861653233353533 -37643138306463613933626162613865383038306133646365616337323164353362626638653765 -38653035323164663130326435356532333864363237333738656636623130383533663130363764 -63313439373336346334336431633263333138326561353366323239343466383039343938386436 -36333634613936393530396536353239316532346361396631393063343439373762306634653336 -36663137613164383061333232646534363632656362616335373066306236636239363663316665 -39313036666337616164633931323465613863316438366361303536633635653862333465316366 -34663662633233353361306537393061373630616262653432653631323638386230666437346664 -37646564623035356536356630376166376365326666323936616139656466343833386238313462 -35623239643765633766623934653963356166323065343266303431353966353063363137613632 -31656338373430326331346538613130363161623035306165666238613565333131376364323839 -61306466666130616334313466643031633664353666346637346161326331383637336339646434 -61643835386466633038663961303339646532643036343532393332636438366234383932376431 -30376165353834616564633062396461393636663464613038383363306264666334616264343361 -33346538386332633333343461623262336133306239646635303332613934306565663633616634 -61383665656531343332353263303534323435383136646235343135373739323563326662316633 -66343733396163353939643939653237393931386361623364653466623935333232666662313865 -32373761346534316334346137653565326633326466316566666362366338353165343761396136 -30346536386266363033323838313138633234346666343739316562356332323632643432333763 -65393032353861303937386437646537623830333866343564313863653033396637626466343463 -32343861623563653566623233363638636634646265643465373161326339346563623765326264 -37366137623734633662366263356135313164343634306232353530313034356333633239383432 -64646564343435303536343263323266663163666466653231363963393537356531313466653731 -37306664303737346431623937343062376562353630383535396533643437353631336438353162 -34373436613962643634333464303033323331666166383932306361643763393333616532623138 -66323366353836306436353437336338386161613336316465663339333461383464376562323530 -64373738656536313530346433663336306536333062653138663035653130376236613333346166 -38643561353030373633336533303666666465373938666633366361333938353332396363393832 -30633761646364393737653165396335353631376137653238386639633664313363333631366365 -30623730353462663530646434326561383265343534636138333065373439636463353539303436 -30353632303433373436383735383332616233363763326566343233613436303233363332363662 -65393062373335666265343830373730646639323730383238616531623934653931646164373765 -30333331336635313935656562383066323834636136303461326433626163363232653037626361 -34356532356263636131363233323336353434383562303166376162306338373461336134653861 -34316330356336303162303963303763643735656139616533616234643233646365386536616335 -30613662333437343233636364663562386363313034343061343137653062626338383432643230 -35323130373561343666326331333561323562623231303066353464653665356165643337323562 -32386139303034333764666662613436623933353964316536363430346631653630643832306634 -35653636326635353839316238643232353465616635633939323837353833386164323861653965 -64636437646166666538386231623338356261346563323831653965613965366633313662303165 -37333066356635623063333637633864303964303635666164316230353239303335623834376632 -38336231336234343433373734313866316332633831396132313164626265643263636262643934 -61313963373638336264653066613531656461386665316635313662343239353565336239306362 -31633738653439386162626235656434363534653735323732636565353862623165613436623961 -34346261383434373231393738353165303465313134303365393261306139613438383138326334 -63623636333132356363366635333834653037353863646633636436383432663663623238643437 -30306433323161316434326332643931346663393935643263333636623037653462626632376634 -36363166393835636163643466383365653731383335656462376533363333363065336137363730 -38386466363636356366383637646265333038663033663763646633613738366666393839346238 -30393961343064653261646337373434626363303534333338613536306336323265393935373363 -34383965353264643266303434316432656531346363353731623834373637343062623538346137 -36346632636666623663396339633830623238366232613862633365663738396434366161653564 -36343066386331303364623865346532613262663161366237363739633565653739626432363330 -39313562623236663130366231396236666139363333383332616333333164396331323465336233 -32626139656132383063376266613335643565303762663962373039393135393961343333303964 -37323563653732373839313361383136313535643738663636306631396432313563323933616561 -30646431656163373938326634373363376565316133616636376338316136343462613963313463 -65653932636431633738613961346566393566636664396137666366313130313666383063373230 -62643531373737626630303837353066376566333165336137323633346239386531353331363462 -64366532373032373339623232383531323761316336343434653035623331366665613261373462 -39336137336134363465613666616531336535323432353430386335616163363333376666306365 -62303339613264333537386262653531623162366635633561663733636530623963353437373134 -39663534363064343162316665666338316134396138396534643934643561386561353730636437 -33303865366261393161353732306338343337376631623531346337396237323662653536313861 -66346561383937616136376234363636663239616666306232613038646433373838653133346164 -36636663393066313434373131646335303730303266313261646531656261396534623964643834 -38613230353034316666643932343837333134656465306239383134366237396438366533643566 -61366236353538316431366165353734326130363239373631656661323966303530373338653539 -38393531326335613831313937303537623933613233313439366330303134643836303466353061 -30353030633936326238353630386663626132636363663638643732643331666664333962323562 -30633837366161356661643963353163636663616339663230353738646463653761393862313861 -63363834623765393461656239613737613231666337333332663262356233633536326531336337 -66626231636634396632343466323433396233636639393136333538386330313837626135306537 -65653130366433303036396530303835643266316333383761643166373838623037356539653166 -63396561616462366461316338323662366232383963376161626132343236643766623431303066 -31386231356361336632663266336661613938313634313038353431343463343433616238356563 -35643739373831383337336136626637313565633365643037363039353134343536333938333239 -37343463313632376333653266303162633838363933373164366563333538333561663539313331 -37666634343138356539366431386361623130613865333439373464336135613036333731633066 -34316234656430343633366361323830303232623565653736316539346662663537336263663331 -66636639333030623061616533356136306239323764373238353734613064616434353666323538 -33363934333930366432363434366365306431623438326534656266303837613034336130623066 -30666632333332623934306338653765386163396535393636376266396663633033663939353765 -35616237306566346230343933633464653537343039623132643538643634333238393961383335 -30323831643263613530373135666437383337636236373563313232393431323332353136633565 -33356236386537363039643861323131323738643864306133636266373731666631646262333032 -33376662336635663464323866626636343032663632326631613866396434623332303833326238 -34386230303233353966373362303365653636623632376331326466623532396661313264666463 -38333766313365376533663262366134373730363163343365326433626636363663363466313733 -39353164343463643462663635383266646161663235336264636463633231633935366663343237 -613361633163336661313532636238353634 +65623637663363313664336437353136643563306565616336366530636530316161356665336233 +3534346635396434386363386466383463666164343065310a343739663162646432303131316564 +33633833323534623039336131383262663236396465663162666566316465613832623131363430 +3930353730636363650a626132323139636130343065633933303435616163353666313233343930 +34616636633465313034666539303837373839363437393639363837613266363733366334323063 +64306335633537613831623433306532393664353662613433356531626339343664306366613636 +36393533626662353630616335396337333562303666616165613464376431646633653335623330 +39356637303630316262343638313565663335363832616463323163316665333766313338613137 +64623936616239303535636533333130333733666466643634356336633064663734383664386666 +35636637306434306166633063326265373437636532376335356365343839646438643263346361 +66343261653031636431333131303930346536346662613463393233306535646165336563633639 +35363633386366316534373936626139666665353937373638663162636638323235613434303239 +34393065346334303865613737306332356436643862373234376333313164303830353061393131 +65646438323335633838626438643834663839613630333131326664313263666238646531616334 +31326530303262366231653139613461653039306530356134336366383431326466373833633865 +65303664343035636464383462613265336535646266393339363363373131623832616562396565 +35636261393038656338306461643364363462376135376535326138356561303464346235656334 +65373432336536393464336436363031363037373039666237626666613331396630336437653837 +62373536376234333962303465633065376431353832313661643864353938643062303464666364 +36393239643166623764643939626336643564316364343732303232626265303238353031363636 +34366639643834393666346161306630383131633236366337316231633666336662393364383061 +36346331636662616333323739663736303663323566323864626135386363313231363864313432 +31633437376437633630343837393537613037623537356531306435663739346137376639333666 +66633366316338333365376466376334623133653132323064343764303363346663616438656633 +31636132663239343032616330373735373962633662616237643131383932303531623132376263 +63366665343834326639386465643465623330323832656237386335633938636164313963626635 +38636562343463383233393938353932303932333265303162366533643166306636326366373233 +66373839623631616162613439663565333633353864323833653335653834343461363063613432 +34633864633232303566613235336563616136353031653634333432346566633139396332386165 +63333264366539356636636537366630623034363563373436646639316461653861666334316662 +34393931363533363436323966656435353266373839616466333034643335343838333063323032 +35303261636133663738643939666631623139383638363261643961306138353563393439313635 +61653436653135343866353538336263363735393038383862316639356462383535663633393461 +30316362306363326235633235343837316661646630613962376464313932336462313435643134 +39373765656462323935363732653365663737643665353039323362613461356362373262316163 +62343334343536376461613633343037653733326164636636316631353830663362383766653538 +38333535343865666131646264323138363036333066316532623438313363303537326131633865 +34626166346665326461656132396237393736313132336263316161343336386431356433393931 +61356636346539613264366465616439356531336166633930633130333361653566333538356436 +38653561386365333262623932616136343836383532383764333537306130326562386662623631 +32313464323234663131613364353631313639306464353162393766303839383030333831656534 +32636362656234336134656235666335656138643330383033313435663035383835666236333564 +66386539333833323165386136336661363033353461336164623734633061386461313935663531 +39326230383233316131616362376133313137656431373463373232356363363964323038356233 +63316132313032333438643664663762333064646337363033366262313433623364623739366131 +32363031656539303261373431666566363266396663373665346639653066303966396266316631 +31363331336464393063373662663065353131303438663433383238663966316264356134633636 +62363433333737366162386265363766623438646337633137653436626130613566626236633837 +65623563363537663261373932326131376236656534616330663131643264333930386331623438 +31376263393662643938633862396665353363613539363039633966313161616338353666653130 +63663761373165363463323831336239616562646432346630393764633362643434626564653433 +39383634376238613833326131373438323937383138656531346435633562396437623163646566 +34643237383331376630333862613164343465373266613338633931636662626364613964613639 +32316365396639313635306261616439386162613366636362633763626135313462326662363834 +34636261353935343436316263623530393362343164373737356539663066336232303530643131 +33303136363431363232636238396233333236663933396639643233376562396234376639356564 +66346338386562646431373232356363303035366365383661356132643963376134323935386333 +39363162343938353135383530646662613139616639393230343363653661306431383633393035 +66303832306465373632343530333737393432623366353639616434346532653337346361363339 +35643937656337316566313534343762393338353830356266386165633262393964386635636430 +32346630383639623433623930323832643132613565376135363161663966646433343335323863 +35376631313864313362346637383932663633346565626231316533356561313637326336373931 +32336461313036356166613166303066303230383166303463373533346130336663386535376635 +37383239356139646335643662636234313666623062633163373931363761326130313537653665 +39393561626165323431386537656665326334373735346562326666623865303432623966366539 +39386431633363323735356230653465633433353937343566653331323334613032333831656432 +31336165633532383066663465306535643637306536646362306235366364643536663134643465 +66383965656133663161393138313963383436373630633761613839383136393865323438333833 +39366166663834633737316666303661653132336563343334373333386261353030343562346536 +31333662663834366466373834646430393964613866336162393162313135373335303533326265 +36373766653865313566643030326633363136323639366238366634626632333836323764363235 +31316531626335333932643164323066303233343233303063316532313236303639323432366463 +64386537666162636134303161366266383639396134333165663231623965386137343662333861 +36343331346361663331646161323331656164363737386336393136343532626661303965333763 +31663731646462356338363664303937316138666337313036643836626631343430363234326430 +39626363633962633138306135636238373230613030323238353264633239383933333666643866 +38656135613035616366346431323934396237623237656561313739616163366138393437333439 +37313732323934636236316533393064316433643232653338633665376565633933623861666335 +61636363613539376337383835623834383164336163393465623861653336313934373539613933 +66306435396163336233363934653263353662396534636537613062393462643932326561313364 +64353232653731636639303938626435656535333935353865386238333464313333646132643039 +33326336643863393835643738323739636139366635343366663335623432333564663661613962 +38336133636532343431353430333466656638316563613764656438316532393234663235396434 +35346133396263653364393038613936373835396430663861333036353639326636616362333030 +65663832353061336665376432353436626332333931303666636464666564336437313434646333 +65303533653832386236633239306263343064393935616238616435346634333063623765336366 +34373161303536666132626531663162633636393436363062613539613337353232363934303735 +34353830616137383237373465313034383663336234303361343432613064663662363438666164 +30636464616262383234396364306638386433643539303066376135633466336135343565383662 +39303166646330393931343066323662633233353637373464626263666337613139393961653761 +64303231353535656438363363393735363066363738316163373331353334313438363564633535 +63323539383637353935653334383637613433353166333630383366616661613366346233666466 +38643332326639633335626365653736646163653063306362356430323031383137366564376165 +66303963323761653364363564653637653032613739396130646166363539363463666130626631 +34613165303261323133303336613837383862663362343533343839313362323334303238633238 +31306664343032383365393035346331646636663663623263643863636233356235323332656339 +39356636386134396561323865363536613764633861323238336531326331616239386530663464 +33336131653936636434636563653538616536316335643636376134343131613665636532326566 +39363436336638393963343637393133613831636364653363613737316636626133333238646362 +36313264353335666461353135376435346161376138623639663337626337376236346230333330 +62353563343335656632393938363363363936643765383063363935383266353037353562363833 +64633661353564333064616264653130646133303662373630396638373833333763306638653661 +34393430353236303465636335383733656162343139613765663732353837313365323466386664 +35323464626663333866376138396132333039313962356439303838373835653837643364363339 +62303062663931646232643234666132363239373035633262623135633531636330373065333435 +36393163393638613663353133666632353639653064353139363134383764666530623834326531 +32653931316539666539656565313462396535346439393534313139393735633437333935396466 +35316165363839396562613130623964626531373337343166656630666638363039376162396336 +30373730353231663534316333336538366661363332316531653334383635356133393266666232 +35366337653131376131396232323332623063626135333630346564343663326532616263333262 +66613436396337353636643866353562366231333933353465306461376138333564656562646261 +66303263356565656431353064343361396131323134323234316230363761373362663234633735 +35663365376264343763333731393363336231366534393933333536356437653837303832646339 +66376262616634376438613864323665356539376139396130376661613930393131363465313063 +333664323830636666653933303034333630 diff --git a/roles/matrix-appservice-discord/templates/config.yaml.j2 b/roles/matrix-appservice-discord/templates/config.yaml.j2 index 9974565..7971fb0 100644 --- a/roles/matrix-appservice-discord/templates/config.yaml.j2 +++ b/roles/matrix-appservice-discord/templates/config.yaml.j2 @@ -5,7 +5,7 @@ bridge: domain: "auro.re" # This should be your publically facing URL because Discord may use it to # fetch media from the media store. - homeserverUrl: "https://auro.re" + homeserverUrl: "http://auro.re" # Interval at which to process users in the 'presence queue'. If you have # 5 users, one user will be processed every 500 milliseconds according to the # value below. This has a minimum value of 250. @@ -21,14 +21,14 @@ bridge: disableDeletionForwarding: false # Enable users to bridge rooms using !discord commands. See # https://t2bot.io/discord for instructions. - enableSelfServiceBridging: false + enableSelfServiceBridging: true # Disable sending of read receipts for Matrix events which have been # successfully bridged to Discord. disableReadReceipts: false # Authentication configuration for the discord bot. auth: - clientID: "12345" - botToken: "foobar" + clientID: "{{ matrix_discord_client_id }}" + botToken: "{{ matrix_discord_bot_token }}" logging: # What level should the logger output to the console at. console: "warn" #silly, verbose, info, http, warn, error, silent @@ -58,7 +58,7 @@ room: channel: # Pattern of the name given to bridged rooms. # Can use :guild for the guild name and :name for the channel name. - namePattern: "[Discord] :guild :name" + namePattern: ":name :guild" # Changes made to rooms when a channel is deleted. deleteOptions: # Prefix the room name with a string. @@ -68,11 +68,11 @@ channel: # Disable people from talking in the room by raising the event PL to 50 disableMessaging: false # Remove the discord alias from the room. - unsetRoomAlias: true + unsetRoomAlias: false # Remove the room from the directory. - unlistFromDirectory: true + unlistFromDirectory: false # Set the room to be unavaliable for joining without an invite. - setInviteOnly: true + setInviteOnly: false # Make all the discord users leave the room. ghostsLeave: true limits: diff --git a/roles/matrix-appservice-discord/templates/systemd/matrix-appservice-discord.service.j2 b/roles/matrix-appservice-discord/templates/systemd/matrix-appservice-discord.service.j2 index afc1b4b..be11020 100644 --- a/roles/matrix-appservice-discord/templates/systemd/matrix-appservice-discord.service.j2 +++ b/roles/matrix-appservice-discord/templates/systemd/matrix-appservice-discord.service.j2 @@ -11,7 +11,7 @@ User=matrix-appservice-discord Group=matrix-appservice-discord WorkingDirectory=/var/local/matrix-appservice-discord/matrix-appservice-discord Environment="NODE_ENV=production" -ExecStart=/usr/bin/nodejs /var/local/matrix-appservice-discord/matrix-appservice-discord/app.js +ExecStart=/usr/bin/nodejs ./build/src/discordas.js -p 9005 -c config.yaml Restart=always [Install] diff --git a/roles/nginx-reverse-proxy/templates/nginx/nginx-sites-available-main.j2 b/roles/nginx-reverse-proxy/templates/nginx/nginx-sites-available-main.j2 index 1df30fd..ddb8bc3 100644 --- a/roles/nginx-reverse-proxy/templates/nginx/nginx-sites-available-main.j2 +++ b/roles/nginx-reverse-proxy/templates/nginx/nginx-sites-available-main.j2 @@ -8,7 +8,15 @@ server { server_name auro.re; # Permanentely moved to HTTPS - return 301 https://$host$request_uri; + location / { + return 301 https://$host$request_uri; + } + + # For Matrix Synapse Discord Appservice Media + location /_matrix { + proxy_pass http://synapse.adm.auro.re:8008; + proxy_set_header X-Forwarded-For $remote_addr; + } } server {