Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 22.04 - no obvious errors, but no components get installed #145

Open
lifeboy opened this issue Jul 26, 2024 · 3 comments
Open

Ubuntu 22.04 - no obvious errors, but no components get installed #145

lifeboy opened this issue Jul 26, 2024 · 3 comments

Comments

@lifeboy
Copy link

lifeboy commented Jul 26, 2024

Has something changed in the sources? I have no deleted the failed VM and reinstalled a newer version (Ubuntu 22.04) and did the following as root:

apt update
apt upgrade
apt install curl tzdata
dpkg-reconfigure tzdata  

(set the timezone to Africa/Johannesburg)

dpkg-reconfigure locales 

(set the default to en_ZA.UTF-8)
from the /root directory:

curl -L https://power-mailinabox.net/setup.sh | sudo bash 

The script installs the dependencies, adds en_US.UTF-8 to the locales, prompts for the admin user, servername and this:

Mail-in-a-Box Version:  v60.5

Updating system packages...
Installing system packages...

Current default time zone: 'Africa/Johannesburg'
Local time is now:      Fri Jul 26 09:14:31 SAST 2024.
Universal Time is now:  Fri Jul 26 07:14:31 UTC 2024.

Initializing system random number generator...
Creating SSH key for backup…

If a re-run mailinabox, nothing more than this is repeated.

This is crazy, I have multiple people that run mail servers with this exact process and it just installed fine. Now it doesn't.

@lifeboy
Copy link
Author

lifeboy commented Jul 26, 2024

Even running bash -x setup/start.sh reveals no errors, but the sources listed are just not run.

# Start service configuration.
source setup/system.sh
source setup/ssl.sh
source setup/dns.sh
source setup/pgp.sh
source setup/mail-postfix.sh
source setup/mail-dovecot.sh
source setup/mail-users.sh
source setup/dkim.sh
source setup/spamassassin.sh
source setup/web.sh
source setup/webmail.sh
source setup/nextcloud.sh
source setup/zpush.sh
source setup/management.sh
source setup/munin.sh

The file creation process just before that happens though.

cat > /etc/mailinabox.conf << EOF;
STORAGE_USER=$STORAGE_USER
STORAGE_ROOT=$STORAGE_ROOT
PRIMARY_HOSTNAME=$PRIMARY_HOSTNAME
PUBLIC_IP=$PUBLIC_IP
PUBLIC_IPV6=$PUBLIC_IPV6
PRIVATE_IP=$PRIVATE_IP
PRIVATE_IPV6=$PRIVATE_IPV6
GNUPGHOME=${STORAGE_ROOT}/.gnupg/
PGPKEY=${DEFAULT_PGPKEY-}
MTA_STS_MODE=${DEFAULT_MTA_STS_MODE:-enforce}
EOF

However, vim doesn't understand the EOF; that's set as delimiter and then EOF (without the ; at the end), so could that be the reason? Why is there a ; after the EOF in the first place?

I see that earlier in the script as well.

cat > /usr/local/sbin/mailinabox << EOF;
#!/bin/bash
cd $(pwd)
source setup/start.sh
EOF
chmod 744 /usr/local/sbin/mailinabox

It looks like the script just exists without regarding the 'source' commands.

@lifeboy
Copy link
Author

lifeboy commented Jul 26, 2024

It seems the code block that's causing the problem is the firewall installation part in setup/system.sh when one runs it from an ssh session. Running it from the console (without ssh) completes the installation successfully.

# ### Firewall

# Various virtualized environments like Docker and some VPSs don't provide #NODOC
# a kernel that supports iptables. To avoid error-like output in these cases, #NODOC
# we skip this if the user sets DISABLE_FIREWALL=1. #NODOC
if [ -z "${DISABLE_FIREWALL:-}" ]; then
        # Install `ufw` which provides a simple firewall configuration.
        apt_install ufw

        # Check if we have got an SSH server installed.
        # It's not critical for us to have one, so if it isn't installed,
        # no need to open the port
        if [ -x "$(command -v sshd)" ]; then
                # Allow incoming connections to SSH.
                ufw_limit ssh;

                # ssh might be running on an alternate port. Use sshd -T to dump sshd's #NODOC
                # settings, find the port it is supposedly running on, and open that port #NODOC
                # too. #NODOC
                SSH_PORT=$(sshd -T 2>/dev/null | grep "^port " | sed "s/port //") #NODOC
                if [ ! -z "$SSH_PORT" ]; then
                        if [ "$SSH_PORT" != "22" ]; then
                                echo Opening alternate SSH port $SSH_PORT. #NODOC
                                ufw_limit $SSH_PORT #NODOC
                        fi
                fi
        fi

        ufw --force enable;
fi #NODOC

What in this code crashes the script on Ubuntu 22.04?

@lifeboy
Copy link
Author

lifeboy commented Jul 29, 2024

Has anyone else experienced this? I have been able to repeat this and it seems that something has changed with ssh. I just have not been able to figure out what yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant