Skip to content

Fix bash not loading correct profile, upgrade xmlsec1 - #12

Open
tangyisheng2 wants to merge 4 commits into
openshift-eng:mainfrom
tangyisheng2:bash_profile
Open

Fix bash not loading correct profile, upgrade xmlsec1#12
tangyisheng2 wants to merge 4 commits into
openshift-eng:mainfrom
tangyisheng2:bash_profile

Conversation

@tangyisheng2

Copy link
Copy Markdown
Contributor

This PR includes fixes to:

  • Fix bash not reading .bashrc. I added a script in .bash_profile to source.bashrcso thatbash` can read the correct script when starting a new terminal window.
  • Fix openssl@1.1 is disabled problem. openssl@1.1 is disabled by homebrew for security issues. openssl@1.1 is required by xmlsec1. Based on the comments, we have some compatibility issue with 1.3.7, @coverprice can you check is the issue still exist or can we update the version to workaround the openssl@1.1?

@tangyisheng2
tangyisheng2 requested a review from coverprice May 29, 2025 14:49
Comment thread install_packages.sh Outdated
Comment on lines +147 to +149
# set -o xtrace
brew install --overwrite "${packages_to_install[@]}"
set +o xtrace
# set +o xtrace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these commented out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, this is a mistake. Fixed.

Comment thread install_packages.sh
Comment on lines +155 to +160
# # This is a workaround for a problem with the 1.3.7 version of xmlsec1. It forces a downgrade to 1.2.7.
# # The Atlas Toy IDP uses xmlsec1 to sign the SAML requests.
# # https://stackoverflow.com/questions/76805174/getting-key-not-found-with-xmlsec1-on-macos
# local desired_sha="7f35e6ede954326a10949891af2dba47bbe1fc17" tmp_libxmlsec1_path=/tmp/libxmlsec1.rb
# curl -o "${tmp_libxmlsec1_path}" "https://raw.githubusercontent.com/Homebrew/homebrew-core/${desired_sha}/Formula/libxmlsec1.rb"
# HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --formula "${tmp_libxmlsec1_path}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we comment something out, then we always add a comment to say why that was commented out, and when the commented-out section can be restored. Because otherwise, it's not clear to anyone why this code has been disabled.

If the answer is "we want to disable this for now, but let's comment it out because we intende to restore it in the future", then please include a comment that explains that, and what the conditions are for restoring the code.

Aside from that, it's not clear that this is a "fix". The problem with libxmlsec1 is still an issue. So, what problem are you attempting to solve with this? Something about openssl@1.1, but why is that a problem?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how do we proceed with this one.

  • If we continue to use xmlsec1@1.2.7 , we will need to include openssl@1.1 that has already been deprecated from homebrew.
  • If we upgrade xmlsec1 to 1.3.7, we can use openssl@3, but the xmlsec1 would not work.

I was thinking the following solution:

  1. Create another fork to skip the xmlsec1 package for those who don't do Atlas development. OR
  2. Add a instruction to ask user to comment out specific sections. OR
  3. Install openssl@1.1 from a 3rd-party forked repo. We can not be 100% sure about the security of this solution.
  4. Build from the source code. Here is the last release of openssl@1.1: https://github.com/openssl/openssl/releases/tag/OpenSSL_1_1_1w. This solution involves additional engineering efforts.

Looking for some insights here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need to include openssl@1.1 that has already been deprecated from homebrew.

What is the specific problem? Is homebrew refusing to install xmlsec1 because openssl@1.1 has been marked as deprecated? And if so, can we somehow override that and tell homebrew to install it anyway? (Normally I wouldn't want to do this, but it's not a big security risk in our situation)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Homebrew no longer installs from local formulas. It looks like we need to do a local tap. I'm researching what this actually means for next steps and potential updates to the script

https://github.com/orgs/Homebrew/discussions/6351#discussioncomment-14257503

$   HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --formula "${tmp_libxmlsec1_path}"
==> Auto-updating Homebrew...
Adjust how often this is run with `$HOMEBREW_AUTO_UPDATE_SECS` or disable with
`$HOMEBREW_NO_AUTO_UPDATE=1`. Hide these hints with `$HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
Error: Homebrew requires formulae to be in a tap, rejecting:
  /tmp/libxmlsec1.rb (/private/tmp/libxmlsec1.rb)

To create a tap, run e.g.
  brew tap-new <user|org>/<repository>
To create a formula in a tap run e.g.
  brew create <url> --tap=<user|org>/<repository>

Comment thread install_packages.sh
Comment on lines +187 to +198
if [[ ! -f ~/.bash_profile ]]; then
# Install skeleton .bashrc if one is not present
cat >> ~/.bashrc <<"EOF"
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
EOF
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, but should be part of a separate PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, will move it into a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants