-
Notifications
You must be signed in to change notification settings - Fork 73
Optionally disable remote access #3269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2eae26d
Better env test
lslezak 161a6c9
Handle the "inst.listen_on=" boot option
lslezak 7f8fe4c
Allow multiple `--address` option
lslezak 3b5f9af
agama-web-server: keep working even if IPv6 is not available
mvidner 5898811
Add IPv4 fallbacks
lslezak ec92a10
Fixes, docu update
lslezak fb58f5c
Handle IPv6 link local addresses
lslezak 5375f45
Allow multiple interfaces
lslezak 73678fc
Fixed iteration
lslezak d6a1cad
Changes
lslezak dd9c65f
Merge remote-tracking branch 'origin/master' into disable-remote-access
lslezak db4907a
Update rust/agama-server/src/agama-web-server.rs
lslezak 06cd059
Update rust/WEB-SERVER.md
lslezak e44a6a9
Update rust/package/agama.changes
lslezak fa80638
Add -h/--help option
lslezak 5cc4f0f
Fixed comment
lslezak dbe9f31
Merge remote-tracking branch 'origin/master' into disable-remote-access
lslezak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| #!/usr/bin/bash | ||
| # | ||
| # Copyright (c) [2026] SUSE LLC | ||
| # | ||
| # All Rights Reserved. | ||
| # | ||
| # This program is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU General Public License as published by the Free | ||
| # Software Foundation; either version 2 of the License, or (at your option) | ||
| # any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, but WITHOUT | ||
| # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| # more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License along | ||
| # with this program; if not, contact SUSE LLC. | ||
| # | ||
| # To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| # find current contact information at www.suse.com. | ||
|
|
||
| # This script is a wrapper for the Agama web server, it evaluates to which | ||
lslezak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # addresses the server should listen to. | ||
|
|
||
| if [[ "$1" == "-h" || "$1" == "--help" ]]; then | ||
| echo "Usage: $0" | ||
| echo | ||
| echo " This is a wrapper script for the Agama web server (agama-web-server)." | ||
| echo | ||
| echo " It configures the listening addresses for the web server based on" | ||
| echo " the \"inst.listen_on\" boot option." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # the default options: listen on all interfaces for both HTTP and HTTPS ports, | ||
| # the IPv4 addresses are fallbacks when IPv6 is disabled with the | ||
| # "ipv6.disable=1" kernel boot option | ||
| DEFAULT_OPTIONS=(--address ":::80,0.0.0.0:80" --address ":::443,0.0.0.0:443") | ||
| # options for localhost access only | ||
| LOCAL_OPTIONS=(--address "::1:80,127.0.0.1:80" --address "::1:443,127.0.0.1:443") | ||
|
|
||
| # check if the "inst.listen_on=" boot option was used | ||
| if grep -q "\binst.listen_on=.\+" /run/agama/cmdline.d/agama.conf; then | ||
| LISTEN_ON=$(grep "\binst.listen_on=.\+" /run/agama/cmdline.d/agama.conf | sed 's/.*\binst.listen_on=\([^[:space:]]\+\)/\1/') | ||
|
|
||
| if [ "$LISTEN_ON" = "localhost" ]; then | ||
| OPTIONS=("${LOCAL_OPTIONS[@]}") | ||
| elif [ "$LISTEN_ON" = "all" ]; then | ||
| OPTIONS=("${DEFAULT_OPTIONS[@]}") | ||
| else | ||
| # always run on the localhost | ||
| OPTIONS=("${LOCAL_OPTIONS[@]}") | ||
|
|
||
| # the string can contain multiple addresses separated by comma, | ||
| # replace commas with spaces and iterate over items | ||
| ADDRESSES=${LISTEN_ON//,/ } | ||
| for ADDRESS in $ADDRESSES; do | ||
| # check if the value is an IP address (IPv6, IPv6 link local or IPv4) | ||
| if echo "$ADDRESS" | grep -qE '^[0-9a-fA-F:]+$|^[fF][eE]80|^([0-9]{1,3}\.){3}[0-9]{1,3}$'; then | ||
| echo "<5>Listening on IP address ${ADDRESS}" | ||
| OPTIONS+=(--address "${ADDRESS}:80" --address "${ADDRESS}:443") | ||
| else | ||
| # otherwise assume it is as an interface name | ||
| if ip addr show dev "${ADDRESS}" >/dev/null 2>&1; then | ||
| # find the IP address for the specified interface | ||
| IP_ADDRS=$(ip -o addr show dev "${ADDRESS}" | awk '{print $4}' | cut -d/ -f1) | ||
| if [ -n "${IP_ADDRS}" ]; then | ||
| for IP in $IP_ADDRS; do | ||
| # append the %device for link local IPv6 addresses | ||
| if [[ "$IP" == fe80* ]]; then | ||
| IP="${IP}%${ADDRESS}" | ||
| fi | ||
| echo "<5>Listening on interface ${ADDRESS} with IP address ${IP}" | ||
| OPTIONS+=(--address "${IP}:80" --address "${IP}:443") | ||
| done | ||
| else | ||
| echo "<3>IP address for interface ${ADDRESS} not found" | ||
| fi | ||
| else | ||
| echo "<3>Network Interface ${ADDRESS} not found" | ||
| fi | ||
| fi | ||
| done | ||
| fi | ||
| else | ||
| OPTIONS=("${DEFAULT_OPTIONS[@]}") | ||
| fi | ||
|
|
||
| if [ "${OPTIONS[*]}" = "${DEFAULT_OPTIONS[*]}" ]; then | ||
| echo "<5>Listening on all network interfaces" | ||
| elif [ "${OPTIONS[*]}" = "${LOCAL_OPTIONS[*]}" ]; then | ||
| echo "<5>Disabling remote access to the Agama web server" | ||
| fi | ||
|
|
||
| echo "<5>Starting Agama web server with options: ${OPTIONS[*]}" | ||
| exec /usr/bin/agama-web-server serve "${OPTIONS[@]}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -597,8 +597,7 @@ impl Zypp { | |
| // save the solver testcase if the solver run failed or if saving is forced via boot | ||
| // parameter, skip when "ZYPP_FULLLOG=1", in that case libzypp creates the solver | ||
| // testcase automatically in the /var/log/YaST2/autoTestcase/ directory | ||
| if (!r_res || save_testcase) && std::env::var("ZYPP_FULLLOG").unwrap_or_default() != "1" | ||
| { | ||
| if (!r_res || save_testcase) && !std::env::var("ZYPP_FULLLOG").is_ok_and(|v| v == "1") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this from a different PR?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, related to #3259, I was just lazy to open a separate PR for this trivial one-liner... |
||
| self.create_solver_testcase(); | ||
| } else { | ||
| // delete the solver testcase directory, it contains the previous error which is | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.