Disable WebRTC exposure of your private IP address in Firefox
- Linux onlyThis script improves your privacy on Linux
- Single actionThis page belongs to a script, containing basic changes to achieve a task.
- Impact: Minimum
System Functionality / Data Loss Risk: Low
This action improves privacy with minimal impact when you run the recommended script.
- Bash (Shell script)These changes use Linux system commands to update your settings.
- Sudo/root requiredThis script requires privilege access to do the system changes
- Fully reversible
You can fully restore this action (revert back to the original behavior) using this website.
The restore/revert methods provided here can help you fix issues.
Overview
Websites can obtain your local IP address through WebRTC's peer-to-peer protocol, facilitated by JavaScript 1.
WebRTC (Web Real-Time Communication) is a free and open-source project offering real-time communication (RTC) via application programming interfaces (APIs) to web browsers and mobile applications 2. It enables audio and video communication to work inside web pages by facilitating direct peer-to-peer communication, and thereby eliminating the need for plugin installations or native app downloads 3. Supported by Apple, Google, Microsoft, Mozilla, and Opera, WebRTC's specifications have been published by the World Wide Web Consortium (W3C) and the Internet Engineering Task Force (IETF) 2.
Sources
- WebRTC exposes LAN IP address. Firefox/Privacy - ArchWiki. wiki.archlinux.org. (2022).
Original: https://wiki.archlinux.org/title/Firefox/Privacy
Archived: https://web.archive.org/web/20221025162743/https://wiki.archlinux.org/title/Firefox/Privacy#WebRTC_exposes_LAN_IP_address - WebRTC - Wikipedia. en.wikipedia.org. (2022).
Original: https://en.wikipedia.org/wiki/WebRTC
Archived: https://web.archive.org/web/20221029173118/https://en.wikipedia.org/wiki/WebRTC - How WebRTC Is Revolutionizing Telephony. blogs.trilogy-lte.com. (2022).
Original: https://blogs.trilogy-lte.com/post/77427158750/how-webrtc-is-revolutionizing-telephony
Archived: https://web.archive.org/web/20221029173306/https://blogs.trilogy-lte.com/post/77427158750/how-webrtc-is-revolutionizing-telephony
Apply Now
Choose one of three ways to apply:
Help
How to apply or restore "Disable WebRTC exposure of your private IP address in Firefox" using script
- ≈ 3 min to complete
- Tools: Web Browser
- Difficulty: Medium
- ≈ 5 instructions
- 1
Download
Download the script file by clicking on thebutton above.
Use button above to restore changes. - 2
Keep the file
If warned by your browser, keep the file. - 3
Open
Open the downloaded file. - 4
Exit
Once it's done, press any key to exit the window. - 5
Restart
Restart your computer for all changes to take effect.
Apply with privacy.sexy
Guided, automated application with safety checks- Recommended for most users
- Includes safety checks
- Free
- Open-source
- Popular
- Offline/Online usage
Help
How to apply or restore "Disable WebRTC exposure of your private IP address in Firefox" using privacy.sexy
- ≈ 3 min to complete
- Tools: privacy.sexy
- Difficulty: Simple
- ≈ 4 instructions
- 2
Choose script
- Search for the script name: Disable WebRTC exposure of your private IP address in Firefox
- Check the script by clicking on the checkbox.
- 3
Run
Click on ▶️ Run button at the bottom of the page.This button only appears on desktop version (recommended). On browser, use 💾 Save button.
- Apply
- Revert
pref_name='media.peerconnection.ice.default_address_only'
pref_value='true'
echo "Setting preference \"$pref_name\" to \"$pref_value\"."
declare -a profile_paths=(
~/.mozilla/firefox/*/
~/.var/app/org.mozilla.firefox/.mozilla/firefox/*/
~/snap/firefox/common/.mozilla/firefox/*/
)
declare -i total_profiles_found=0
for profile_dir in "${profile_paths[@]}"; do
if [ ! -d "$profile_dir" ]; then
continue
fi
if [[ ! "$(basename "$profile_dir")" =~ ^[a-z0-9]{8}\..+ ]]; then
continue # Not a profile folder
fi
((total_profiles_found++))
user_js_file="${profile_dir}user.js"
echo "$user_js_file:"
if [ ! -f "$user_js_file" ]; then
touch "$user_js_file"
echo $'\t''Created new user.js file'
fi
pref_start="user_pref(\"$pref_name\","
pref_line="user_pref(\"$pref_name\", $pref_value);"
if ! grep --quiet "^$pref_start" "${user_js_file}"; then
echo -n $'\n'"$pref_line" >> "$user_js_file"
echo $'\t'"Successfully added a new preference in $user_js_file."
elif grep --quiet "^$pref_line$" "$user_js_file"; then
echo $'\t'"Skipping, preference is already set as expected in $user_js_file."
else
sed --in-place "/^$pref_start/c\\$pref_line" "$user_js_file"
echo $'\t'"Successfully replaced the existing incorrect preference in $user_js_file."
fi
done
if [ "$total_profiles_found" -eq 0 ]; then
echo 'No profile folders are found, no changes are made.'
else
echo "Successfully verified prefer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FjZTpdXScgXCIkY29uZmlnX2ZpbGVfcGF0aFwiOyB0aGVuXG4gICAgICAgIHJtIFwiJGNvbmZpZ19maWxlX3BhdGhcIlxuICAgICAgICBlY2hvICQnXFx0J1wiUmVtb3ZlZCB0aGUgZmlsZSBhcyBpdCBiZWNhbWUgZW1wdHkuXCJcbiAgICAgIGZpXG4gICAgZWxzZVxuICAgICAgZWNobyAkJ1xcdCcnU2tpcHBpbmcsIHRoZSBwcmVmZXJlbmNlIGhhcyB2YWx1ZSB0aGF0IGlzIG5vdCBjb25maWd1cmVkIGJ5IHByaXZhY3kuc2V4eS4nXG4gICAgZmlcbiAgZG9uZVxuZG9uZVxuaWYgWyBcIiR0b3RhbF9wcm9maWxlc19mb3VuZFwiIC1lcSAwIF07IHRoZW5cbiAgZWNobyAnTm8gcmV2ZXJzaW9uIHdhcyBuZWNlc3NhcnkuJ1xuZWxzZVxuICBlY2hvIFwiU3VjY2Vzc2Z1bGx5IHZlcmlmaWVkIHByZWZlcmVuY2VzIGluICR0b3RhbF9wcm9maWxlc19mb3VuZCBwcm9maWxlcy5cIlxuZmki
Help
How to apply or restore "Disable WebRTC exposure of your private IP address in Firefox" using commands
- ≈ 2 min to complete
- Tools: Terminal
- Difficulty: Medium
- ≈ 3 instructions
- 1
Open terminal
Open your terminal application. - 2
Copy code
Copy the code: - 3
Paste & run
Paste the commands into terminal application and press Enter to run.Some changes require a system restart to take effect
Similar Guides
Wider Goal
Guides below includes this guide to achieve a wider goal.See other more general settings that includes this one as one of its actions.
These plans combine multiple privacy settings, including this one, for stronger protection.
- Harden Firefox privacy
- Configure Firefox
- Configure programs
The following are privacy-focused tweaks to prevent browser fingerprinting and tracking. See also: What is browser fingerprinting? | AmIUnique.org
Mozilla Firefox, colloquially known as Firefox, is a free and open-source web browser created by the Mozilla Foundation and its subsidiary, the Mozilla Corporation...
These scripts configure third-party applications installed on Linux distributions to harden their security and privacy to protect your data. They scripts differ fr...
Same Goal
Other guides in Harden Firefox privacySee settings that are in the same category as this guide.
Using other actions in the same category may help you achieve your goal better.
About the Creators
These people have authored this documentation and written its scripts:
Reviewed By
This guide has undergone comprehensive auditing and peer review:Expert review by undergroundwires
- Verified technical accuracy and editorial standards
- Assessed system impact and user privacy risks
Public review by large community
- Privacy enthusiasts and professionals peer-reviewed
- Millions of end-users tested across different environments
History
We continually monitor our guides, their impact and all other privacy options. We update our guides when new information becomes available. On every update, we publicly store who made the change, what has been changed, why the change was made and when the change was made.