Directadmin LAN integration with OLS

Iv.

New Member
#1
Dear Community,

My name is Ivan and I am Cloud / System Administrator, we have client infrastructure that is based on AWS Lightsail + Directadmin + OLS. Everything was great until mid-january when Directadmin announced automatic LAN integration for such cloud instances.

Until mid jan. there was simple process to link the internal IP of the instance with the External one and after that it was simple and easy process to install and get working OLS without any problems.

After the update for every new client we started having problems because OLS was not working with a simple web error: ERR_CONNECTION_REFUSED and httpd/error_log like this:

Bash:
2020-09-04 06:52:48.328254 [ERROR] Hostname [*] on listener [18.159.2.2:80] is mapped to virtual host [18.159.2.2], can't map to virtual host [hostname]!
2020-09-04 06:52:48.328263 [ERROR] Hostname [*] on listener [18.159.2.2:443] is mapped to virtual host [18.159.2.2], can't map to virtual host [hostname]!
The ifconfig from the instance is something like this and contains only the internal IP:

Bash:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
        inet 172.26.12.40  netmask 255.255.240.0  broadcast 172.26.15.255
        ether 02:d7:*:*:e0:*  txqueuelen 1000  (Ethernet)
        RX packets 2965  bytes 1637772 (1.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2566  bytes 509092 (497.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Adding the external IP as virtual adapter on the eth0:1 did not help and OLS was not responding to the requests same as before.

After some research today we found out that the problem is located in: /usr/local/lsws/conf/listeners.conf

This was the original listeners.conf after clean installation on DA + OLS:
Bash:
# Auto generated openlitespeed listeners config file by DirectAdmin version 1.61.3
# Modifying this file is not recommended as any changes you make will be
# overwritten when you add/remove ip's through DirectAdmin.

listener 18-159-2-2-80 {
 
 address                 18.159.2.2:80
 secure                  0
 
}

listener 18-159-2-2-443 {
 
 address                 18.159.2.2:443
 secure                  1
 keyFile                 /usr/local/lsws/ssl.key/server.key
 certFile                /usr/local/lsws/ssl.crt/server.crt.combined
 certChain               1
 sslProtocol             24
 
}
This is totally fine, BUT for some unknown reason (I don't know if it's due to DA update or OLS) there is missing the most important part, the Internal IP listener. So with small modification we had the site running normally.

The modified version of listeners.conf:
Bash:
# Auto generated openlitespeed listeners config file by DirectAdmin version 1.61.3
# Modifying this file is not recommended as any changes you make will be
# overwritten when you add/remove ip's through DirectAdmin.

listener 18-159-2-2-80 {
 
 address                 18.159.2.2:80
 secure                  0
 
}

listener 18-159-2-2-443 {
 
 address                 18.159.2.2:443
 secure                  1
 keyFile                 /usr/local/lsws/ssl.key/server.key
 certFile                /usr/local/lsws/ssl.crt/server.crt.combined
 certChain               1
 sslProtocol             24
 
}

listener 172-26-12-40-80 {
 
 address                 172.26.12.40:80
 secure                  0
 
}

listener 172-26-12-40-443 {
 
 address                 172.26.12.40:443
 secure                  1
 keyFile                 /usr/local/lsws/ssl.key/server.key
 certFile                /usr/local/lsws/ssl.crt/server.crt.combined
 certChain               1
 sslProtocol             24
 
}
*(The IP address is not the real IP from the instance just an example)*

The problem is simple, the internal IP is not auto-generated in the listeners.conf file and the solutions is easy but it's best to implement it DA/OLS side because we run force update on OLS and the listeners.conf was regenerated with the old settings.

I hope that this will help someone, and I hope there will be quick fix on this matter.

Best Regards,
 

Cold-Egg

Administrator
#3
Hi @opencart,

I just set up a new DirectAdmin server with OpenLiteSpeed and no such issue.

The /usr/local/lsws/conf/listeners.conf file auto-generate internal 80&443 and external 80&443 listeners as expected.
e.g.
Code:
listener 54-227-113-142-80 {

address                 54.227.113.142:80
secure                  0

}

listener 54-227-113-142-443 {

address                 54.227.113.142:443
secure                  1
keyFile                 /usr/local/lsws/ssl.key/server.key
certFile                /usr/local/lsws/ssl.crt/server.crt.combined
certChain               1
sslProtocol             24

}




listener 172-31-12-220-80 {

address                 172.31.12.220:80
secure                  0

}

listener 172-31-12-220-443 {

address                 172.31.12.220:443
secure                  1
keyFile                 /usr/local/lsws/ssl.key/server.key
certFile                /usr/local/lsws/ssl.crt/server.crt.combined
certChain               1
sslProtocol             24

}

Whole output of ifconfig command from my test server
Code:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
        inet 172.31.12.220  netmask 255.255.240.0  broadcast 172.31.15.255
        inet6 fe80::810:f7ff:fe00:bbd9  prefixlen 64  scopeid 0x20<link>
        ether 0a:10:f7:00:bb:d9  txqueuelen 1000  (Ethernet)
        RX packets 709778  bytes 1018243284 (1.0 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 186866  bytes 26760225 (26.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1458  bytes 142349 (142.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1458  bytes 142349 (142.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Also the /usr/local/directadmin/data/users/xxxx/openlitespeed.conf includes those listeners correctly. Web admin shows some errors that can be ignored because the site is still loading fine.

Custom Build will convert the virtual host configuration from Apache and generate OLS configuration files in /usr/local/lsws/conf. So, if your config does not generate correctly, please check Apache config or contact DirectAdmin for support.
 
Last edited:
Top