0

I'd consider myself as 'intermediate' with Azure, so go easy please! So I'm the middle of building a Magento site on a CentOS 7.2 (OpenLogic) VM in Azure (Resource Manager model) DS3_V2.

All was well, SSH access was fine and Apache running OK and presenting the site fine (albeit still in development). However yesterday, and attempts SSH into the box return a 'connection refused' error from PuTTY. Both myself and our developers are a at a loss as to what has happened and I'm hoping someone can help. Here's what I've tried to resolve so far:

  1. Reset SSH config from the portal, no joy.
  2. Taken a backup of the VM, restored as new VM, redeployed the backup, still no joy.
  3. Checked the NSG allows SSH from the my IP, no problems there.
  4. I never touched iptables or selinux, and the devs assured me that they haven't either.
  5. Nothing sticks out in the boot diagnostics to me (although I can provide this if required).

It seems that the devs weren't as au fait with Azure I thought, as instead of using the dedicated persistent VHD I attached for them, they have either installed Magento, web content at all on the 32GB system drive or (god forbid) on the 127GB temporary drive that the VM comes with (they can't tell me at this stage what they've done).

So whilst I'm stumped as to the cause of the exact issue, my more pressing question is - is there any way I can get in to look at and configure the SSH server, having no SSH access to the box?! I'm thinking Azure CLI or (less likely Azure Powershell)? Mount the VHD on another VM and get into the config files?!

Any thoughts at this stage would be a huge help as this is a critical project that is now stalled because of this issue.

Thanks, Tony

Tony Blunt
  • 167
  • 4
  • 14
  • Sorry also forgot to mention that Magento has also gone down. Apache is running as it's throwing a Magento error page 'There has been an error processing your request, but with nothing more useful than 'Exception printing is disabled by default for security reasons' :( – Tony Blunt Oct 20 '16 at 23:35
  • Related http://serverfault.com/q/725262/340408 – StandardEyre Oct 20 '16 at 23:44
  • Do you have console access to the CentOS 7.2 VM? Are you able to log in and look at the ssh logs? – StandardEyre Oct 20 '16 at 23:51
  • Thanks for the comments both, but this being Azure I have no console access. The best it gets is the boot diagnostics output I can get which is read-only. Having console access to fix the issue is a luxury I don't have I'm afraid. Just as RDP is your only option with a Windows VM (excluding 3rd party solutions). – Tony Blunt Oct 21 '16 at 00:02

2 Answers2

0

Unfortunately in Azure, there is no console access into the VMs. If you lose remote connectivity, you need to follow the troubleshooting steps above.

There is a way, via the Azure VM Extension, to run a custom script on the VM. See https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-classic-lamp-script/ for more details. You could try and craft a script to disable the firewall and/or reset SSH.

The link to the github is https://github.com/Azure/custom-script-extension-linux

CtrlDot
  • 349
  • 1
  • 3
0

Based on my knowledge, the error maybe caused by SSHD service is not running or SSHD listening port is changed. If you could not have console access to the VM, we would use VM Extensions “CustomScriptForLinux” to get SSH logs.

If possible, I recommend you to create a VM in the same VNet which could help to analyze this problem. You could delete it after the problem is solved. Please refer to the steps below.

1.Make sure the port that SSHD is actually listening on

•save as the name “script.sh”

netstat -natp | grep sshd|grep LISTEN|awk '{print $4}'

• Install the “CustomScriptForLinux” Resource groups-->your VM-->Extensions-->Add-->CustomScriptForLinux

• Upload the script.sh

• Get the SSHD port enter image description here

If SSHD service is not running, please run the below command by using CustomScriptForLinux

service sshd restart

2. Disable firewall

If possibe,I recommend you to disable firewall when you analyze the problem. Please run the below command by using CustomScriptForLinux.

service iptables stop

3.SSH from the new VM, Get SSH logs

• login into the new VM

• You can get the client ssh debug log

ssh -vvvv -p 22 user@ip (22 the listening port)

• Get service sshd log

tail -10 /var/log/messages

save as the name “script.sh”

Install the “CustomScriptForLinux”. If you have installed it, please uninstall it.

Get the sshd logs from VM

If you have any error log, welcome to post back here, we could analyze it together.

Regards,

Walter

Shui shengbao
  • 3,503
  • 1
  • 10
  • 20