关于将现有论坛迁移至 Discourse 的问题

大家好 :slight_smile:

我提前为这篇长文致歉,但或许熟悉 Discourse 的朋友能直接给出答案。

我共同运营一个兴趣论坛,该论坛设有版主。我们共有两人,另一位同事用 Ruby 编写了该软件。现有的论坛是完全定制的软件,其显著特点是比 PHP-BB 和 Vbulletin 等软件更简洁(而后者不断遭到黑客攻击)。数据库大小约为 40GB,包含 20 万条帖子。出于多种原因,我们正考虑将数据库迁移到其他平台,Discourse 看起来是个不错的选择。

初步测试表明,其整体功能相当不错,例如支持嵌入图片和视频。甚至从安卓手机上传多张图片也能正常工作!

不过,我们需要一些自定义功能;主要是简化用户界面。以下示例按重要性排序不分先后:

  1. 不显示用户的总发帖数——这是为了防止新成员感到 intimidated(受挫/畏惧)。

  2. 限制用户在一定时间后编辑其帖子(目前我们设置为 2 小时)——这是为了防止在该领域常见的某种 trolling(恶意捣乱)行为。

  3. 分类广告版块,并支持付费发布广告(PayPal)……我知道这并非易事,因为涉及定价结构配置、支付链接等。

  4. 在帖子日期中醒目地显示年份。

  5. 管理员能够访问某个用户,查看同一浏览器安装下还有哪些其他活跃用户(基本上就是基于 Cookie)。我看到 Discourse 已有此功能,但它是基于 IP 的,如今这已不太有效(许多人使用移动数据,尤其是那些试图运行多个身份的人)。我读过这个帖子:
    Handling trolls with multiple accounts over VPNs - #18 by ljpp
    以及其他相关讨论,显然许多人已走过这条路,但对于擅长使用 VPN 等的用户,目前尚无解决方案;他们最终往往会通过发帖风格暴露自己,或因发布极其恶劣的内容而被封禁。我还建议,检测相同的密码哈希值将是一大助力,因为许多人会为所有账号使用相同密码 :wink:

  6. 为管理员提供一个简单的线性帖子列表,以便在手机上快速浏览最近的 x 条帖子。我想这可以通过少量代码直接访问数据库,并在子域名上实现。在此列表中,应包含“删除”和“封禁”按钮,以便快速移除发布恶劣内容的人(不幸的是,这在论坛中并不罕见)。

  7. 这可能已存在:管理员将某个主题中选定(或全部)的帖子合并到另一个主题,并确保目标主题中的帖子按正确的时间顺序排列。我意识到这可能会破坏帖子链接,除非链接是站点唯一的(例如,使用数据库中的帖子编号,而非主题内的帖子编号)。

  8. 管理员生成一个 CSV 格式的邮件列表,包含过去 12 或 24 个月内登录过的所有用户。我们发现,向较老(更不活跃)的用户发送邮件会大大增加被列入黑名单(RBL 等)的风险,尽管我们的邮件发送(主要是关于每年几次的聚会)速度很慢,每分钟仅 1 封邮件,以尽量降低风险(我们也在邮件列表中屏蔽所有已知的临时邮箱地址,例如 sharklasers.com)。

  9. 在用户个人资料中设置一个选项,让用户选择是否接收这些邮件,以符合 GDPR 要求。

我刚刚阅读了这里关于 GDPR 的帖子。据我了解,在英国,发帖者无权要求删除其帖子。他可以要求删除登录凭据。我想知道 Discourse 在此方面是否在某些方面更容易受到攻击。在我们的论坛上,几乎每个人都使用昵称。

  1. 管理员有权阅读私信(PM)。这至关重要,因为许多垃圾邮件发送者注册后只发私信而不发帖。除非有人投诉,否则我们无法发现,但很多新注册账号都很可疑(尽管并非明显如此),因此我们会观察一段时间……例如,我们在用户个人资料中设置了“国家”字段,必须在注册时填写。如果某人填写的是德国,但 IP 地址来自泰国,那很可能有问题,但也可能是身在泰国的德国人!

  2. 用户位置的国家设置,在注册时强制填写(我意识到他们可以在那里随意填写)。

