Testing a shell script on AIX - aix

I develop a POSIX shell script to check SSL certificates and connections.
The script is not running on AIX and I would like to see if I can adapt it.
Is there a free (or cheap way) to get a shell account on an AIX machine to test an open source project?

A relatively cheap way to get a shell account on an AIX machine would be https://www.ibm.com/cloud/free.
It looks like it's free for limited use.

Related

How to detect the OS and CPU architecture of a remote SSH server

I have a program that connects to a remote machine via SSH. I want to upload and run a binary on that machine. In order to do that I need to know what OS it is (I will support Linux, Mac and probably Windows), and what CPU architecture (I will probably only support x86_64, but it would be good to be able to detect others and print a sensible error, if this is possible).
It doesn't look like the SSH protocol itself provides any of this information. Is there a simple, ROBUST way to do this? With as few hacks as possible (no hairy Bash scripts!).
The best thing I can think of is to try running uname -s -m, and whatever the Windows equivalent is and parse the results.
The SSH protocol doesn't provide any information about the remote system except its protocol version. However, oftentimes vendors will include a string in the protocol string. For example, if you do nc gitlab.com 22 </dev/null | head -n 1, you can tell that GitLab runs Ubuntu.
However, not all remote systems provide this information, so for a reliable test, you'll probably need to log into the system. As mentioned, you can run uname on Unix systems, and cmd /c ver on Windows systems to find out what OS you're on. Note that the latter will not work on Windows if you log into a MinGW-based bash on Windows, since the /c will be rewritten as C:\; you'll need to double the slash or use uname there.
I'm not aware of a single command that you can invoke that will work on all systems, so you'll probably have to make multiple shell requests. You are probably better off doing this using an SSH library, since the OpenSSH binary will print any banner from the remote side whether you want it or not, and that can be confused with the output you get from the remote side.

Using saltstack ssh

Is there a difference between using salt-proxy ssh and directly salt-ssh? I'm interested because according to documentation both aimed to run remote commands without agent installation on the end machine.
You cant simply do salt-ssh on a proxy minion, for which you would have to write your own custom ssh interface to the remote system, because your proxy minion may not support doing salt-ssh.
How to choose between using salt-ssh vs salt-proxy totally depends on the type of a minion system.
As stated in the saltstack documentation - https://docs.saltstack.com/en/latest/topics/ssh/index.html and
https://docs.saltstack.com/en/latest/topics/proxyminion/index.html
For salt-ssh to be used, the remote system must have python installed - one of the criteria. For example, controlling ubuntu from centos.
As stated in the salt-proxy doc,
Proxy minions are a developing Salt feature that enables controlling
devices that, for whatever reason, cannot run a standard salt-minion.
Examples include network gear that has an API but runs a proprietary
OS, devices with limited CPU or memory, or devices that could run a
minion, but for security reasons, will not.

executing on a remote machine

The Setup
We have an aircon unit in the office but it takes a good hour to start cooling the place down, I have an IR USB device that communicates via a com port. I have a utility to send various IR codes to control an aircon unit.
I use .bat files to load the .exe and the .bin file
irtoy.exe -d COM4 -p -a 100 -f ACPowerToggle.bin
My question is what's the best way I can execute this on a remote server? Is it possible from a web server or something else?
I suggest using an SSH server like OpenSSH, as well as providing secure access, you can execute programs, manage everything needed as well as direct access to the computer's operating system.
Edit:
Yes, you can use both iOS and Android apps to access your SSH server using a smart phone.

Glassfish administration scripting

I am trying to move a web application that currently runs on WebSphere 6.1 application server over Glassfish 3.X. I currently have a set of WebSphere jacl files that configure an instance of a WAS for my web application (data sources, queues, etc.) and a .bat and a .sh file that execute the jacl files (I think via wsadmin). I develop on a WAS instance on my Windows PC and the software is tested on a WAS instance installed on a Solaris test machine.
Is there the equivalent concept for Glassfish?
That is, does Glassfish have a concept of a platform independent administration scripting language like WebSphere jacl/jython that can be executed from a call from a Windows .bat file or a Unix .sh file?
I'm relatively new to web development and so I may have made some conceptual mistakes and you may also have to fill in some gaps in my question.
Thanks
You can feed a configuration script to asadmin, that contains asadmin subcommands like deploy and create-jdbc-resource, etc...
The 'language' does not have any real flow-of-control or looping constructs, so you would need to flatten those types of things out of the script that would get called by your dot-bat or dot-sh.
If you are really leveraging jacl/jython this might not be possible... but if you aren't putting these interpreters through their paces, the asadmin 'language' may be rich enough for you.
Yes, take at a look at the "asadmin" command. It should be able to configure most anything you need from a script.

dokan sshfs for windows

I read an article here about dokan sshfs for windows. I want to ask if you know similar software (free or not) in order to access windows partitions from windows. Samba is a always an answer, however I am seeking for something more secure.
You can use the Dokan SSHFS client with the OpenSSH server for Windows, you can configure OpenSSH like you would on UNIX, then use the Dokan SSH client to connect remotely, just as you would do on UNIX with sshfs.
When you say Samba, so you mean SMB? Samba is the *NIX client/server for SMB.
SSHFS for accessing Windows partitions from Windows ? Did you by any chance mean Linux partitions from windows ?
If windows-windows, then sorry, no. sshfs is a Linux/Unix feature, and microsoft does all it can to NOT make it work on Windows (after all, that would allow to easily and securely migrate from Windows to Linux). On Windows, you use WebDAV to accomplish similar things, needless to say WebDAV is way more insecure than sshfs.
If you meant accessing remote Linux partitions from Windows, then I had the same problem before:
Dokan doesn't work, at least not on Vista x64. (epic bluescreen crash)
The java sshfs explorer on sourceforge doesn't work, either.
Microsoft's services for unix (including sshfs) are only available on Vista 'Ultimate', not on < Ultimate, like my Vista business for example.
There are some commercial solutions, but first, they are way overpriced, and second, I wouldn't trust them, since they don't offer evaluation.
My solution was to install VirtualBox on Windows, and install an Ubuntu guest on it, mounting the host's C drive. You need to set the VirtualBox network adapter to bridged mode to make sshfs work with virtualization. I'm sorry, but so far that's the only free solution that really works...
imdisk driver, see if http://www.ltr-data.se/opencode.html helps.
From the documentation
It is even possible to boot a machine
with NTFS partitions using a Unix
Live-CD and use the included devio
tool to let ImDisk on another computer
running Windows on the network mount
the NTFS partition on the machine you
booted with the Unix Live-CD. This way
you can recover information and even
run chkdsk on drives on machines where
Windows does not boot.
I've been using Win SSHFS for awhile, is this what you're looking for?
https://github.com/Foreveryone-cz/win-sshfs/
It runs on top of Dokany