-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #502 from uyuni-project/Uyuni-2024.10
Uyuni 2024.10 patch
- Loading branch information
Showing
12 changed files
with
151 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1 +1 @@ | ||
5.1.1-0 ./ | ||
5.1.2-0 ./ |
This file contains 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 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 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 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 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 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 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 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,31 @@ | ||
// SPDX-FileCopyrightText: 2024 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package api | ||
|
||
import "testing" | ||
|
||
func TestRedactHeaders(t *testing.T) { | ||
data := [][]string{ | ||
{ | ||
`"JSESSIONID=supersecret; Path=/; Secure; HttpOnly; HttpOnly;HttpOnly;Secure"`, | ||
`"JSESSIONID=<REDACTED>; Path=/; Secure; HttpOnly; HttpOnly;HttpOnly;Secure"`, | ||
}, | ||
{ | ||
`"pxt-session-cookie=supersecret; Max-Age=0;"`, | ||
`"pxt-session-cookie=<REDACTED>; Max-Age=0;"`, | ||
}, | ||
} | ||
|
||
for i, testCase := range data { | ||
input := testCase[0] | ||
expected := testCase[1] | ||
|
||
actual := redactHeaders(input) | ||
|
||
if actual != expected { | ||
t.Errorf("Testcase %d: Expected %s got %s when redacting %s", i, expected, actual, input) | ||
} | ||
} | ||
} |
This file contains 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,76 @@ | ||
// SPDX-FileCopyrightText: 2024 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package podman | ||
|
||
import ( | ||
"os" | ||
"path" | ||
"strings" | ||
|
||
"github.com/rs/zerolog/log" | ||
. "github.com/uyuni-project/uyuni-tools/shared/l10n" | ||
"github.com/uyuni-project/uyuni-tools/shared/utils" | ||
) | ||
|
||
const ( | ||
//DbUserSecret is the name of the podman secret containing the database username. | ||
DbUserSecret = "uyuni-db-user" | ||
//DbUserSecret is the name of the podman secret containing the database password. | ||
DbPassSecret = "uyuni-db-pass" | ||
) | ||
|
||
// CreateDbSecrets creates the podman secrets for the database credentials. | ||
func CreateDbSecrets(user string, password string) error { | ||
if err := createSecret(DbUserSecret, user); err != nil { | ||
return err | ||
} | ||
return createSecret(DbPassSecret, password) | ||
} | ||
|
||
// createSecret creates a podman secret. | ||
func createSecret(name string, value string) error { | ||
if hasSecret(name) { | ||
return nil | ||
} | ||
|
||
tmpDir, err := utils.TempDir() | ||
Check failure on line 38 in shared/podman/secret.go GitHub Actions / lint
Check failure on line 38 in shared/podman/secret.go GitHub Actions / lint
|
||
if err != nil { | ||
return err | ||
} | ||
defer os.RemoveAll(tmpDir) | ||
|
||
secretFile := path.Join(tmpDir, "secret") | ||
if err := os.WriteFile(secretFile, []byte(value), 600); err != nil { | ||
return utils.Errorf(err, L("failed to write %s secret to file"), name) | ||
} | ||
|
||
if err := utils.RunCmd("podman", "secret", "create", name, secretFile); err != nil { | ||
return utils.Errorf(err, L("failed to create podman secret %s"), name) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func hasSecret(name string) bool { | ||
return utils.RunCmd("podman", "secret", "exists", name) == nil | ||
} | ||
|
||
// DeleteSecret removes a podman secret. | ||
func DeleteSecret(name string, dryRun bool) { | ||
if !hasSecret(name) { | ||
return | ||
} | ||
|
||
args := []string{"secret", "rm", name} | ||
command := "podman " + strings.Join(args, " ") | ||
if dryRun { | ||
log.Info().Msgf(L("Would run %s"), command) | ||
} else { | ||
log.Info().Msgf(L("Run %s"), command) | ||
if err := utils.RunCmd("podman", args...); err != nil { | ||
log.Error().Err(err).Msgf(L("Failed to delete %s secret"), name) | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,3 +1,12 @@ | ||
------------------------------------------------------------------- | ||
Mon Nov 18 18:50:59 CET 2024 - [email protected] | ||
|
||
- version 5.1.2-0 | ||
* CVE-2024-22037: Use podman secret to store the database | ||
credentials (bsc#1231497) | ||
* Redact JSESSIONID and pxt-session-cookie values from logs and | ||
console output (bsc#1231568) | ||
|
||
------------------------------------------------------------------- | ||
Mon Oct 14 15:32:26 CEST 2024 - [email protected] | ||
|
||
|
This file contains 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