我意识到,如果对代码进行修改,应用更新可能会很困难甚至不可能……

可疑注册确实是个大问题。据我估计,目前 10-20% 的注册是可疑的,因此如果不采取行动,未来会出现很多问题。通常的行为是注册后等待一周,然后向论坛发送垃圾邮件。

不幸的是,我对 Ruby 一无所知。我学过一点点 PHP。我的 IT 专长更广泛:POP 和 SMTP 服务器、虚拟机、VPN、FTP、SPF、DKIM、路由器配置。简单的 HTML 但不懂 CSS……我以前的 IT 专长是嵌入式系统硬件和软件(汇编语言和 C 语言)。编写原始软件的那位同事愿意协助迁移数据库。我有一些联系人可以处理其他部分,但目前没有直接的 Ruby 专长……我在 Linode 服务器上运行着几个站点,运行非常可靠,因此那将是首选的托管方案。

提前感谢大家读完这篇长文,并希望能得到一些指点,了解其中有多少功能已经存在,以及完成其余部分需要多少工作量,或者是否有类似方案 :slight_smile:

Hi Peter!

there are people much more knowledgable than me, but I can try to answer at least some of them. :slight_smile:

  1. This seems like a trivial CSS fix, I am sure someone will help you here.
  2. I believe there is a site setting for this so it should be trivial.
  3. I guess you’ll need a separate post for this with more specific info and examples. You can try to search for plugins here, there are some that might do the job. but hard to say for sure.

Ad 6. Generally, Discourse relies on users flagging nasty post to help with moderation. You can set it up in a way that only one flag from a trusted user will hide the post. For your specific ask you might need a plugin.

Ad 7. This is not possible at this point I believe. Search around on meta, there are discussions about this.
Ad 8. Yep, you can easily export user data and then filter out based on “last seen” column

Ad. 10: Yep, out of the box. Admins can access everything.
Ad. 11: Yep, doable in site customization, the keyword is custom user fields, and you can enforce them at sign up.

1 个赞

Hey Peter :smiley:.

Already some good answers from Daniel, let me see if I can assist with the rest and/or provide more details.

  1. Definitely trival CSS. Just need to know where you are seeing this number (it may appear in more than one location) and we can help you hide it.
  2. Yep, this is a site setting. post edit time limit. Default is 60 days, 2 hours seems really short - I’d expect it to lead to lots of “oh by the way” or “edit” replies to one’s own post.
  3. Definitely need more details, but this sounds like plugin territory.
  4. You can customize the post timestamp to display year (instead of relative time since post), could also likely add the year separately via a theme-component or plugin.
  5. Check out GitHub - discourse/discourse-fingerprint: A plugin that computes user fingerprints to help administrators combat internet trolls. - not sure the status of the plugin though, @dan can likely share more.
  6. You can see all posts sorted by recency via RSS, but there is obviously no delete or suspend buttons there. We’ve found that context is key, and showing posts outside their topic can lead to mistakes. A seemingly innocuous post by itself may in fact be quite bad in context. A seemingly trolling post by itself may be a nice friendly joke in context.
    That said, you can build this via the API if you need to.
  7. You can merge posts from one topic to another, but it does not support reordering the topic - all merged posts are added to the end of the topic. Merging won’t completely break links - they won’t point directly to the post’s new location, but there’s a “x posts moved to …” post added to the topic where the posts were moved from, which can be clicked to jump to the new topic.
  8. Check out Discourse Data Explorer as well.
  9. Users have full control over emails they receive. By default (assuming no modified site settings), they’re emailed when mentioned, PM’d, directly replied to, or quoted. They’re also emailed when someone replies to a topic they started, and one email every 7 days when they haven’t logged into the site, up to a maximum of 52 “weekly digest” emails. Users can modify these preferences at any time, and all emails have an unsubscribe link. If you’re planning to email users from an external tool (say mailgun), you can add a custom user field (checkbox type) which users can use to indicate if they wish to receive emails.
  10. Yep.
  11. Yep.

