GCS Tech, Inc.
12 E. 4th
St.
Spencer, IA 51301
712-262-6974
Date: Nov.22, 2019
1. Buffalo Terastation
enable SSH for adding the Check_MK agent
I wanted
to add the Check_MK agent to a Buffalo Terastation TS3410R and I found there is no way to enable
SSH on the unit. Everything on the web
that I find is for older units and the use of ACP Commander will no longer
enable SSH, but it does come in handy for this fix. Here is how I enabled SSH and then installed
the Check_MK agent.
Standard
Warning: Following these instructions
may void your warranty with Buffalo and could cause the unit to become
unusable. You follow these directions at
your own risk. Do not blame me if you cause issues.
Log into
the Terastation
In the web
interface go to File Sharing
Enable
SFTP
Enable rsync and then click the gear icon
Put your
admin password in the blank and click to enable rsync
over SSH
Click OK
to save.
This enables
SSH on the unit but we still can’t log in.
I used the
ACP Commander from https://gry.ch/Java/styled.
I downloaded the EXE for Microsoft Windows as I have an older box that I
keep with Java 6.x running on it just for such occasions. The EXE works fine on it.
Open ACP
Commander it will find the IP address and port for your Terastation. Put in the admin password and type the
following in the Command: box.
sed -i ‘s/rbash/bash/g’ /etc/passwd
Click Go!
This
changes the admin user from a restricted bash shell to a regular bash shell.
Now I
could SSH into the Terastation as admin
Then I had
no sudo privileges so the account was extremely
limited on what it could do.
So in
ACP Commander I put
usermod
-a -G sudo admin
In the
Command: box and clicked Go! This adds
the admin user to the sudo group.
Now I
could log via SSH as admin and run sudo commands.
I rebooted
the unit to see if it was going to undo anything I had done so far. When it came up I could still SSH in as admin
and run sudo.
I used
sudo
passwd root
And
changed the root password to something that I knew.
To be able
to su up from admin to root we need to edit the /etc/pam.d/su file and comment out the line that reads
auth required pam_wheel.so
use_uid
Now we can
su to root with the following
/bin/su
Time to
fix the $PATH of the user admin
sudo
/bin/vi /home/.bash_profile
Change it
to look like this
Export
PATH=”/home/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin”
Save the
file
Now to
give admin a true home directory
su to
root
/bin/su
Now we run
vipw to edit the password file and change the admin
line to:
admin:x:707:707::/home/admin:/bin/bash
save the
file and issue the following commands
mkdir
/home/admin
cp /home/.bash_profile /home/admin/
chown
-R admin:admin /home/admin
Log out
and back in as admin and we will have a normal user that can use sudo and su to run root commands.
On to Check_MK agent installation
Copy the check_mk_agent.linux file from
your Check_MK server it will be under
/opt/omd/sites/<site name>/share/check_mk/agents
to the Terastation. I used scp from the Terastation to the
box that had the file. I placed the file
in the /usr/local/bin directory. Then
mv /usr/local/bin/check_mk_agent.linux
/usr/local/bin/check_mk_agent
chmod
775 /usr/local/bin/check_mk_agent
vi /etc/services
do a /6446
enter to search for 6446 and take you to that line. Add a line directly under it with the
following
check_mk 6556/tcp
And save
the file.
vi /etc/inetd.conf
And add
the line
check_mk stream tcp nowait root /usr/local/bin/check_mk_agent check_mk_agent
and save
the file.
/etc/init.d/inetd.sh
restart
Now from
another box or the Check_MK server you can issue
telnet
<Terastation IP address> 6556
and you
will get the agent output, and you can add the Terastation
to Check_MK. I
enabled SNMP on the Terastation through the web
interface and ran both the Agent and SNMP queries from Check_MK. You will be able to monitor most aspects of
the Terastation, included the RAID health which it
what I was originally looking for.
Did the
first firmware upgrade today and all of the user information stayed intact. I could log in via SSH and su
up to root. I had to redo the complete Check_MK agent installation above but that was it. (04-21-20)