[GH-ISSUE #6210] 127.0.0.1 should reference localhost, not the hostname #3223

Open
opened 2026-05-05 09:50:08 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @intereglementet on GitHub (Feb 16, 2024).
Original GitHub issue: https://github.com/netblue30/firejail/issues/6210

/etc/hosts files typically contain something like this:

127.0.1.1 my-hostname
127.0.0.1 localhost

This makes the following feature typically do away with the localhost entry, and you end up with two hostname entries.

f7e2c25730/src/firejail/fs_hostname.c (L104)

This causes problems for applications referencing localhost. The above line should, I think, instead look for 127.0.1.1.

A workaround is to have two localhost entries in the original file, as only one 127.0.0.1 entry is processed.

Originally created by @intereglementet on GitHub (Feb 16, 2024). Original GitHub issue: https://github.com/netblue30/firejail/issues/6210 /etc/hosts files typically contain something like this: > 127.0.1.1 my-hostname > 127.0.0.1 localhost This makes the following feature typically do away with the localhost entry, and you end up with two hostname entries. https://github.com/netblue30/firejail/blob/f7e2c257306b1f9221b45d34f5620d175b5da192/src/firejail/fs_hostname.c#L104 This causes problems for applications referencing localhost. The above line should, I think, instead look for 127.0.1.1. A workaround is to have two localhost entries in the original file, as only one 127.0.0.1 entry is processed.
gitea-mirror added the
networking
label 2026-05-05 09:50:08 -06:00
Author
Owner

@intereglementet commented on GitHub (Feb 29, 2024):

I did some additional googling. The conclusion is that having 127.0.0.1 alterered and set to anything other than "localhost" is, unfortunately, plain wrong.
The thing with 127.0.1.1 being set to whatever /etc/hostname contains appears to be a de facto standard introduced into debian almost 20 years ago.

<!-- gh-comment-id:1970828334 --> @intereglementet commented on GitHub (Feb 29, 2024): I did some additional googling. The conclusion is that having 127.0.0.1 alterered and set to anything other than "localhost" is, unfortunately, plain wrong. The thing with 127.0.1.1 being set to whatever /etc/hostname contains appears to be a de facto standard introduced into debian almost 20 years ago.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#3223
No description provided.