Drop the one-time recovery script
The deployment restores the keys as well, so the script is not needed anymore. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
fd1e379fcf
commit
a86a3c7b47
2 changed files with 2 additions and 27 deletions
|
|
@ -69,7 +69,6 @@ undoes that.
|
|||
- `scripts/make_files.py` - builds the four text files.
|
||||
- `scripts/deploy.sh` - deploys the cleanup to the server and installs it.
|
||||
- `scripts/install_restore_task.ps1` - installs the scheduled task.
|
||||
- `scripts/restore_ssh_access.cmd` - puts the SSH access back, for when the home directory was deleted.
|
||||
|
||||
The four text files are built from the website's pages, the other files in the resources are edited by hand:
|
||||
|
||||
|
|
@ -94,5 +93,5 @@ runs at startup. Remove it again with `-Uninstall`.
|
|||
|
||||
## Getting the SSH access back
|
||||
|
||||
If the home directory was deleted, the key that lets the website in went with it. Over RDP, as Administrator, run
|
||||
`scripts/restore_ssh_access.cmd`. From then on the cleanup puts the key back by itself.
|
||||
If the home directory was deleted, the key that lets the website in went with it. The cleanup puts it back by
|
||||
itself, within half an hour; to do it right away, run the deployment again - the installer starts the job once.
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
@echo off
|
||||
REM Puts the SSH access back that a deleted home directory took with it: the key the website logs in with, in the
|
||||
REM home of the root user, and the key of the deployer in the home of the Administrator. Run it as Administrator on
|
||||
REM the box, for example over RDP. The cleanup job puts the key of the website back by itself from then on.
|
||||
setlocal EnableDelayedExpansion
|
||||
set KEY=ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJDweEH8bhZAHVaAedhTVDb2j/oMEn3vm97xCwCw9LC9 root@nowhere.wirs.ing cygwin-2222
|
||||
set OWN=ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBTHzLm8QMhHIo7kFAvtAFnqpspeR3L3gM8kLoG1137 lennart@erms
|
||||
set BLOB=AAAAC3NzaC1lZDI1NTE5AAAAIIBTHzLm8QMhHIo7kFAvtAFnqpspeR3L3gM8kLoG1137
|
||||
|
||||
if not exist C:\msys2\home\root\.ssh mkdir C:\msys2\home\root\.ssh
|
||||
> C:\msys2\home\root\.ssh\authorized_keys echo %KEY%
|
||||
echo %OWN% >> C:\msys2\home\root\.ssh\authorized_keys
|
||||
|
||||
if not exist C:\Users\Administrator\.ssh mkdir C:\Users\Administrator\.ssh
|
||||
findstr /c:"%BLOB%" C:\Users\Administrator\.ssh\authorized_keys >nul 2>&1 || echo %OWN% >> C:\Users\Administrator\.ssh\authorized_keys
|
||||
|
||||
REM The user owns their .ssh, so that they can add keys of their own.
|
||||
for /f "tokens=5" %%i in ('findstr /b "root:" C:\msys2\etc\passwd') do set SID=%%i
|
||||
set SID=!SID:*,=!
|
||||
if not defined SID goto :done
|
||||
icacls C:\msys2\home\root\.ssh /grant *!SID!:(OI)(CI)F /t
|
||||
icacls C:\msys2\home\root\.ssh /setowner *!SID!
|
||||
:done
|
||||
echo The SSH access is back.
|
||||
Loading…
Reference in a new issue