Search code examples
amazon-web-servicesamazon-ec2matillion

Matillion: Cannot login with default ec2-user


I've launched a new AWS EC2 instance (m5.large) based on Matillion's latest AMI (Matillion v1.56.9). The instance is coming up fine and I can reach Matillion's login page at https://[internal IP], but I cannot login with the default credentials which are supposed to be "ec2-user" and the instance id ("i-xxxxxx"). Error message is "Invalid username or password".

The EC2 instance has no public IP, that's why I use a private IP.

I can also ssh into the instance.

Can anyone help me find out why login using the default user doesn't work?


Solution

  • I believe the way it's supposed to work is at first boot the ec2-user password in /usr/share/tomcat8/conf/tomcat-users.xml gets set to the sha512sum of the instance ID. As per your comment Tobie that's a good spot but I think the Matillion documentation is just out of date there, from right back when instance IDs really were just 10 characters long!

    I guess it uses the instance metadata service v1 to do that, so if IMDS v1 is not available it might not get created correctly.

    In any case, as long as you can SSH into your server and the Admin / User Configuration is in Internal mode (which is the default) you can fix the password manually like this...

    Become root with sudo -i

    Create the sha512sum of your chosen password like this.

    echo -n "schepo" | sha512sum
    

    Make sure you use the -n otherwise it adds a newline and gets the hash wrong. Mine comes out like 55aa...a1cf -

    Then stop Tomcat so you can update the password

    systemctl stop tomcat8
    

    Fix the relevant line in /usr/share/tomcat8/conf/tomcat-users.xml or add a new one. You have to be really careful to keep the XML valid. Mine ends up like this:

    <user username="schepo" password="55aa00778ccb153bc05aa6a8d7ee7c00f008397c5c70ebc8134aa1ba6cf682ac3d35297cbe60b21c00129039e25608056fe4922ebe1f89c7e2c68cf7fbfba1cf" roles="Emerald,API,Admin"/>
    

    Then restart Tomcat

    systemctl restart tomcat8
    

    It normally takes about 60 seconds to restart. After that you should be able to login via the UI with your new user and/or password.