Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Updates keep overriding ssh security settings

This isn't really a question, but more of a complaint and a plea:


I have repeatedly -- with every update since 2010 -- had Apple override my ssh security settings with the default, less-secure settings of

#PasswordAuthentication yes

#ChallengeResponseAuthentication yes

#EnablePAM yes


These are not what I want, nor are they appropriate defaults, in my opinion, for any system. The defaults should be no, no, and no.


Can Apple PLEASE not overwrite the user's carefully considered sshd_config when making a system update? Every time, you've opened up security holes I had nailed closed.


Thanks in advance for doing it right in your next system update.

iMac, macOS Sierra (10.12.4), null

Posted on Apr 19, 2017 9:11 PM

Reply
Question marked as Best reply

Posted on Apr 24, 2017 4:10 PM

I don't know if launchd is running during an install or not. But I know that the OS is busy doing its install thing and isn't going to be notifying the user.


There might be a number of such scripts floating around on the internet. One example is OSXRipper (https://github.com/bolodev/osxripper). Another example is DetectX (https://sqwarq.com/detectx/). I haven't tried either.

17 replies
Question marked as Best reply

Apr 24, 2017 4:10 PM in response to Drew Reece

I don't know if launchd is running during an install or not. But I know that the OS is busy doing its install thing and isn't going to be notifying the user.


There might be a number of such scripts floating around on the internet. One example is OSXRipper (https://github.com/bolodev/osxripper). Another example is DetectX (https://sqwarq.com/detectx/). I haven't tried either.

Apr 25, 2017 6:58 PM in response to Hugh_Gibbons

I did give this a little more thought, I'd make a simple sqlite or even plain text DB of hashes for the configs that matter to you. Keeping duplicate configs is messy now I think about it.


If the update changes a file the hash will change. It should be a little easier to manage. Just a script to update hashes in a db & the job to check at boot.

It could be a simple 'for each line check the hash' job.


You could use shasum in bulk…

shasum /path/config > test.txt

shasum /path/config2 >> test.txt

# to verify

shasum -c test.txt

/path/config1: OK

/path/config2: FAILED


Set it up to mail you if you want to avoid login issues, a system wide launchd job will send no matter who starts up a Mac.


I don't know anything about it but from the name I'd expect the built in audit system to be useful here but I can't really see how to configure it, it is discussed around the web a few times…

File Auditing (auditd?) Question

http://www.netsq.com/Tools/AuditExplorer/(app now defunct)


Hugh_Gibbons wrote:


Why isn't Apple's First Rule of Updates, "Don't mess with a user's custom configuration but if you really must (don't) but if you do, tell them what you changed?"

Sadly Apple's first rule overrides it…

"Apple knows better than users."

Apr 20, 2017 9:27 PM in response to Barney-15E

The convention is for the default settings to be commented in the way I have shown. In the default version of the file, that's how they appear, which means they are the default openssh settings.


Every time MacOS updates, it overwrites whatever settings I have made in sshd_config. I set them to

PasswordAuthentication no

ChallengeResponseAuthentication no

EnablePAM no


This results in only being able to log in using PKE, which is how I want my system configured. This should be a choice solely determined by the owner of the computer. Apple should not override user security settings.

Apr 20, 2017 9:59 PM in response to Hugh_Gibbons

This has been happening since 2010?

I don't recall this happening & I have similar edits to /etc/sshd_config & have done so for years.


'pkgutil' will list what the receipts say about installers that ran. In Terminal, see what installed & edited your sshd binary (check your sshd path first with locate or whereis)…

pkgutil -v --file-info /usr/sbin/sshd

… shows list of packages


Now repeat for /etc/sshd_config

pkgutil --file-info /etc/sshd_config

… I get no packages listed, how about you?


You can also see the files in any of the packages that were listed

pkgutil -v --files com.apple.pkg.BaseSystemBinaries | grep etc



I don't doubt it happens I have had other configs squashed by updates. I'd investigate creating a watch path for your config file - launchd can mail you or notify you of changes. It's a pain but getting notified early is better than nothing I guess.

Apr 21, 2017 10:14 AM in response to Hugh_Gibbons

Hugh_Gibbons wrote:


Not really sure they'd consider this a bug, but it's definitely not how you want an updater to work. It should leave settings alone where they don't present a problem with the new version of the system.

Hello again Hugh_Gibbons,

Maybe it would be an enhancement request then. But the OS is doing something you don't like, so you have the right to complain about it.


I have an ulterior motive too. Apple is not consistent when dealing with these configuration files. One of my pet peeves is the sudoers file. Malware and "clean up" software like to edit that file to give themselves root privileges without having to ask the user every time or take other safe precautions. But as soon as that file is modified, Apple software updates will never update it again, persisting those back doors for all future updates. Yet when you update sshd_config to make it more secure, your changes get blown away.

Apr 21, 2017 11:12 AM in response to Hugh_Gibbons

Obviously if things are different on your OS you change them. I tested on an earlier OS which I was on at the time, I should have been clear about that, sorry. The first command lists relevant packages if you give it the location you are interested in.

pkgutil will only allow you to see which updates changed things - if security updates repeatedly alter it you know that you need to be wary of them. Otherwise just make a list & pass it on to Apple so they can at least confirm without having to hunt for evidence.


There is an example for a launchd watchpath in this stack overflow page…

http://stackoverflow.com/questions/1515730/is-there-a-command-like-watch-or-inot ifywait-on-the-mac

If you install something like terminal notifier you could get notified instead of just a log message.


Also see the manual if you do create one…

man launchd.plist

Apr 24, 2017 12:49 PM in response to etresoft

I'm not clear on how launchd is not running during install as it is the first process started from the kernel, however you probably know more about it than me 🙂


To get around that issue I'd consider making a script to diff the config against a copy of the edited config to notify on boot (or check daily etc). It's a pain but Apple repeatedly alter configs that they install.


I suspect there are tools that already monitor files for auditing that could be bent into notifying when any configs change. I wonder if the audit daemonhas the ability to do that?


I guess another option is to install ssh & use it instead of Apples version.


@Hugh_Gibbons, FWIW pkgutil doesn't follow symlinks so /private needs to be included…

$ pkgutil -v --file-info /private/etc/ssh/sshd_config

com.apple.pkg.Essentials is where it originates on 10.12 and 10.12.4 updated it on my Mac.

Apr 25, 2017 5:49 PM in response to etresoft

I think I'm inclined to make my own notifier that diffs the file against a copy in another location that runs on boot and maybe makes a diff report if it finds anything and sets it up to open automagically when I I log in. Only trick is, I'm not the only or most frequent user of that machine. My wife uses it but she doesn't use ssh so I haven't enabled it for her login, just mine.


Fun with scripting, yay!


But this is something users just shouldn't have to do.

Why isn't Apple's First Rule of Updates, "Don't mess with a user's custom configuration but if you really must (don't) but if you do, tell them what you changed?"

Apr 25, 2017 8:55 PM in response to Drew Reece

I ended up writing a script to do a file diff. That's not as efficient as keeping a database of hashes but it shows me exactly what changed. I'd have to do the diff anyway to find out WHAT changed so I could examine it and change it back if needed.


The script runs every time I log in, controlled by the launch daemon.


Now let's hope Apple doesn't clean out my ~/Library/LaunchAgents or unregister my plists. That would really be icing on the cake.😁

Updates keep overriding ssh security settings

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.