aws / aws/ec2-macos-init

Temporary files not removed from disk

Open
#21 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
167
Forks
21
Avg merge
58m
Merged PRs (30d)
1

Description

The `sshd_config` modifications made by `ec2-macos-init` uses a temporary file to update and then compare to the existing configuration file before applying any changes ([created here](https://github.com/aws/ec2-macos-init/blob/fc74356c2a795bbb4a6eb3a7d3ef59bb5d3bbe35/lib/ec2macosinit/systemconfig.go#L348-L353)). However, these temporary files seem to be left on disk after the operation is done.

On an instance that I rebooted several times I see _multiple_ files left in `/tmp`:

```
ec2-user@ip-172-31-62-43 ~ % ls /tmp/
com.apple.launchd.5O7s1pP1Gq/ sshd_config_fixed.2294640314 sshd_config_fixed.3869842079
powerlog/ sshd_config_fixed.2311931466 sshd_config_fixed.3878101156
sshd_config_fixed.1016582453 sshd_config_fixed.2314509148 sshd_config_fixed.3904118392
sshd_config_fixed.1020066001 sshd_config_fixed.2348638890 sshd_config_fixed.3922202374
sshd_config_fixed.1061347728 sshd_config_fixed.2390874271 sshd_config_fixed.3987730433
sshd_config_fixed.1084247386 sshd_config_fixed.2415669786 sshd_config_fixed.403329088
sshd_config_fixed.1174548489 sshd_config_fixed.260173097 sshd_config_fixed.403969368
sshd_config_fixed.1198166715 sshd_config_fixed.2644517165 sshd_config_fixed.4096292280
sshd_config_fixed.1238396730 sshd_config_fixed.2732880134 sshd_config_fixed.410938756
sshd_config_fixed.1318910027 sshd_config_fixed.2751583013 sshd_config_fixed.4148520672
sshd_config_fixed.1396561690 sshd_config_fixed.2751954804 sshd_config_fixed.4181149975
sshd_config_fixed.1471872395 sshd_config_fixed.2753256534 sshd_config_fixed.446700188
sshd_config_fixed.1472261387 sshd_config_fixed.27615544 sshd_config_fixed.450193813
sshd_config_fixed.1486606662 sshd_config_fixed.2763655655 sshd_config_fixed.466413888
sshd_config_fixed.1521920941 sshd_config_fixed.2774642232 sshd_config_fixed.489539309
sshd_config_fixed.1549957341 sshd_config_fixed.2787941653 sshd_config_fixed.539074167
sshd_config_fixed.1564784453 sshd_config_fixed.292192717 sshd_config_fixed.543115998
sshd_config_fixed.1616211206 sshd_config_fixed.3012375491 sshd_config_fixed.544758397
sshd_config_fixed.1646684410 sshd_config_fixed.3159192364 sshd_config_fixed.545954790
sshd_config_fixed.1673875910 sshd_config_fixed.3166278449 sshd_config_fixed.586346516
sshd_config_fixed.1732833519 sshd_config_fixed.317516976 sshd_config_fixed.620280068
sshd_config_fixed.1776722012 sshd_config_fixed.327385459 sshd_config_fixed.630240781
sshd_config_fixed.1854411164 sshd_config_fixed.3284703002 sshd_config_fixed.656025341
sshd_config_fixed.1864318779 sshd_config_fixed.3328524932 sshd_config_fixed.659782704
sshd_config_fixed.188557474 sshd_config_fixed.3360149128 sshd_config_fixed.668496975
sshd_config_fixed.195013777 sshd_config_fixed.3386401471 sshd_config_fixed.879073309
sshd_config_fixed.1975404272 sshd_config_fixed.341589259 sshd_config_fixed.881388298
sshd_config_fixed.1995487944 sshd_config_fixed.3426774216 sshd_config_fixed.895476082
sshd_config_fixed.2033224975 sshd_config_fixed.3449763983 sshd_config_fixed.89963739
sshd_config_fixed.2041391402 sshd_config_fixed.3470231482 sshd_config_fixed.930628740
sshd_config_fixed.2044820707 sshd_config_fixed.3500722784 sshd_config_fixed.991179073
sshd_config_fixed.2047737407 sshd_config_fixed.359699417 tmp-mount-4koN2z/
sshd_config_fixed.212213366 sshd_config_fixed.3692586103 tmp-mount-GoCfBL/
sshd_config_fixed.2125913039 sshd_config_fixed.378003445 tmp-mount-ihBPxI/
sshd_config_fixed.2127578993 sshd_config_fixed.3800660833 tmux-501/
sshd_config_fixed.2230707292 sshd_config_fixed.3838627238
```

Contributor guide

Open the contributing guide

Research direction

Start in lib/ec2macosinit/systemconfig.go at the temporary-file creation and comparison code linked in the issue, then trace the operation through its completion and error paths. Confirm that each temporary sshd_config_fixed file is removed after use, including when the update fails, and verify that repeated operations no longer leave files in /tmp.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.