ssh-refactor - #187
Merged
Merged
Conversation
added 25 commits
July 24, 2026 21:51
… last few changes
…ment helper function to rewrite callback on-the-fly
…iders / agent and the ssh connector
…ther jail causes general fails on enabeling disabeling other jails
…query and cause un-needed network traffic
…ader, before overwrite
…le update is needed, e.g. on jail enabling/disabling
…ion problem with the folder
…ement the jail-name validators too & cleanup old now not anymore used functions
…in case someting should race, and call multible renders (should not happen) we are protected. Also we do not fetch all data on jail disable
| return | ||
| } | ||
| sc.masterUp.Store(false) | ||
| if _, err := os.Stat(sc.controlPath()); err == nil { |
| } | ||
| sc.masterUp.Store(false) | ||
| if _, err := os.Stat(sc.controlPath()); err == nil { | ||
| _ = os.Remove(sc.controlPath()) |
| return | ||
| } | ||
| if sc.masterUp.Load() { | ||
| if _, err := os.Stat(sc.controlPath()); err == nil { |
| } | ||
|
|
||
| func (sc *SSHConnector) checkMaster(ctx context.Context) bool { | ||
| check := exec.CommandContext(ctx, "ssh", "-O", "check", "-o", "ControlPath="+sc.controlPath(), sc.sshTarget()) |
| } | ||
|
|
||
| func (sc *SSHConnector) checkMaster(ctx context.Context) bool { | ||
| check := exec.CommandContext(ctx, "ssh", "-O", "check", "-o", "ControlPath="+sc.controlPath(), sc.sshTarget()) |
|
|
||
| // Runs one ssh process, keeping stdout and stderr strictly separate | ||
| func (sc *SSHConnector) execSSH(ctx context.Context, args []string, stdin io.Reader) (string, string, error) { | ||
| cmd := exec.CommandContext(ctx, "ssh", args...) |
| base = filepath.Join(cache, "fail2ban-ui", "ssh-ctl") | ||
| } | ||
| if base != "" { | ||
| if err := os.MkdirAll(base, 0o700); err == nil { |
| return nil, fmt.Errorf("invalid glob pattern: %w", err) | ||
| } | ||
| if len(matched) == 0 { | ||
| if _, statErr := os.ReadDir(filepath.Dir(logpath)); statErr != nil && os.IsPermission(statErr) { |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.