Skip to content
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

Specify /bin/zsh when creating a new user #755

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

dfries
Copy link
Contributor

@dfries dfries commented Jun 23, 2024

This way if not asking for zsh
ssh/rootfs/etc/s6-overlay/s6-rc.d/init-user/run
In the "# Set up Bash" section will update the user shell to bash as well as root.

Proposed Changes

I wasn't using this addon prior to the change from /bin/ash to /bin/sh, I'm assuming the new user would have been assigned zsh (and changed to bash if the config has zsh set to false).
Maybe it is desired to keep using a fast starting sh since the default .profile is to change the user to root anyway. If that's the case disregard.

Related Issues

Change default shell from /bin/ash to /bin/sh #747

Summary by CodeRabbit

  • New Features
    • Default shell for newly created user accounts changed to Zsh for a more feature-rich command-line experience.

Copy link

coderabbitai bot commented Jun 23, 2024

Warning

Rate limit exceeded

@frenck has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 22 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 0edfbfb and 29e3271.

Walkthrough

The init-ssh/run script has been modified to change the default shell for newly created user accounts from /bin/sh to /bin/zsh, enhancing the default user environment with more interactive and user-friendly features.

Changes

File Change Summary
.../etc/s6-overlay/s6-rc.d/init-ssh/run User shell changed from /bin/sh to /bin/zsh for new accounts

Poem

In the realm of code and script so bright,
A change took place one quiet night.
From simple shell to zsh's might,
User accounts gained a touch of light.
A rabbit hops in bliss, in glee,
For smoother shells set all users free! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (1)
ssh/rootfs/etc/s6-overlay/s6-rc.d/init-ssh/run (1)

Line range hint 106-106: Review default user login behavior.

The script configures new users to execute sudo -i upon login, which elevates their privileges to root. This could be a security risk if not handled carefully. Consider whether this behavior is necessary or if there should be more stringent conditions before elevating privileges.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a44db0d and 0edfbfb.

Files selected for processing (1)
  • ssh/rootfs/etc/s6-overlay/s6-rc.d/init-ssh/run (1 hunks)
Additional comments not posted (1)
ssh/rootfs/etc/s6-overlay/s6-rc.d/init-ssh/run (1)

104-104: Ensure robust user group management.

Adding a user to the 'wheel' group is a sensitive operation. Ensure that the 'wheel' group on your system is configured correctly to grant the intended privileges. Additionally, confirm that adding every new user to this group aligns with your security policies.

Verification successful

Ensure robust user group management.

The configuration for the 'wheel' group in the sudoers.d directory grants all members of the 'wheel' group passwordless sudo access. This aligns with typical configurations but ensure it matches your security policies.

  • /home/jailuser/git/ssh/rootfs/etc/sudoers.d/wheel: %wheel ALL=(ALL) NOPASSWD: ALL
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the configuration of the 'wheel' group.

# Test: Check the 'sudoers' file for 'wheel' group configurations. Expect: Proper configuration.
cat /etc/sudoers | grep wheel

Length of output: 76



Script:

#!/bin/bash
# Description: Locate the sudoers file and check its permissions.

# Locate the sudoers file
sudoers_file=$(find / -name sudoers 2>/dev/null)

# Output the location and permissions of the sudoers file, if found
if [ -n "$sudoers_file" ]; then
    echo "Sudoers file found at: $sudoers_file"
    ls -l $sudoers_file
else
    echo "Sudoers file not found."
fi

Length of output: 112



Script:

#!/bin/bash
# Description: Locate the sudoers file in common alternative locations.

# Check common alternative locations for the sudoers file
alternative_locations=("/etc" "/usr/local/etc" "/etc/sudoers.d")

for location in "${alternative_locations[@]}"; do
    sudoers_file=$(find "$location" -name sudoers 2>/dev/null)
    if [ -n "$sudoers_file" ]; then
        echo "Sudoers file found at: $sudoers_file"
        ls -l $sudoers_file
        exit 0
    fi
done

echo "Sudoers file not found in common alternative locations."

Length of output: 528



Script:

#!/bin/bash
# Description: Locate files or directories related to sudo configuration.

# Search for files or directories related to sudo configuration
sudo_config_files=$(find / -name 'sudo*' 2>/dev/null)

if [ -n "$sudo_config_files" ]; then
    echo "Sudo configuration files or directories found:"
    echo "$sudo_config_files"
else
    echo "No sudo configuration files or directories found."
fi

Length of output: 524



Script:

#!/bin/bash
# Description: Check the contents of the identified sudo configuration files and directories.

# Check the contents of /home/jailuser/git/ssh/rootfs/etc/sudo.conf
echo "Contents of /home/jailuser/git/ssh/rootfs/etc/sudo.conf:"
cat /home/jailuser/git/ssh/rootfs/etc/sudo.conf

# Check the contents of /home/jailuser/git/ssh/rootfs/etc/sudoers.d
echo "Contents of /home/jailuser/git/ssh/rootfs/etc/sudoers.d:"
ls -l /home/jailuser/git/ssh/rootfs/etc/sudoers.d
cat /home/jailuser/git/ssh/rootfs/etc/sudoers.d/*

Length of output: 713

This way if not asking for zsh
ssh/rootfs/etc/s6-overlay/s6-rc.d/init-user/run
In the "# Set up Bash" section will update the user shell to bash as
well as root.
@frenck frenck added the enhancement Enhancement of the code, not introducing new features. label Jul 9, 2024
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @dfries 👍

../Frenck

@frenck frenck merged commit 7fd5170 into hassio-addons:main Jul 9, 2024
11 of 12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Enhancement of the code, not introducing new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants