/build/static/layout/Breadcrumb_cap_w.png

Using native bash command (echo) in script - what directory?

I'm working on a script to create a single-line js file inside Firefox.app on Mac OS (/Applications/Firefox.app/Contents/MacOS/defaults/pref). The command is:
echo 'user_pref("security.tls.version.min", 1);' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/all-pcc.js
Since this is just one command, I'd like to avoid creating and pushing a separate script file, if possible. 

Just using root "/" as the directory seems to work, but the file that results is empty, though in the right place.

Thanks,
Ric

1 Comment   [ + ] Show comment
  • One of my coworkers discovered that you can write the command to a [any-name].js file in this folder and it will run for all users. There's already a file, channel-prefs.js in there. I relented and wound up using a script and that worked. The browser now passes the poodlefix.com test. There is an error in my example, though. The string needs to begin with "echo 'user(..." not "echo 'user_pref(..." when used in a .js file in this directory. Originally, I was working on looping through the users to add a users.js file to file to ~/Library/Application Support/... but that was going beyond my limited bash scripting skills. runuser would have been great, but it doesn't appear to be implemented in the Mac OS shells. We have sudo -u [username] but I'm not sure how well that would work when run from the K1000. Any good KKE's or documents on writing KACE scripts for the Mac? Your conference sessions covered deployment quite well but there seems to be a lot of scripting issues that are unique to the Mac. - rgetter 9 years ago

Answers (2)

Posted by: SMal.tmcc 9 years ago
Red Belt
0
not positive about mac FF but windows that pref file was under every user and I had to change it in each users profile.

cd /D "%APPDATA%\Mozilla\Firefox\Profiles\*.default"
echo user_pref("security.tls.version.min", 1);>>prefs.js - See more at: http://www.itninja.com/question/k1000-k2000-poodle-and-sslv3#sthash.MNXeAP31.dpuf
cd /D "%APPDATA%\Mozilla\Firefox\Profiles\*.default"
echo user_pref("security.tls.version.min", 1);>>prefs.js

if that is the case for macs you should be able to use

runuser -l  userNameHere -c 'command'
to run as user so you hit the users /Applications/ folder vs the systems with the fix
Posted by: rgetter 9 years ago
Senior White Belt
0
One of my coworkers discovered that you can write the command to a [any-name].js file in this folder and it will run for all users. There's already a file, channel-prefs.js in there. I relented and wound up using a separate shell script (dependency) and that worked. The browser now passes the poodlefix.com test. 

There is an error in my example, though. The string needs to begin with "echo 'user(..." not "echo 'user_pref(..." when used in a .js file in this directory.  

Originally, I was working on looping through the users to add a users.js file to file to ~/Library/Application Support/... but that was going beyond my limited bash scripting skills. runuser would have been great, but it doesn't appear to be implemented in the Mac OS shells. We have sudo -u [username] but I'm not sure how well that would work when run from the K1000. 

Any good KKE's or documents on writing KACE scripts for the Mac? Your conference sessions covered deployment quite well but there seems to be a lot of scripting issues that are unique to the Mac.

Thanks!

Comments:
  • The quotes were probably getting changed when the shell script was saved, which is why uploading the shell script worked. You can click the link to modify the XML of a script but for more complicated scripts I often find it is easier to upload. That way I can test the script by running it manually on my machine or a test machine and then upload it directly to KACE. - chucksteel 9 years ago
  • working on macs a lot more now so as I pick up tricks I will post them. There also are some of highly skilled mac folks on ITninja, I have picked up a lot of things reading thru posts from them. - SMal.tmcc 9 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