Talking about dodgy signups - we don’t see too many dodgy signups as being a JavaScript application prevents most old-fashioned scrapers from being able to see the signup fields, let alone verify email.

5 个赞

Thank you Daniel.

I have been doing some testing with a sample site (running on a laptop :slight_smile: )

Regarding point 7) I see that post moving is supported but I see the original link does break. So the “share” link is not a unique link to the post. It just takes you into where the post was in the thread before the move.

We had this issue on the existing forum too (where I do a lot of thread merging, to keep the site informative). It was initially addressed by entirely removing the link to the post after the move… This proved to be a hassle in the long run; the only way you could get a link to such a post was by doing a search for some fairly unique string within it and then you could extract a link to it from the search results. Eventually it was solved using the cunning method of using the database post ID (a large number on a forum with 200k posts) as the link, and that works great while looking slightly odd. However if a forum used the database ID # from the start, it would work great.

Many thanks too Joshua. A real pity about the merging issue; that is a big thing on the original site.

Re point 6) I currently see the Section / Thread Name / post text, so the whole context is there. I know what you mean; you can’t tell what the post is a reply to because that post could be 50 posts down. But usually an offensive post is obviously offensive in a standalone manner. Especially if you see the poster’s name… I find that within the past 30 days about 200 people have posted and the rude ones run around the 2% mark. It is a bizzare observation that you could discharge the mod job by marking the other 98% invisible and just getting an RSS feed with the 2% :slight_smile: :slight_smile:

BTW I find that all the dodgy signups are clearly humans. They even fill in their profile intelligently in some cases, then come back a week later and drop the spam in :slight_smile: There is an army of them in India, Africa and similar places and they know how to do it. The majority are selling fake passports but we had one recently who was much more clever. He took a post from earlier in the thread and pasted it in (so producing a sensible looking post, which was actually a question). He then changed the question mark into a live link, which most people would not spot. But Chrome will prefetch all the links on a page… a nice attack vector! At that point we changed it so every signup is manually approved. Not a major workload on a forum of this size.

Discourse post links use the following form by default:

{scheme}://{hostname}/t/{topic-slug}/{topic-id}/{post-number-within-topic}

The topic-id is the most important, using an invalid topic-slug, or even skipping it will still work.

For example, for your post above, any of these would work:

https://meta.discourse.org/t/questions-about-moving-an-existing-forum-to-discourse/104948/4
https://meta.discourse.org/t/fake-slug-here/104948/4
https://meta.discourse.org/t/104948/4

You can link directly to a post, by using the following format (you will need to manually create such links, or use a plugin to help create them for you in the Share UI):

{scheme}://{hostname}/p/{post-id}

Again, for your post above:

https://meta.discourse.org/p/514248

You can obtain the post-id by looking at the json data for a given post: https://meta.discourse.org/t/questions-about-moving-an-existing-forum-to-discourse/104948/4.json


I disagree with you that the category, topic title, and post text are enough context in all cases. Some examples:

  • Topic started talking about “Favorite Pizza toppings”. Over time, the discussion has shifted to favorite restaurants somehow. If solely considering category, title, and post, a reply about a hamburger joint would seem spammy, or at least off topic. But by reviewing a few preceding replies you can see that the topic has simply digressed, not a specific user.
  • Topic started talking about “how to fix a flat tire”. Two users are going back and forth discussing how to do so. User B replies with the solution. User A realized he missed something obvious, and makes a self-deprecating remark. Without seeing the preceding replies, one may be quick to delete the post as inappropriate, even when it would be fine (and possibly even humorous if done nicely) within the topic.

Interesting to hear about the human spammers. Good news in the specific example you shared about profiles: we compile a list of all user who sign up, modify their profile, and don’t post. You can view the list of “suspect users” from your admin dashboard - and quickly delete them, optionally blocking the email and IP from further sign ups if you want.

