hosting forgejo publicly
from arschflugkoerper@feddit.org to selfhosted@lemmy.world on 28 Mar 12:45
https://feddit.org/post/27737072
from arschflugkoerper@feddit.org to selfhosted@lemmy.world on 28 Mar 12:45
https://feddit.org/post/27737072
I am experimenting with using forgejo instead of GitHub for my personal projects. So far I like it, however I would like to make it available to the outside world at some point.
I was wondering what kind of traps I should avoid. The following things come to mind so far:
- Forgejo Actions seem like a massive potential security risk, however I do not intend to enable sign up for other
- OpenID appears to be a thing for forgejo, I do not know how it works and it seems like it would allow access to my instance even with registering disabled
- I would put the instance behind a nginx as reverse proxy, but how do you keep bot traffic to a minimum? Anubis?
I feel like there are a ton of things I have not thought of, which is why I am holding off on making anything available without a VPN so far.
threaded - newest
Yes, Check Anubis, scraper bots follow every link they find and especially git forges basically have infinite links (every single commit and comparison between every single commit and every other).
I haven’t thought it through but there may be some implications on opening port 22 for git via ssh.
Someone posted about git/scrapers here, pretty good read: vulpinecitrus.info/…/guarding-git-forge-ai-scrape…
If it’s just you, and you’re fine with the regular login… Just disable signup and don’t add more authentication mechanisms like oauth/openID.
I’m using nginx as a reverse proxy as well. For now, I added a lot of “deny” directives to ban all the address ranges from Tencent, Alibaba, OpenAI. It’s not a 100% solution, but works well enough for me. I’m mostly worried about AI crawlers causing too much load on my server. And it stopped since, so I don’t think I’m gonna need Anubis and all these extra things in front if my applications. If you like you can look into solutions like a web application firewall like Crowdsec.
You can use Forgejo with OIDC or normal login behind a reverse proxy. If you want to make a repo public, you need to add this to your App.ini under the
[service]section:REQUIRE_SIGNIN_VIEW = falseExample:
Then you can create a public repo which people can view without an account. You can change visibilty at any time
Yes, this has been configured already, thanks for the suggestion.
I definitely want to use forgejo actions, but I am mainly worried about random people being able to execute any code on them. Preferably only approved users can do that.
I run a forgejo server on the internet for myself so here’s my two cents.
OpenID or any other log in method is just a way to log in to an account on the forgejo server. With registrations disabled it shouldn’t be able to create an account, so there should be no issue. All the extra auth methods also need to be configured and are disabled by default.
Bot traffic can be pretty horrendous once they find your server, I’d say Anubis is basically a requirement at this point. I would also strongly recommend setting up fail2ban for http and ssh, and disabling ssh password auth.
Ah I see, I kinda assumed that OpenID would allow anyone with an OpenID server to just log in. That seemed like it would cause immediate spam issues. It would definitely be nice if I could allow users to create issues or stuff like that at some point. I will definitely have to take a look at fail2ban before I make it available. Thank you.
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:
[Thread #195 for this comm, first seen 28th Mar 2026, 14:10] [FAQ] [Full list] [Contact] [Source code]
Do you need to host it yourself? Codeberg is free, and they handle these concerns for you.
But yes, you will need to secure it against hackers and scrapers. Keep user permissions to a minimum, if you allow people to create accounts at all. And run it in a dmz network, so that in case it’s compromised they can’t access the rest of your LAN.
I learned yesterday that Codeberg is only free for open-source projects, not closed-source. I believe there are other Forgejo instances that accept closed-source projects though
I don’t need to, but I want to :D
Lots of good answers already. Just want to add.
Block IP from every country that doesn’t have your users in it. That will go a long way.