conveniently query the value of any client-side configuration option - ssh

If I want to see whether option X is enabled for host Y, I can:
scan /etc/ssh/ssh_config for a section matching that host
Look for a setting for that option
Do the same for ~/.ssh/config
Look in the documentation for the default value of that option.
However that's kind of a lot of steps and the client program itself does all of these things when it starts up, so it seems like there must be a way to just get the client to provide the answer. Is there?

Related

Configuration for PowerShell module created via .NET framework

What's the best practice when you have dependencies that you want to be able to configure when creating a PowerShell module in C#?
My specific scenario is that the PowerShell module I am creating via C# code will use a WCF service. Hence, the service's URL must be something that the clients can configure.
Is there a standard approach on this? Or will this be something that must be custom implemented?
A somewhat standard way to do this is to allow a value to be provided as a parameter or default to reading special variable via PSCmdlet's GetVariableValue. This is what the built-in Send-MailMessage cmdlet does. It reads the variable PSEmailServer if no server is provided.
I might not be understanding your question. So I'll posit a few scenarios:
You PS module will always use the same WCF endpoint. In that case you could hardcode the URL in the module
You have a limited number of endpoints to choose from, and there's some algorithm or best practice to associate an endpoint with a particular user, such as the closest geographically, based on the dept or division the user is in, etc.
It's completely up to the end user's preference to choose a URL.
For case #2, I suggest you implement the algorithm/best practice and save the result someplace - as part of the module install.
For case #3, using an environment variable seems reasonable, or a registry setting, or a file in one of the user's profile directories. Probably more important than where you persist the data though, is the interface you give users to change the setting. For example if you used an environment variable, it would be less friendly to tell the user to go to Control Panel, System, Advanced, Environment, User variable, New..., than to provide a simple PS function to change the URL. In fact I'd say providing a cmdlet/function to perform configuration is the closest to a "standard" I can think of.

How do I check sendmail's mode of operation?

I have created a wrapper around the sendmail executable, and it should not actually do anything unless sendmail is being invoked in its default mode of operation.
How to reliably determine whether this is the case?
What I have thus far:
the executable's name must be sendmail
none of the words on command arguments must be -I or start with -b except -bm
Will that be perfect - regardless of which implementation of sendmail is actually being used - or may it misclassify certain cases?
You should approach it from the other side. Check list of valid/acceptable command line options and treat all others as unacceptable. "Sendmail look alike" may accept quite non standard options.
BTW "sendmail from sendmail.org" is no longer installed (by default) as set root id.

Multiple SSH public keys into a single file

I'm trying to sftp to a host which acts as a load balancer and routes to 3 other systems based on round robin.
Our public key is setup on their systems. Yet, when ever I try to connect, I get prompted with a "Man in Middle attack" message asking us to verify the key finger print. To over come this I tried adding their public host key into .ssh2/hostkeys/key22_22_hostname.pub file.
Problem is I can't add 3 keys into this file, it seems to accept only one key?
Any suggestions on how to overcome this issue or add 3 public keys into one key22_22_hostname.pub file?
This is on AIX system.
How about cheat and copy the one system's keys to the others? I know is sorta scummy but in this case, it might be appropriate.
I believe those keys are found in /etc or maybe /etc/ssh.

Caliper benchmark online results are not generated

I followed the isnstructions in http://code.google.com/p/caliper/wiki/OnlineResults?show=content and have a key generated for me. I put this key into the file ~/.caliperrc in my Linux machine and defined the account on Google. When I run my benchmark nothing happens there: on my page on http://microbenchmarks.appspot.com it is "No benchmarks yet".
So, this should definitely work for you. A few things to check:
You included the whole line. The "apiKey:" part is necessary. So you should have a whole line that looks like: apiKey: ffffffff-0000-0000-0000-ffffffffffff
It could be that there are connectivity issues. You're not behind a proxy or something are you? If you need to, you can specify the proxy as: proxy: foo.com:8080

Setting USB configuration fails

I'm trying to talk to a USB device using libusb, but I feel like I'm tripping up on the first leg of the race. I know precisely what endpoints I need to talk to, etc., but I can't even get that far. I have, in essence:
usb_device *dev = ...; // opened from get_busses()
usb_set_configuration(dev, dev->config[0].bConfigurationValue); // bConfigVal = 1
Now, I can look at the device information in debug mode and I know that the current configuration is 0 (uninitialized / just after restart), and there's exactly 1 valid configuration, which has a configuration number of 1. But when I set the config to 1, I get a return value of -22, which (passed through the stringifier) translates to "windows api error: bad parameter.
I haven't been able to find other people having a similar problem, and it seems like such a simple thing to do -- I can't even claim the interface, or set the alt-interface, or anything like that, because I have to set the configuration first. What am I missing? (if it matters: this is on WinXP)
Looking at libusb-win32\src\driver\set_configuration.c, there seem to be a bunch of different reasons for returning STATUS_INVALID_PARAMETER.
Use libusb_set_debug (from your user mode application) to set verbose debug level, then run Sysinternals DebugView to see the driver's error messages. Hopefully you'd see a clue as to why your set_configuration call fails.