Saw your edit: manual approval of new accounts is a simple setting change.

2 个赞

Joshua - indeed, I have been testing the post links. Only the x/y number is required. It is the same on ours. The issue is that moving the post to a different thread breaks that link.

The drawback with blocking people who create a profile but never post is that lots of genuine people do that (on our forum at least) because having a login gives you various privileges e.g. seeing new posts. I am aware one can achieve that with just cookies but I am told that presenting user-specific context without a login is regarded as bad practice these days (well, Amazon does it, to a certain level, so it must be good). We have ~3.5k signed up of which 1.5k have posted.

That fingerprint feature would be hugely controversial if it was discovered, which it will be very quickly if implemented with client-side keystroke timing i.e. javascript. And if you do the timing server-side (I apologise for lack of clarity / wrong terminology) then you break various browser features like spell checking, because each keystroke goes straight to the server separately.

Regarding the spam, you might find some interesting ideas in a relatively recent discussion here:

1 个赞

Yes; that tactic works because most forums don’t check posts except when originally posted. Edits are not checked :slight_smile:

Another tactic is to put something in your profile or your avatar. Those don’t get checked either, but they get picked up by google.

It’s all about getting SEO.

Lots of answers to your questions here. I think that the human spam is also mitigated by Akismet.

I have written several custom importers. You can see my notes about them here. It’s how I make my living, so it is largely about paying me to do the job, but also gives you some idea of what the issues are should you write the importer yourself.

1 个赞

We have decided to leave the migration for the time being. The requirement for post moving is quite important.

If this feature is sorted out one day, we would be happy to re-visit the project.

So I thank you all for your answers :slight_smile:

You definitely want to run the Akismet plugin, however, as there are a large number of 100% human spammers running around out there today. Big increase in human spam numbers over the last 10 years.

Slightly off topic; should Discourse admins have access to member PMs (P emphasized for obvious reasons)?

