Keep the logs for years
The sshd log is rotated at a hundred megabytes instead of one, and the event logs of windows are made that big as well: they are the only record of what the box itself did, and twenty megabytes are not much with all the connections. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
5a885e3781
commit
a813326312
1 changed files with 11 additions and 3 deletions
|
|
@ -497,15 +497,22 @@ Set-Content -LiteralPath $sshdConfig -Encoding ascii -Value @(
|
|||
# The sshd runs as SYSTEM from the protected copy, with opt/kik first on the path so its own DLLs and the session's
|
||||
# programs (zsh, cat) are the protected ones. The log stays in the install directory, out of the user's reach.
|
||||
# The log is appended to, not overwritten: it is the only trace of what the server did, and a server that is
|
||||
# restarted would otherwise take the evidence of the outage with it.
|
||||
# restarted would otherwise take the evidence of the outage with it. It is rotated at a hundred megabytes, which
|
||||
# takes years to reach.
|
||||
Set-Content -LiteralPath $sshdBat -Encoding ascii -Value @(
|
||||
'@echo off',
|
||||
'set PATH=C:\msys2\opt\kik;C:\msys2\usr\bin;%PATH%',
|
||||
'rem Keep the previous log if it grew too big; the current one is appended to.',
|
||||
'if exist C:\ProgramData\kik-restore\sshd.log for %%f in (C:\ProgramData\kik-restore\sshd.log) do if %%~zf GEQ 1048576 move /y C:\ProgramData\kik-restore\sshd.log C:\ProgramData\kik-restore\sshd.log.1',
|
||||
'if exist C:\ProgramData\kik-restore\sshd.log for %%f in (C:\ProgramData\kik-restore\sshd.log) do if %%~zf GEQ 104857600 move /y C:\ProgramData\kik-restore\sshd.log C:\ProgramData\kik-restore\sshd.log.1',
|
||||
'C:\msys2\opt\kik\sshd.exe -D -e >> C:\ProgramData\kik-restore\sshd.log 2>&1'
|
||||
)
|
||||
|
||||
# The event logs of windows are made bigger as well: they are the only record of what the box itself did, and
|
||||
# twenty megabytes are not much with all the connections.
|
||||
foreach ($eventLog in 'System', 'Application', 'Security') {
|
||||
wevtutil sl $eventLog /ms:104857600 | Out-Null
|
||||
}
|
||||
|
||||
# The installation's own cygrunsrv sshd service would fight for port 22; the scheduled task owns the sshd instead.
|
||||
Set-Service $service -StartupType Disabled -ErrorAction SilentlyContinue
|
||||
Stop-Service $service -Force -ErrorAction SilentlyContinue
|
||||
|
|
|
|||
Loading…
Reference in a new issue