machineconfig 8.14__py3-none-any.whl → 8.50__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/remote/run_cluster.py +1 -1
- machineconfig/cluster/remote/run_remote.py +1 -1
- machineconfig/cluster/sessions_managers/utils/maker.py +10 -8
- machineconfig/cluster/sessions_managers/wt_local.py +1 -1
- machineconfig/cluster/sessions_managers/wt_local_manager.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_local.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
- machineconfig/jobs/installer/checks/check_installations.py +133 -0
- machineconfig/jobs/installer/checks/install_utils.py +132 -0
- machineconfig/jobs/installer/checks/report_utils.py +39 -0
- machineconfig/jobs/installer/checks/vt_utils.py +89 -0
- machineconfig/jobs/installer/installer_data.json +225 -140
- machineconfig/jobs/installer/linux_scripts/docker.sh +6 -9
- machineconfig/jobs/installer/package_groups.py +10 -9
- machineconfig/jobs/installer/python_scripts/boxes.py +1 -2
- machineconfig/jobs/installer/python_scripts/code.py +10 -8
- machineconfig/jobs/installer/python_scripts/hx.py +30 -13
- machineconfig/jobs/installer/python_scripts/nerfont_windows_helper.py +6 -5
- machineconfig/jobs/installer/python_scripts/sysabc.py +25 -19
- machineconfig/jobs/installer/python_scripts/yazi.py +33 -17
- machineconfig/jobs/scripts/powershell_scripts/cmatrix.ps1 +52 -0
- machineconfig/jobs/scripts/powershell_scripts/mount_ssh.ps1 +1 -1
- machineconfig/jobs/scripts_dynamic/a.py +413 -10
- machineconfig/profile/create_links.py +77 -20
- machineconfig/profile/create_links_export.py +63 -58
- machineconfig/profile/mapper_data.toml +30 -0
- machineconfig/profile/mapper_dotfiles.toml +253 -0
- machineconfig/scripts/python/agents.py +70 -172
- machineconfig/scripts/python/ai/initai.py +3 -1
- machineconfig/scripts/python/ai/scripts/__init__.py +1 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.ps1 +2 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +7 -5
- machineconfig/scripts/python/ai/solutions/claude/claude.py +1 -1
- machineconfig/scripts/python/ai/solutions/cline/cline.py +1 -1
- machineconfig/scripts/python/ai/solutions/copilot/github_copilot.py +1 -1
- machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +29 -0
- machineconfig/scripts/python/ai/solutions/crush/crush.py +1 -1
- machineconfig/scripts/python/ai/solutions/cursor/cursors.py +1 -1
- machineconfig/scripts/python/ai/solutions/gemini/gemini.py +1 -1
- machineconfig/scripts/python/ai/solutions/gemini/settings.json +3 -0
- machineconfig/scripts/python/ai/{solutions → utils}/generic.py +2 -15
- machineconfig/scripts/python/ai/utils/vscode_tasks.py +6 -3
- machineconfig/scripts/python/cloud.py +58 -11
- machineconfig/scripts/python/croshell.py +4 -156
- machineconfig/scripts/python/devops.py +57 -40
- machineconfig/scripts/python/devops_navigator.py +17 -3
- machineconfig/scripts/python/fire_jobs.py +8 -207
- machineconfig/scripts/python/ftpx.py +5 -225
- machineconfig/scripts/python/graph/cli_graph.json +8743 -0
- machineconfig/scripts/python/{env_manager → helper_env}/path_manager_tui.py +2 -2
- machineconfig/scripts/python/{env_manager → helpers/helper_env}/env_manager_tui.py +1 -1
- machineconfig/scripts/python/helpers/helper_env/path_manager_tui.py +228 -0
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_cursor_agents.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_gemini.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_qwen.py +1 -1
- machineconfig/scripts/python/helpers/helpers_agents/agents_impl.py +168 -0
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_launch.py +5 -5
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_copy.py +6 -6
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_mount.py +10 -5
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_sync.py +3 -3
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers2.py +1 -1
- machineconfig/scripts/python/helpers/helpers_croshell/croshell_impl.py +225 -0
- machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/scheduler.py +4 -4
- machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/start_slidev.py +7 -6
- machineconfig/scripts/python/helpers/helpers_devops/backup_config.py +149 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_backup_retrieve.py +267 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_config.py +98 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_config_dotfile.py +274 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_data.py +76 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_nw.py +52 -72
- machineconfig/scripts/python/helpers/helpers_devops/cli_repos.py +274 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_self.py +40 -23
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_file.py +44 -30
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_server.py +26 -43
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_terminal.py +12 -6
- machineconfig/scripts/python/helpers/helpers_devops/cli_ssh.py +167 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_status.py +12 -6
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_update_repos.py +1 -1
- machineconfig/scripts/python/{interactive.py → helpers/helpers_devops/interactive.py} +68 -52
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/run_script.py +75 -58
- machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.ps1 +41 -0
- machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.sh +48 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_wezterm_theme.py +3 -3
- machineconfig/scripts/python/helpers/helpers_fire_command/fire_jobs_impl.py +233 -0
- machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_route_helper.py +3 -3
- machineconfig/scripts/python/helpers/helpers_msearch/msearch_impl.py +248 -0
- machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_linux/fzfg +4 -3
- machineconfig/scripts/python/helpers/helpers_msearch/scripts_linux/search_with_context.sh +48 -0
- machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_windows/fzfg.ps1 +1 -1
- machineconfig/scripts/python/helpers/helpers_navigator/__init__.py +20 -0
- machineconfig/scripts/python/helpers/helpers_navigator/cli_graph_loader.py +234 -0
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/command_builder.py +61 -13
- machineconfig/scripts/python/helpers/helpers_navigator/command_detail.py +153 -0
- machineconfig/scripts/python/helpers/helpers_navigator/command_tree.py +45 -0
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/data_models.py +18 -11
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/main_app.py +5 -5
- machineconfig/scripts/python/helpers/helpers_network/__init__.py +0 -0
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address.py +15 -17
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address_switch.py +1 -1
- machineconfig/scripts/python/helpers/helpers_network/ftpx_impl.py +276 -0
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_ssh.py +2 -2
- machineconfig/scripts/python/helpers/helpers_network/ssh_add_identity.py +73 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_add_ssh_key.py +175 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_debug_linux.py +319 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_debug_windows.py +275 -0
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action.py +3 -3
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action_helper.py +3 -3
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/cloud_repo_sync.py +117 -33
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/grource.py +3 -2
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/record.py +33 -13
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_2.py +63 -19
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/update.py +0 -6
- machineconfig/scripts/python/helpers/helpers_search/script_help.py +81 -0
- machineconfig/scripts/python/helpers/helpers_sessions/__init__.py +0 -0
- machineconfig/scripts/python/helpers/helpers_sessions/sessions_impl.py +186 -0
- machineconfig/scripts/python/{helpers_sessions → helpers/helpers_sessions}/sessions_multiprocess.py +1 -1
- machineconfig/scripts/python/helpers/helpers_terminal/__init__.py +0 -0
- machineconfig/scripts/python/helpers/helpers_terminal/terminal_impl.py +96 -0
- machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/download.py +1 -1
- machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/python.py +47 -26
- machineconfig/scripts/python/helpers/helpers_utils/specs.py +246 -0
- machineconfig/scripts/python/mcfg_entry.py +133 -48
- machineconfig/scripts/python/msearch.py +15 -61
- machineconfig/scripts/python/sessions.py +59 -194
- machineconfig/scripts/python/terminal.py +18 -96
- machineconfig/scripts/python/utils.py +101 -20
- machineconfig/settings/atuin/config.toml +294 -0
- machineconfig/settings/atuin/themes/catppuccin-mocha-mauve.toml +12 -0
- machineconfig/settings/linters/.ruff.toml +1 -0
- machineconfig/settings/mprocs/windows/mprocs.yaml +2 -2
- machineconfig/settings/shells/bash/init.sh +6 -3
- machineconfig/settings/shells/pwsh/init.ps1 +69 -1
- machineconfig/settings/shells/pwsh/search_pwsh_history.ps1 +99 -0
- machineconfig/settings/shells/wezterm/wezterm.lua +4 -1
- machineconfig/settings/shells/wt/settings.json +20 -7
- machineconfig/settings/shells/zsh/init.sh +25 -4
- machineconfig/settings/television/cable_unix/bash-history.toml +1 -1
- machineconfig/settings/television/cable_windows/pwsh-history.toml +1 -1
- machineconfig/settings/tv/config.toml +234 -0
- machineconfig/settings/tv/themes/catppuccin-mocha-sky.toml +22 -0
- machineconfig/settings/wsl/.wslconfig +5 -30
- machineconfig/settings/yazi/yazi_linux.toml +18 -8
- machineconfig/settings/zellij/layouts/st.kdl +2 -2
- machineconfig/settings/zellij/layouts/st2.kdl +1 -1
- machineconfig/setup_linux/web_shortcuts/interactive.sh +10 -10
- machineconfig/setup_linux/web_shortcuts/live_from_github.sh +3 -0
- machineconfig/setup_mac/__init__.py +0 -2
- machineconfig/setup_windows/__init__.py +0 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +14 -13
- machineconfig/setup_windows/web_shortcuts/live_from_github.ps1 +4 -3
- machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +3 -3
- machineconfig/type_hinting/sql/__init__.py +1 -0
- machineconfig/type_hinting/sql/base.py +216 -0
- machineconfig/type_hinting/sql/core_schema.py +64 -0
- machineconfig/type_hinting/sql/core_schema_typeddict.py +41 -0
- machineconfig/type_hinting/sql/typeddict_codegen.py +222 -0
- machineconfig/type_hinting/typedict/__init__.py +1 -0
- machineconfig/type_hinting/typedict/ast_utils.py +130 -0
- machineconfig/type_hinting/typedict/generator_helpers.py +319 -0
- machineconfig/type_hinting/typedict/generators.py +231 -0
- machineconfig/type_hinting/typedict/polars_schema.py +24 -0
- machineconfig/type_hinting/typedict/polars_schema_typeddict.py +63 -0
- machineconfig/utils/accessories.py +24 -0
- machineconfig/utils/code.py +41 -13
- machineconfig/utils/files/ascii_art.py +10 -14
- machineconfig/utils/files/headers.py +3 -5
- machineconfig/utils/files/read.py +8 -1
- machineconfig/utils/installer_utils/github_release_bulk.py +11 -91
- machineconfig/utils/installer_utils/github_release_scraper.py +99 -0
- machineconfig/utils/installer_utils/install_from_url.py +1 -1
- machineconfig/utils/installer_utils/installer_class.py +12 -4
- machineconfig/utils/installer_utils/installer_cli.py +1 -15
- machineconfig/utils/installer_utils/installer_helper.py +2 -2
- machineconfig/utils/installer_utils/installer_locator_utils.py +13 -13
- machineconfig/utils/installer_utils/installer_runner.py +4 -4
- machineconfig/utils/io.py +25 -8
- machineconfig/utils/meta.py +6 -4
- machineconfig/utils/options.py +49 -19
- machineconfig/utils/options_utils/__init__.py +0 -0
- machineconfig/utils/options_utils/options_tv_linux.py +211 -0
- machineconfig/utils/options_utils/options_tv_windows.py +88 -0
- machineconfig/utils/options_utils/tv_options.py +37 -0
- machineconfig/utils/path_extended.py +6 -6
- machineconfig/utils/scheduler.py +8 -2
- machineconfig/utils/schemas/fire_agents/fire_agents_input.py +1 -1
- machineconfig/utils/source_of_truth.py +6 -1
- machineconfig/utils/ssh.py +69 -18
- machineconfig/utils/ssh_utils/abc.py +1 -1
- machineconfig/utils/ssh_utils/copy_from_here.py +17 -12
- machineconfig/utils/ssh_utils/utils.py +21 -5
- machineconfig/utils/ssh_utils/wsl.py +107 -170
- machineconfig/utils/ssh_utils/wsl_helper.py +217 -0
- machineconfig/utils/upgrade_packages.py +4 -8
- {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/METADATA +29 -22
- {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/RECORD +251 -211
- machineconfig/jobs/installer/check_installations.py +0 -248
- machineconfig/profile/backup.toml +0 -49
- machineconfig/profile/mapper.toml +0 -263
- machineconfig/scripts/python/helpers_devops/cli_config.py +0 -105
- machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +0 -89
- machineconfig/scripts/python/helpers_devops/cli_data.py +0 -25
- machineconfig/scripts/python/helpers_devops/cli_repos.py +0 -208
- machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py +0 -80
- machineconfig/scripts/python/helpers_devops/themes/choose_starship_theme.bash +0 -3
- machineconfig/scripts/python/helpers_navigator/__init__.py +0 -20
- machineconfig/scripts/python/helpers_navigator/command_detail.py +0 -44
- machineconfig/scripts/python/helpers_navigator/command_tree.py +0 -620
- machineconfig/scripts/python/helpers_network/ssh_add_identity.py +0 -116
- machineconfig/scripts/python/helpers_network/ssh_add_ssh_key.py +0 -153
- machineconfig/scripts/python/helpers_network/ssh_debug_linux.py +0 -391
- machineconfig/scripts/python/helpers_network/ssh_debug_windows.py +0 -338
- machineconfig/scripts/python/helpers_repos/entrypoint.py +0 -77
- machineconfig/setup_mac/ssh/openssh_setup.sh +0 -114
- machineconfig/setup_windows/ssh/add-sshkey.ps1 +0 -29
- machineconfig/setup_windows/ssh/openssh-server.ps1 +0 -37
- machineconfig/utils/options_tv.py +0 -119
- machineconfig/utils/tst.py +0 -20
- /machineconfig/{scripts/python/helpers_agents → jobs/installer/checks}/__init__.py +0 -0
- /machineconfig/scripts/python/ai/{solutions/_shared.py → utils/shared.py} +0 -0
- /machineconfig/scripts/python/{helpers_agents/agentic_frameworks → graph}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers}/__init__.py +0 -0
- /machineconfig/scripts/python/{env_manager → helpers/helper_env}/__init__.py +0 -0
- /machineconfig/scripts/python/{env_manager → helpers/helper_env}/path_manager_backend.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_agents}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_devops → helpers/helpers_agents/agentic_frameworks}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_search.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_helper_types.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_load_balancer.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aichat/config.yaml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aider/.aider.conf.yml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/copilot/config.yml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/crush/crush.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/gemini/settings.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/privacy.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/prompt.txt +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.ps1 +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.sh +0 -0
- /machineconfig/scripts/python/{helpers_devops/themes → helpers/helpers_cloud}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_helpers.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers5.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_croshell}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/crosh.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/pomodoro.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer_template.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_devops}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_sessions → helpers/helpers_devops/themes}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_pwsh_theme.ps1 +0 -0
- /machineconfig/scripts/python/{helpers_devops/themes/choose_starship_theme.ps1 → helpers/helpers_fire_command/__init__.py} +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/cloud_manager.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/f.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/file_wrangler.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_args_helper.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_streamlit_helper.py +0 -0
- /machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/search_bar.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nfs.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nw_drive.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/onetimeshare.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/wifi_conn.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/clone.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_1.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/sync.py +0 -0
- /machineconfig/scripts/python/helpers/{ast_search.py → helpers_search/ast_search.py} +0 -0
- /machineconfig/scripts/python/helpers/{qr_code.py → helpers_search/qr_code.py} +0 -0
- /machineconfig/scripts/python/helpers/{repo_rag.py → helpers_search/repo_rag.py} +0 -0
- /machineconfig/scripts/python/helpers/{symantic_search.py → helpers_search/symantic_search.py} +0 -0
- /machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/pdf.py +0 -0
- {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/WHEEL +0 -0
- {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/entry_points.txt +0 -0
- {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/top_level.txt +0 -0
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
from platform import system
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from rich.console import Console
|
|
6
|
-
from rich.panel import Panel
|
|
7
|
-
from rich import box
|
|
8
|
-
import subprocess
|
|
9
|
-
import os
|
|
10
|
-
|
|
11
|
-
console = Console()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def ssh_debug_linux() -> dict[str, dict[str, str | bool]]:
|
|
15
|
-
"""
|
|
16
|
-
Comprehensive SSH debugging function that checks for common pitfalls on Linux systems.
|
|
17
|
-
|
|
18
|
-
Returns a dictionary with diagnostic results for each check performed.
|
|
19
|
-
"""
|
|
20
|
-
if system() != "Linux":
|
|
21
|
-
console.print(Panel("❌ This function is only supported on Linux systems", title="[bold red]Error[/bold red]", border_style="red"))
|
|
22
|
-
raise NotImplementedError("ssh_debug_linux is only supported on Linux")
|
|
23
|
-
|
|
24
|
-
console.print(Panel("🔍 SSH DEBUG - COMPREHENSIVE DIAGNOSTICS", box=box.DOUBLE_EDGE, title_align="left"))
|
|
25
|
-
|
|
26
|
-
results: dict[str, dict[str, str | bool]] = {}
|
|
27
|
-
issues_found: list[str] = []
|
|
28
|
-
|
|
29
|
-
ssh_dir = Path.home().joinpath(".ssh")
|
|
30
|
-
authorized_keys = ssh_dir.joinpath("authorized_keys")
|
|
31
|
-
|
|
32
|
-
console.print(Panel("🔐 Checking SSH directory and authorized_keys...", title="[bold blue]File Permissions[/bold blue]", border_style="blue"))
|
|
33
|
-
|
|
34
|
-
if not ssh_dir.exists():
|
|
35
|
-
results["ssh_directory"] = {"status": "error", "message": "~/.ssh directory does not exist", "action": "Create with: mkdir -p ~/.ssh && chmod 700 ~/.ssh"}
|
|
36
|
-
issues_found.append("SSH directory missing")
|
|
37
|
-
console.print(Panel("❌ ~/.ssh directory does not exist\n💡 Run: mkdir -p ~/.ssh && chmod 700 ~/.ssh", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
38
|
-
else:
|
|
39
|
-
ssh_dir_stat = os.stat(ssh_dir)
|
|
40
|
-
ssh_dir_perms = oct(ssh_dir_stat.st_mode)[-3:]
|
|
41
|
-
if ssh_dir_perms != "700":
|
|
42
|
-
results["ssh_directory"] = {"status": "warning", "message": f"~/.ssh has incorrect permissions: {ssh_dir_perms} (should be 700)", "action": "Fix with: chmod 700 ~/.ssh"}
|
|
43
|
-
issues_found.append(f"SSH directory permissions incorrect: {ssh_dir_perms}")
|
|
44
|
-
console.print(Panel(f"⚠️ ~/.ssh permissions: {ssh_dir_perms} (should be 700)\n💡 Fix: chmod 700 ~/.ssh", title="[bold yellow]Permission Issue[/bold yellow]", border_style="yellow"))
|
|
45
|
-
else:
|
|
46
|
-
results["ssh_directory"] = {"status": "ok", "message": "~/.ssh directory permissions correct (700)", "action": ""}
|
|
47
|
-
console.print(Panel("✅ ~/.ssh directory permissions correct (700)", title="[bold green]OK[/bold green]", border_style="green"))
|
|
48
|
-
|
|
49
|
-
if not authorized_keys.exists():
|
|
50
|
-
results["authorized_keys"] = {"status": "warning", "message": "authorized_keys file does not exist", "action": "Create authorized_keys file and add public keys"}
|
|
51
|
-
issues_found.append("authorized_keys missing")
|
|
52
|
-
console.print(Panel("⚠️ authorized_keys file does not exist\n💡 Add your public key to ~/.ssh/authorized_keys", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
53
|
-
else:
|
|
54
|
-
ak_stat = os.stat(authorized_keys)
|
|
55
|
-
ak_perms = oct(ak_stat.st_mode)[-3:]
|
|
56
|
-
if ak_perms not in ["600", "644"]:
|
|
57
|
-
results["authorized_keys"] = {"status": "warning", "message": f"authorized_keys has incorrect permissions: {ak_perms} (should be 600 or 644)", "action": "Fix with: chmod 644 ~/.ssh/authorized_keys"}
|
|
58
|
-
issues_found.append(f"authorized_keys permissions incorrect: {ak_perms}")
|
|
59
|
-
console.print(Panel(f"⚠️ authorized_keys permissions: {ak_perms} (should be 600 or 644)\n💡 Fix: chmod 644 ~/.ssh/authorized_keys", title="[bold yellow]Permission Issue[/bold yellow]", border_style="yellow"))
|
|
60
|
-
else:
|
|
61
|
-
key_count = len([line for line in authorized_keys.read_text(encoding="utf-8").split("\n") if line.strip()])
|
|
62
|
-
results["authorized_keys"] = {"status": "ok", "message": f"authorized_keys permissions correct ({ak_perms}), contains {key_count} key(s)", "action": ""}
|
|
63
|
-
console.print(Panel(f"✅ authorized_keys permissions correct ({ak_perms})\n🔑 Contains {key_count} authorized key(s)", title="[bold green]OK[/bold green]", border_style="green"))
|
|
64
|
-
|
|
65
|
-
console.print(Panel("🔧 Checking SSH service status...", title="[bold blue]Service Status[/bold blue]", border_style="blue"))
|
|
66
|
-
|
|
67
|
-
try:
|
|
68
|
-
ssh_service_check = subprocess.run(["systemctl", "is-active", "ssh"], capture_output=True, text=True, check=False)
|
|
69
|
-
sshd_service_check = subprocess.run(["systemctl", "is-active", "sshd"], capture_output=True, text=True, check=False)
|
|
70
|
-
|
|
71
|
-
ssh_active = ssh_service_check.returncode == 0
|
|
72
|
-
sshd_active = sshd_service_check.returncode == 0
|
|
73
|
-
|
|
74
|
-
if not ssh_active and not sshd_active:
|
|
75
|
-
results["ssh_service"] = {"status": "error", "message": "SSH service is not running (checked both 'ssh' and 'sshd')", "action": "Start with: sudo systemctl start ssh (or sshd)"}
|
|
76
|
-
issues_found.append("SSH service not running")
|
|
77
|
-
console.print(Panel("❌ SSH service is not running\n💡 Start: sudo systemctl start ssh (or sshd)\n💡 Enable on boot: sudo systemctl enable ssh", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
78
|
-
elif ssh_active or sshd_active:
|
|
79
|
-
service_name = "ssh" if ssh_active else "sshd"
|
|
80
|
-
results["ssh_service"] = {"status": "ok", "message": f"SSH service is running ({service_name})", "action": ""}
|
|
81
|
-
console.print(Panel(f"✅ SSH service is running ({service_name})", title="[bold green]OK[/bold green]", border_style="green"))
|
|
82
|
-
except FileNotFoundError:
|
|
83
|
-
results["ssh_service"] = {"status": "warning", "message": "systemctl not found, cannot check service status", "action": "Check SSH service manually"}
|
|
84
|
-
console.print(Panel("⚠️ systemctl not found\n💡 Check SSH service status manually", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
85
|
-
|
|
86
|
-
console.print(Panel("🌐 Checking network interfaces and IP addresses...", title="[bold blue]Network Interfaces[/bold blue]", border_style="blue"))
|
|
87
|
-
|
|
88
|
-
try:
|
|
89
|
-
ip_addr_check = subprocess.run(["ip", "addr", "show"], capture_output=True, text=True, check=False)
|
|
90
|
-
if ip_addr_check.returncode == 0:
|
|
91
|
-
ip_output = ip_addr_check.stdout
|
|
92
|
-
import re
|
|
93
|
-
inet_pattern = re.compile(r'inet\s+(\d+\.\d+\.\d+\.\d+)/\d+.*scope\s+global')
|
|
94
|
-
ip_addresses = inet_pattern.findall(ip_output)
|
|
95
|
-
|
|
96
|
-
if ip_addresses:
|
|
97
|
-
results["network_interfaces"] = {"status": "ok", "message": f"Found {len(ip_addresses)} network interface(s)", "action": ""}
|
|
98
|
-
console.print(Panel("✅ Network interfaces found:\n" + "\n".join([f" • {ip}" for ip in ip_addresses]), title="[bold green]IP Addresses[/bold green]", border_style="green"))
|
|
99
|
-
else:
|
|
100
|
-
results["network_interfaces"] = {"status": "warning", "message": "No global IP addresses found", "action": "Check network configuration"}
|
|
101
|
-
issues_found.append("No network IP addresses")
|
|
102
|
-
console.print(Panel("⚠️ No global IP addresses found\n💡 This machine may not be reachable on the network\n💡 Check: ip addr show", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
103
|
-
except FileNotFoundError:
|
|
104
|
-
results["network_interfaces"] = {"status": "warning", "message": "ip command not found", "action": "Check network manually"}
|
|
105
|
-
console.print(Panel("⚠️ 'ip' command not found\n💡 Try: ifconfig", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
106
|
-
|
|
107
|
-
console.print(Panel("🔌 Checking SSH port and listening status...", title="[bold blue]Network Status[/bold blue]", border_style="blue"))
|
|
108
|
-
|
|
109
|
-
sshd_config_paths = [Path("/etc/ssh/sshd_config"), Path("/etc/sshd_config")]
|
|
110
|
-
sshd_config = None
|
|
111
|
-
for config_path in sshd_config_paths:
|
|
112
|
-
if config_path.exists():
|
|
113
|
-
sshd_config = config_path
|
|
114
|
-
break
|
|
115
|
-
|
|
116
|
-
if sshd_config:
|
|
117
|
-
config_text = sshd_config.read_text(encoding="utf-8")
|
|
118
|
-
port_lines = [line for line in config_text.split("\n") if line.strip().startswith("Port") and not line.strip().startswith("#")]
|
|
119
|
-
if port_lines:
|
|
120
|
-
ssh_port = port_lines[0].split()[1]
|
|
121
|
-
else:
|
|
122
|
-
ssh_port = "22"
|
|
123
|
-
|
|
124
|
-
results["sshd_config"] = {"status": "ok", "message": f"SSH configured to listen on port {ssh_port}", "action": ""}
|
|
125
|
-
console.print(Panel(f"✅ SSH configured to listen on port {ssh_port}", title="[bold green]Config[/bold green]", border_style="green"))
|
|
126
|
-
|
|
127
|
-
password_auth_lines = [line for line in config_text.split("\n") if "PasswordAuthentication" in line and not line.strip().startswith("#")]
|
|
128
|
-
if password_auth_lines:
|
|
129
|
-
password_auth_enabled = "yes" in password_auth_lines[-1].lower()
|
|
130
|
-
if not password_auth_enabled:
|
|
131
|
-
console.print(Panel("ℹ️ Password authentication is disabled\n💡 Only SSH keys will work", title="[bold blue]Info[/bold blue]", border_style="blue"))
|
|
132
|
-
|
|
133
|
-
pubkey_auth_lines = [line for line in config_text.split("\n") if "PubkeyAuthentication" in line and not line.strip().startswith("#")]
|
|
134
|
-
if pubkey_auth_lines:
|
|
135
|
-
pubkey_auth_enabled = "yes" in pubkey_auth_lines[-1].lower()
|
|
136
|
-
if not pubkey_auth_enabled:
|
|
137
|
-
results["pubkey_auth"] = {"status": "error", "message": "PubkeyAuthentication is disabled in sshd_config", "action": "Enable with: PubkeyAuthentication yes in sshd_config"}
|
|
138
|
-
issues_found.append("PubkeyAuthentication disabled")
|
|
139
|
-
console.print(Panel("❌ PubkeyAuthentication is DISABLED\n💡 Edit /etc/ssh/sshd_config and set: PubkeyAuthentication yes\n💡 Then restart: sudo systemctl restart ssh", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
140
|
-
else:
|
|
141
|
-
results["pubkey_auth"] = {"status": "ok", "message": "PubkeyAuthentication is enabled", "action": ""}
|
|
142
|
-
console.print(Panel("✅ PubkeyAuthentication is enabled", title="[bold green]OK[/bold green]", border_style="green"))
|
|
143
|
-
else:
|
|
144
|
-
results["sshd_config"] = {"status": "warning", "message": "sshd_config not found", "action": "Check SSH configuration manually"}
|
|
145
|
-
ssh_port = "22"
|
|
146
|
-
console.print(Panel("⚠️ sshd_config not found\n💡 Assuming default port 22", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
147
|
-
|
|
148
|
-
try:
|
|
149
|
-
listening_check = subprocess.run(["ss", "-tlnp"], capture_output=True, text=True, check=False)
|
|
150
|
-
if listening_check.returncode == 0:
|
|
151
|
-
listening_output = listening_check.stdout
|
|
152
|
-
if f":{ssh_port}" in listening_output:
|
|
153
|
-
ssh_lines = [line for line in listening_output.split("\n") if f":{ssh_port}" in line]
|
|
154
|
-
listening_on_all = any("0.0.0.0" in line or "[::]" in line for line in ssh_lines)
|
|
155
|
-
listening_on_localhost_only = all("127.0.0.1" in line or "[::1]" in line for line in ssh_lines)
|
|
156
|
-
|
|
157
|
-
if listening_on_localhost_only:
|
|
158
|
-
results["ssh_listening"] = {"status": "error", "message": f"SSH is listening ONLY on localhost (127.0.0.1:{ssh_port}), not accessible from network", "action": "Edit /etc/ssh/sshd_config, check ListenAddress, restart SSH"}
|
|
159
|
-
issues_found.append("SSH listening only on localhost")
|
|
160
|
-
console.print(Panel(f"❌ SSH is listening ONLY on localhost (127.0.0.1:{ssh_port})\n💡 This prevents external connections!\n💡 Check /etc/ssh/sshd_config for 'ListenAddress'\n💡 Remove or comment out 'ListenAddress 127.0.0.1'\n💡 Or change to 'ListenAddress 0.0.0.0'\n💡 Then: sudo systemctl restart ssh", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
161
|
-
elif listening_on_all:
|
|
162
|
-
results["ssh_listening"] = {"status": "ok", "message": f"SSH is listening on all interfaces (0.0.0.0:{ssh_port})", "action": ""}
|
|
163
|
-
console.print(Panel(f"✅ SSH is listening on all interfaces (0.0.0.0:{ssh_port})\n✅ Should be accessible from network", title="[bold green]OK[/bold green]", border_style="green"))
|
|
164
|
-
else:
|
|
165
|
-
results["ssh_listening"] = {"status": "ok", "message": f"SSH is listening on port {ssh_port}", "action": ""}
|
|
166
|
-
console.print(Panel(f"✅ SSH is listening on port {ssh_port}\n\nListening on:\n" + "\n".join([f" {line.strip()}" for line in ssh_lines[:3]]), title="[bold green]OK[/bold green]", border_style="green"))
|
|
167
|
-
else:
|
|
168
|
-
results["ssh_listening"] = {"status": "error", "message": f"SSH is NOT listening on port {ssh_port}", "action": "Check if SSH service is running and configured correctly"}
|
|
169
|
-
issues_found.append(f"SSH not listening on port {ssh_port}")
|
|
170
|
-
console.print(Panel(f"❌ SSH is NOT listening on port {ssh_port}\n💡 Check: sudo ss -tlnp | grep {ssh_port}\n💡 Restart: sudo systemctl restart ssh", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
171
|
-
else:
|
|
172
|
-
results["ssh_listening"] = {"status": "warning", "message": "Could not check listening status", "action": "Check manually with: ss -tlnp"}
|
|
173
|
-
console.print(Panel("⚠️ Could not check listening status\n💡 Check manually: ss -tlnp | grep ssh", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
174
|
-
except FileNotFoundError:
|
|
175
|
-
results["ssh_listening"] = {"status": "warning", "message": "ss command not found", "action": "Install net-tools or check manually"}
|
|
176
|
-
console.print(Panel("⚠️ 'ss' command not found\n💡 Try: netstat -tlnp | grep ssh", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
177
|
-
|
|
178
|
-
console.print(Panel("🧱 Checking firewall status...", title="[bold blue]Firewall[/bold blue]", border_style="blue"))
|
|
179
|
-
|
|
180
|
-
firewall_checked = False
|
|
181
|
-
|
|
182
|
-
try:
|
|
183
|
-
ufw_status = subprocess.run(["ufw", "status"], capture_output=True, text=True, check=False)
|
|
184
|
-
if ufw_status.returncode == 0:
|
|
185
|
-
firewall_checked = True
|
|
186
|
-
ufw_output = ufw_status.stdout
|
|
187
|
-
if "Status: active" in ufw_output:
|
|
188
|
-
if f"{ssh_port}/tcp" in ufw_output.lower() or f"{ssh_port}" in ufw_output.lower() or "ssh" in ufw_output.lower():
|
|
189
|
-
results["firewall_ufw"] = {"status": "ok", "message": f"UFW is active and SSH port {ssh_port} is allowed", "action": ""}
|
|
190
|
-
console.print(Panel(f"✅ UFW is active and SSH port {ssh_port} is allowed", title="[bold green]OK[/bold green]", border_style="green"))
|
|
191
|
-
else:
|
|
192
|
-
results["firewall_ufw"] = {"status": "error", "message": f"UFW is active but SSH port {ssh_port} is NOT allowed", "action": f"Allow with: sudo ufw allow {ssh_port}/tcp"}
|
|
193
|
-
issues_found.append(f"UFW blocking port {ssh_port}")
|
|
194
|
-
console.print(Panel(f"❌ UFW is active but SSH port {ssh_port} is NOT allowed\n💡 Fix: sudo ufw allow {ssh_port}/tcp", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
195
|
-
else:
|
|
196
|
-
results["firewall_ufw"] = {"status": "ok", "message": "UFW is inactive", "action": ""}
|
|
197
|
-
console.print(Panel("ℹ️ UFW is inactive (no firewall blocking)", title="[bold blue]Info[/bold blue]", border_style="blue"))
|
|
198
|
-
except FileNotFoundError:
|
|
199
|
-
pass
|
|
200
|
-
|
|
201
|
-
if not firewall_checked:
|
|
202
|
-
try:
|
|
203
|
-
firewalld_status = subprocess.run(["firewall-cmd", "--state"], capture_output=True, text=True, check=False)
|
|
204
|
-
if firewalld_status.returncode == 0 and "running" in firewalld_status.stdout.lower():
|
|
205
|
-
firewall_checked = True
|
|
206
|
-
firewalld_check = subprocess.run(["firewall-cmd", "--list-services"], capture_output=True, text=True, check=False)
|
|
207
|
-
if firewalld_check.returncode == 0:
|
|
208
|
-
if "ssh" in firewalld_check.stdout.lower():
|
|
209
|
-
results["firewall_firewalld"] = {"status": "ok", "message": "firewalld is active and SSH service is allowed", "action": ""}
|
|
210
|
-
console.print(Panel("✅ firewalld is active and SSH service is allowed", title="[bold green]OK[/bold green]", border_style="green"))
|
|
211
|
-
else:
|
|
212
|
-
results["firewall_firewalld"] = {"status": "error", "message": "firewalld is active but SSH service is NOT allowed", "action": "Allow with: sudo firewall-cmd --permanent --add-service=ssh && sudo firewall-cmd --reload"}
|
|
213
|
-
issues_found.append("firewalld blocking SSH")
|
|
214
|
-
console.print(Panel("❌ firewalld is active but SSH is NOT allowed\n💡 Fix: sudo firewall-cmd --permanent --add-service=ssh\n💡 Then: sudo firewall-cmd --reload", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
215
|
-
except FileNotFoundError:
|
|
216
|
-
pass
|
|
217
|
-
|
|
218
|
-
if not firewall_checked:
|
|
219
|
-
try:
|
|
220
|
-
iptables_check = subprocess.run(["iptables", "-L", "-n"], capture_output=True, text=True, check=False)
|
|
221
|
-
if iptables_check.returncode == 0:
|
|
222
|
-
firewall_checked = True
|
|
223
|
-
iptables_output = iptables_check.stdout
|
|
224
|
-
if f"dpt:{ssh_port}" in iptables_output or "ACCEPT" in iptables_output.split("\n")[0]:
|
|
225
|
-
results["firewall_iptables"] = {"status": "ok", "message": f"iptables appears to allow SSH traffic on port {ssh_port}", "action": ""}
|
|
226
|
-
console.print(Panel(f"ℹ️ iptables detected - appears to allow SSH on port {ssh_port}", title="[bold blue]Info[/bold blue]", border_style="blue"))
|
|
227
|
-
else:
|
|
228
|
-
results["firewall_iptables"] = {"status": "warning", "message": f"iptables may be blocking SSH traffic on port {ssh_port}", "action": "Check rules manually: sudo iptables -L -n"}
|
|
229
|
-
console.print(Panel(f"⚠️ iptables detected - may be blocking SSH\n💡 Check: sudo iptables -L -n\n💡 Allow: sudo iptables -A INPUT -p tcp --dport {ssh_port} -j ACCEPT", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
230
|
-
except FileNotFoundError:
|
|
231
|
-
pass
|
|
232
|
-
|
|
233
|
-
if not firewall_checked:
|
|
234
|
-
results["firewall"] = {"status": "ok", "message": "No firewall detected or firewall commands not available", "action": ""}
|
|
235
|
-
console.print(Panel("ℹ️ No firewall detected", title="[bold blue]Info[/bold blue]", border_style="blue"))
|
|
236
|
-
|
|
237
|
-
console.print(Panel("🗂️ Checking for problematic files in /etc/...", title="[bold blue]System Files[/bold blue]", border_style="blue"))
|
|
238
|
-
|
|
239
|
-
hosts_deny = Path("/etc/hosts.deny")
|
|
240
|
-
if hosts_deny.exists():
|
|
241
|
-
hosts_deny_content = hosts_deny.read_text(encoding="utf-8")
|
|
242
|
-
active_lines = [line.strip() for line in hosts_deny_content.splitlines() if line.strip() and not line.strip().startswith("#")]
|
|
243
|
-
active_content_lower = " ".join(active_lines).lower()
|
|
244
|
-
if "sshd" in active_content_lower or "all" in active_content_lower:
|
|
245
|
-
results["hosts_deny"] = {"status": "error", "message": "/etc/hosts.deny may be blocking SSH connections", "action": "Review /etc/hosts.deny and remove SSH blocks"}
|
|
246
|
-
issues_found.append("/etc/hosts.deny blocking SSH")
|
|
247
|
-
console.print(Panel("❌ /etc/hosts.deny may be blocking SSH\n💡 Check: cat /etc/hosts.deny\n💡 Remove any lines blocking 'sshd' or 'ALL'", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
248
|
-
else:
|
|
249
|
-
results["hosts_deny"] = {"status": "ok", "message": "/etc/hosts.deny exists but doesn't appear to block SSH", "action": ""}
|
|
250
|
-
console.print(Panel("✅ /etc/hosts.deny doesn't block SSH", title="[bold green]OK[/bold green]", border_style="green"))
|
|
251
|
-
else:
|
|
252
|
-
results["hosts_deny"] = {"status": "ok", "message": "/etc/hosts.deny does not exist", "action": ""}
|
|
253
|
-
console.print(Panel("✅ /etc/hosts.deny not present", title="[bold green]OK[/bold green]", border_style="green"))
|
|
254
|
-
|
|
255
|
-
hosts_allow = Path("/etc/hosts.allow")
|
|
256
|
-
if hosts_allow.exists():
|
|
257
|
-
results["hosts_allow"] = {"status": "ok", "message": "/etc/hosts.allow exists (check if needed)", "action": ""}
|
|
258
|
-
console.print(Panel("ℹ️ /etc/hosts.allow exists\n💡 Ensure it allows SSH if using TCP wrappers", title="[bold blue]Info[/bold blue]", border_style="blue"))
|
|
259
|
-
|
|
260
|
-
console.print(Panel("👤 Checking home directory permissions...", title="[bold blue]User Permissions[/bold blue]", border_style="blue"))
|
|
261
|
-
|
|
262
|
-
home_dir = Path.home()
|
|
263
|
-
home_stat = os.stat(home_dir)
|
|
264
|
-
home_perms = oct(home_stat.st_mode)[-3:]
|
|
265
|
-
|
|
266
|
-
if home_perms[2] in ["7", "6"]:
|
|
267
|
-
results["home_directory"] = {"status": "error", "message": f"Home directory has world-writable permissions: {home_perms} (SSH may refuse to work)", "action": f"Fix with: chmod 755 {home_dir}"}
|
|
268
|
-
issues_found.append(f"Home directory world-writable: {home_perms}")
|
|
269
|
-
console.print(Panel(f"❌ Home directory is world-writable ({home_perms})\n💡 SSH may refuse connections for security\n💡 Fix: chmod 755 {home_dir}", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
270
|
-
else:
|
|
271
|
-
results["home_directory"] = {"status": "ok", "message": f"Home directory permissions OK: {home_perms}", "action": ""}
|
|
272
|
-
console.print(Panel(f"✅ Home directory permissions OK: {home_perms}", title="[bold green]OK[/bold green]", border_style="green"))
|
|
273
|
-
|
|
274
|
-
console.print(Panel("🔍 Checking SELinux status...", title="[bold blue]SELinux[/bold blue]", border_style="blue"))
|
|
275
|
-
|
|
276
|
-
try:
|
|
277
|
-
selinux_check = subprocess.run(["getenforce"], capture_output=True, text=True, check=False)
|
|
278
|
-
if selinux_check.returncode == 0:
|
|
279
|
-
selinux_status = selinux_check.stdout.strip()
|
|
280
|
-
if selinux_status == "Enforcing":
|
|
281
|
-
restorecon_check = subprocess.run(["restorecon", "-Rv", str(ssh_dir)], capture_output=True, text=True, check=False)
|
|
282
|
-
if restorecon_check.returncode == 0:
|
|
283
|
-
results["selinux"] = {"status": "ok", "message": f"SELinux is {selinux_status}, SSH contexts restored", "action": ""}
|
|
284
|
-
console.print(Panel(f"✅ SELinux is {selinux_status}\n✅ SSH contexts restored", title="[bold green]OK[/bold green]", border_style="green"))
|
|
285
|
-
else:
|
|
286
|
-
results["selinux"] = {"status": "warning", "message": f"SELinux is {selinux_status}, may need context restoration", "action": f"Run: sudo restorecon -Rv {ssh_dir}"}
|
|
287
|
-
console.print(Panel(f"⚠️ SELinux is {selinux_status}\n💡 Fix contexts: sudo restorecon -Rv {ssh_dir}", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
288
|
-
else:
|
|
289
|
-
results["selinux"] = {"status": "ok", "message": f"SELinux is {selinux_status}", "action": ""}
|
|
290
|
-
console.print(Panel(f"ℹ️ SELinux is {selinux_status}", title="[bold blue]Info[/bold blue]", border_style="blue"))
|
|
291
|
-
except FileNotFoundError:
|
|
292
|
-
results["selinux"] = {"status": "ok", "message": "SELinux not installed", "action": ""}
|
|
293
|
-
console.print(Panel("ℹ️ SELinux not installed", title="[bold blue]Info[/bold blue]", border_style="blue"))
|
|
294
|
-
|
|
295
|
-
console.print(Panel("📋 Checking SSH logs for errors...", title="[bold blue]Logs[/bold blue]", border_style="blue"))
|
|
296
|
-
|
|
297
|
-
log_files = [Path("/var/log/auth.log"), Path("/var/log/secure")]
|
|
298
|
-
log_found = False
|
|
299
|
-
for log_file in log_files:
|
|
300
|
-
if log_file.exists():
|
|
301
|
-
log_found = True
|
|
302
|
-
try:
|
|
303
|
-
tail_check = subprocess.run(["tail", "-n", "50", str(log_file)], capture_output=True, text=True, check=False)
|
|
304
|
-
if tail_check.returncode == 0:
|
|
305
|
-
log_content = tail_check.stdout
|
|
306
|
-
error_keywords = ["error", "failed", "refused", "denied", "invalid"]
|
|
307
|
-
ssh_errors = [line for line in log_content.split("\n") if any(keyword in line.lower() for keyword in error_keywords) and "ssh" in line.lower()]
|
|
308
|
-
if ssh_errors:
|
|
309
|
-
results["ssh_logs"] = {"status": "warning", "message": f"Found {len(ssh_errors)} potential SSH errors in {log_file}", "action": f"Review: sudo tail -f {log_file}"}
|
|
310
|
-
console.print(Panel(f"⚠️ Found {len(ssh_errors)} potential SSH errors in {log_file}\n💡 Review: sudo tail -f {log_file}\n\nRecent errors:\n" + "\n".join(ssh_errors[-3:]), title="[bold yellow]Log Errors[/bold yellow]", border_style="yellow"))
|
|
311
|
-
else:
|
|
312
|
-
results["ssh_logs"] = {"status": "ok", "message": f"No recent SSH errors in {log_file}", "action": ""}
|
|
313
|
-
console.print(Panel(f"✅ No recent SSH errors in {log_file}", title="[bold green]OK[/bold green]", border_style="green"))
|
|
314
|
-
except Exception:
|
|
315
|
-
results["ssh_logs"] = {"status": "warning", "message": f"Could not read {log_file}", "action": f"Check manually: sudo tail {log_file}"}
|
|
316
|
-
console.print(Panel(f"⚠️ Could not read {log_file}\n💡 Check: sudo tail {log_file}", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
317
|
-
break
|
|
318
|
-
|
|
319
|
-
if not log_found:
|
|
320
|
-
results["ssh_logs"] = {"status": "warning", "message": "SSH log files not found", "action": "Check journalctl: sudo journalctl -u ssh"}
|
|
321
|
-
console.print(Panel("⚠️ SSH log files not found\n💡 Check: sudo journalctl -u ssh -n 50", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
322
|
-
|
|
323
|
-
console.print(Panel("🧪 Testing local SSH connection...", title="[bold blue]Connection Test[/bold blue]", border_style="blue"))
|
|
324
|
-
|
|
325
|
-
try:
|
|
326
|
-
local_user = os.environ.get("USER", os.environ.get("USERNAME", "unknown"))
|
|
327
|
-
ssh_test = subprocess.run(["ssh", "-o", "ConnectTimeout=5", "-o", "StrictHostKeyChecking=no", "-o", "BatchMode=yes", f"{local_user}@localhost", "echo", "test"], capture_output=True, text=True, check=False, timeout=10)
|
|
328
|
-
|
|
329
|
-
if ssh_test.returncode == 0:
|
|
330
|
-
results["local_ssh_test"] = {"status": "ok", "message": "Local SSH connection successful", "action": ""}
|
|
331
|
-
console.print(Panel("✅ Local SSH connection works\n✅ SSH server is functional", title="[bold green]OK[/bold green]", border_style="green"))
|
|
332
|
-
else:
|
|
333
|
-
error_output = ssh_test.stderr
|
|
334
|
-
results["local_ssh_test"] = {"status": "warning", "message": f"Local SSH test failed: {error_output[:100]}", "action": "Check SSH keys and configuration"}
|
|
335
|
-
console.print(Panel(f"⚠️ Local SSH test failed\n💡 Error: {error_output[:200]}\n💡 This may be normal if key authentication is not set up for localhost", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
336
|
-
except subprocess.TimeoutExpired:
|
|
337
|
-
results["local_ssh_test"] = {"status": "error", "message": "Local SSH connection timed out", "action": "SSH may be hanging or not responding"}
|
|
338
|
-
issues_found.append("SSH connection timeout")
|
|
339
|
-
console.print(Panel("❌ Local SSH connection timed out\n💡 SSH server may not be responding\n💡 Check: sudo systemctl status ssh", title="[bold red]Critical Issue[/bold red]", border_style="red"))
|
|
340
|
-
except FileNotFoundError:
|
|
341
|
-
results["local_ssh_test"] = {"status": "warning", "message": "ssh client not found", "action": "Install SSH client"}
|
|
342
|
-
console.print(Panel("⚠️ SSH client not installed\n💡 Install: sudo apt install openssh-client", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
343
|
-
except Exception as test_error:
|
|
344
|
-
results["local_ssh_test"] = {"status": "warning", "message": f"Could not test SSH: {str(test_error)}", "action": ""}
|
|
345
|
-
console.print(Panel(f"⚠️ Could not test SSH connection: {str(test_error)}", title="[bold yellow]Warning[/bold yellow]", border_style="yellow"))
|
|
346
|
-
|
|
347
|
-
console.print(Panel("📊 DIAGNOSTIC SUMMARY", box=box.DOUBLE_EDGE, title_align="left"))
|
|
348
|
-
|
|
349
|
-
if issues_found:
|
|
350
|
-
console.print(Panel(f"⚠️ Found {len(issues_found)} issue(s):\n\n" + "\n".join([f"• {issue}" for issue in issues_found]), title="[bold yellow]Issues Found[/bold yellow]", border_style="yellow"))
|
|
351
|
-
else:
|
|
352
|
-
console.print(Panel("✅ No critical issues detected\n\nIf you still cannot connect:\n• Check client-side configuration\n• Verify network connectivity\n• Ensure correct username and hostname\n• Check if public key is correctly added to authorized_keys", title="[bold green]All Checks Passed[/bold green]", border_style="green"))
|
|
353
|
-
|
|
354
|
-
console.print(Panel("🔗 CONNECTION INFORMATION", box=box.DOUBLE_EDGE, title_align="left"))
|
|
355
|
-
|
|
356
|
-
try:
|
|
357
|
-
current_user = os.environ.get("USER", os.environ.get("USERNAME", "unknown"))
|
|
358
|
-
hostname_result = subprocess.run(["hostname"], capture_output=True, text=True, check=False)
|
|
359
|
-
hostname = hostname_result.stdout.strip() if hostname_result.returncode == 0 else "unknown"
|
|
360
|
-
|
|
361
|
-
ip_addr_result = subprocess.run(["ip", "addr", "show"], capture_output=True, text=True, check=False)
|
|
362
|
-
connection_ips: list[str] = []
|
|
363
|
-
if ip_addr_result.returncode == 0:
|
|
364
|
-
import re
|
|
365
|
-
inet_pattern = re.compile(r'inet\s+(\d+\.\d+\.\d+\.\d+)/\d+.*scope\s+global')
|
|
366
|
-
connection_ips = inet_pattern.findall(ip_addr_result.stdout)
|
|
367
|
-
|
|
368
|
-
connection_info = f"👤 Username: {current_user}\n🖥️ Hostname: {hostname}\n🔌 SSH Port: {ssh_port}\n"
|
|
369
|
-
|
|
370
|
-
if connection_ips:
|
|
371
|
-
connection_info += "\n🌐 This machine can be accessed via SSH from other machines on the same network using:\n\n"
|
|
372
|
-
for ip in connection_ips:
|
|
373
|
-
connection_info += f" ssh {current_user}@{ip}\n"
|
|
374
|
-
if ssh_port != "22":
|
|
375
|
-
connection_info += f"\n (Port {ssh_port} should be used: ssh -p {ssh_port} {current_user}@<IP>)\n"
|
|
376
|
-
else:
|
|
377
|
-
connection_info += "\n⚠️ No network IP addresses found - this machine may not be reachable from the network"
|
|
378
|
-
|
|
379
|
-
connection_info += "\n\n💡 From another machine on the same network, use one of the commands above"
|
|
380
|
-
connection_info += "\n💡 Ensure your public key is in ~/.ssh/authorized_keys on this machine"
|
|
381
|
-
connection_info += "\n💡 Or use password authentication if enabled in sshd_config"
|
|
382
|
-
|
|
383
|
-
console.print(Panel(connection_info, title="[bold cyan]SSH Connection Details[/bold cyan]", border_style="cyan"))
|
|
384
|
-
except Exception as conn_error:
|
|
385
|
-
console.print(Panel(f"⚠️ Could not gather connection information: {str(conn_error)}", title="[bold yellow]Connection Info[/bold yellow]", border_style="yellow"))
|
|
386
|
-
|
|
387
|
-
return results
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
if __name__ == "__main__":
|
|
391
|
-
ssh_debug_linux()
|