The answer to whether or not Admins should have access to Personal Messages was answered in the OP (# 10) - spammers

Admins on every forum need full access, for many reasons. Legal (e.g. member harassment by another member), spam management (e.g. many spammers join up and just send out lots of PMs without ever posting), subversion (disgruntled posters sometimes embark on a background mailing campaign to trash the site, spread allegations about the admins, etc), covert advertising (a real person joins up and sends out loads of PMs to promote his forum related business)… Any forum gets some mixture of this stuff… unfortunately, in addition to spammers, there are several % of people who cause trouble. In reality I am sure most forum admins never look at this stuff routinely (I certainly don’t) because they have better things to do, but you want there to be triggers e.g. more than 10 PMs sent within a day, within an hour, whatever.

Ultimately absolutely everything you do on some website is visible to whoever has admin access to the server.

The only Q is what access moderators have, and on most small sites they are the same person(s). This then leads to the topic of renegade mods (of which I have seen many examples, having been on forums since the internet got going, Compu$erve onwards :slight_smile: ) and this is a real problem. If you have a large site and have to appoint a load of mods, this policy needs to be done carefully because a renegade mod can do tremendous damage.

I have another Q on Discourse: is there a feature or a plug-in which can implement a question/answer session at signup time? For example if running a space flight related forum, you may want to put in some multiple choice question about the order of the planets’ distances from the sun, to keep the less intelligent spammers from signing up.

1 个赞

This plugin is ready for production and it did in fact run on a well-known Discourse for some time, but it was not a “toxic” community that would return lots of results. From what I can remember, there was a problem with Apple devices, as there is not much diversity when it comes to those and Safari does not leak very much info either. So, please take the results with a grain of salt.

If you decide to use it, please let me know. I would be very interested in seeing how it works in a real-world situation.

That is something I definitely do not recommend. It would decrease the overall security strength of the authentication system.

4 个赞

Presumably because you would need to have an indexed database of the hashes, which is yet another thing that can be hacked?

How come Safari doesn’t leak enough info? I know nothing about this topic but AIUI the only way to do keyboard fingerprinting is to time the keystrokes somehow, with millisecond resolution. But didn’t browsers do something very recently on the timing front, to block the Kaiser / Meltdown exploit which of necessity relies on accurate timing?

As regards other means of user fingerprinting, there is a ton of methods. There was one website (which now escapes me) which you went to and it produced a breakdown of all it can see about you, e.g. browser type, screen pixel size, java version, about 20 other things. It then calculated how unique the ID is (based on e.g. how many Chrome v41.5.6 users were running a specifies combination of plugins etc etc). And it very quickly got to c. 99.99%. So even if someone clears their cookies on every visit, they are still about 99.99% identifiable… well for a while until their browser gets an update etc. But the server then has to keep all that stuff in the logfiles and index it all up; I am sure most forums don’t bother.

And all someone needs to do to defeat all that is to use a different client device on a mobile IP. I have just had someone create their 4th character this way (he didn’t last long because he started posting his usual trolls). Or if they want to do it all from their home PC, they just need to run a throwaway browser instance in a VM and going out via a VPN terminating in the Peoples’ Republic of Cameroon (yes this is a real example too :slight_smile: ). I’ve seen one chap (who created about 10 identities) use the TOR browser, but his alter egos were a dead giveaway because who would be browsing a special interest (technology related) using such a heavy duty method intended for illegal activities, and whose IP really does map to various African countries?

We had one guy who ran two characters, one polite and one who posted rude stuff, including one post which IMHO would have resulted in a police visit (to us), but in hindsight he would have been detectable simply on cookies. I think cookies are a powerful enough method, and throw in the IP for good measure.

Regarding the user’s post count, it was something I recall seeing when testing the sample installation. If it is not shown, I apologise!

Would a CSS change really suppress it? I ask that because I recall one forum I used to visit years ago (another technology one) which had a “print thread” feature (actually printing threads is where most forums, along with most other websites, fail miserably, but I suppose not many people print nowadays… although one may want to print to a PDF) and when you used that feature, every user’s email address would appear for about 100ms :slight_smile: Someone malicious could have written a spider which grabbed the stuff, for whatever dodgy purpose.

Had Discourse had proper functionality for moving posts from one thread to another, with links to posts retained (which AFAICS requires the link to be the unique post ID # from the database, or some long hash of something) we would have probably bitten the bullet and gone ahead with the move.

There are only about ten kinds of iPhone, and they are all identical. Thus, no useful device fingerprinting.

As for timing, the browsers clamp you to about 2ms. That’s still plenty of accuracy for user behavior fingerprinting; you need microsecond-accurate timing to do Spectre.

Let’s not be fallacious here. There are two types of sockpuppets you know about; the ones that do the tech solid, but flub the character, and the ones who do the character solid, but flub the tech. You don’t know about the ones that do both correctly. They’re not “trolls”, per se, since the whole point of trolling is to post flame bait, so you will eventually identify the tree by its fruit. But astroturfing, things like fake product reviews and subtler SEO spam, those are the worse part.

No, obviously CSS won’t prevent the post count from showing up in the API and the DOM. But there’s really no point in trying to hide the post count; unlike the email address, which you actually might have a prayer of keeping secret, the post count can by definition be mined by Mallory just scraping your entire forum and counting the posts herself.

4 个赞

Reminder that this is not possible on Discourse, as new users cannot PM until they have reached trust level 1.

We have global rate limits on topic creation and PMs, there is also a limit on how long PMs can get. But you are right, there should be good visibility into anomalous PM patterns by TL1 users.

4 个赞

You don’t know about the ones that do both correctly.

That’s true, but do you care? Anyone who can pull off both is quite clever and by definition making a good contribution to the forum :slight_smile:

Most forums would be happy to have Vlad the Impaler posting, provided he was polite and on-topic, etc :slight_smile:

1 个赞

Side note, highlight text, click quote.

4 个赞