turtle0x1 / LxdMosaic

Web interface to manage multiple instance of lxd
http://lxdmosaic.com
GNU General Public License v3.0
572 stars 61 forks source link

SNAP: Self signed certs aren't linked to the live folder #554

Closed k9943004 closed 1 month ago

k9943004 commented 1 year ago

Describe the bug Version --stable has no problem, but version --edge does not listen. (444)

To Reproduce Steps to reproduce the behavior:

snap refresh lxdmosaic --stable

snap refresh lxdmosaic --edge

444 port Listen fail

Expected behavior A clear and concise description of what you expected to happen.

` [root@LXD-server ~]# snap refresh lxdmosaic --stable snap "lxdmosaic" has no updates available [root@LXD-server ~]# ss -antp State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:81 0.0.0.0: users:(("httpd",pid=27196,fd=3),("httpd",pid=27101,fd=3),("httpd",pid=27100,fd=3),("httpd",pid=27099,fd=3),("httpd",pid=27098,fd=3)) LISTEN 0 128 0.0.0.0:22 0.0.0.0: users:(("sshd",pid=1065,fd=5)) LISTEN 0 128 0.0.0.0:444 0.0.0.0: users:(("httpd",pid=27196,fd=4),("httpd",pid=27101,fd=4),("httpd",pid=27100,fd=4),("httpd",pid=27099,fd=4),("httpd",pid=27098,fd=4)) ESTAB 0 36 192.168.0.242:22 192.168.0.148:11693 users:(("sshd",pid=1782,fd=5),("sshd",pid=1767,fd=5)) LISTEN 0 128 [::]:22 [::]: users:(("sshd",pid=1065,fd=7)) LISTEN 0 128 :3000 : users:(("node",pid=26829,fd=18)) LISTEN 0 128 :8443 : users:(("lxd",pid=3245,fd=8)) ESTAB 0 0 [::ffff:192.168.0.242]:8443 [::ffff:192.168.0.148]:35855 users:(("lxd",pid=3245,fd=25))

[root@LXD-server ~]# snap refresh lxdmosaic --edge lxdmosaic (edge) 0+git.341a5f80 from Daniel Hope (turtle0x1) refreshed [root@LXD-server ~]# ss -antp State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0: users:(("sshd",pid=1065,fd=5)) ESTAB 0 36 192.168.0.242:22 192.168.0.148:11693 users:(("sshd",pid=1782,fd=5),("sshd",pid=1767,fd=5)) ESTAB 0 0 192.168.0.242:46246 185.125.188.59:443 users:(("snapd",pid=25600,fd=16)) TIME-WAIT 0 0 192.168.0.242:444 192.168.0.148:36075
TIME-WAIT 0 0 192.168.0.242:444 192.168.0.148:36071
TIME-WAIT 0 0 192.168.0.242:444 192.168.0.148:36073
LISTEN 0 128 [::]:22 [::]:
users:(("sshd",pid=1065,fd=7)) LISTEN 0 128 :3000 : users:(("node",pid=27540,fd=18)) LISTEN 0 128 :8443 : users:(("lxd",pid=3245,fd=8)) ESTAB 0 0 [::ffff:192.168.0.242]:8443 [::ffff:192.168.0.148]:35855 users:(("lxd",pid=3245,fd=25))

`

`[root@LXD-server ~]# snap refresh lxdmosaic --edge lxdmosaic (edge) 0+git.341a5f80 from Daniel Hope (turtle0x1) refreshed [root@LXD-server ~]# snap set lxdmosaic ports.http=81 ports.https=444 [root@LXD-server ~]# ss -antp State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0: users:(("sshd",pid=1065,fd=5)) ESTAB 0 36 192.168.0.242:22 192.168.0.148:11693 users:(("sshd",pid=1782,fd=5),("sshd",pid=1767,fd=5)) ESTAB 0 0 192.168.0.242:45794 185.125.188.54:443 users:(("snapd",pid=25600,fd=16)) LISTEN 0 128 [::]:22 [::]: users:(("sshd",pid=1065,fd=7)) LISTEN 0 128 :3000 : users:(("node",pid=29324,fd=18)) LISTEN 0 128 :8443 : users:(("lxd",pid=3245,fd=8)) ESTAB 0 0 [::ffff:192.168.0.242]:8443 [::ffff:192.168.0.148]:35855 users:(("lxd",pid=3245,fd=25))

[root@LXD-server ~]# snap info lxdmosaic name: lxdmosaic summary: A web interface to manage multiple instances of LXD publisher: Daniel Hope (turtle0x1) store-url: https://snapcraft.io/lxdmosaic license: unset description: | Features

` [root@LXD-server ~]# systemctl restart snap.lxdmosaic.apache [root@LXD-server ~]# sudo snap logs lxdmosaic 2022-12-06T19:22:39+09:00 lxdmosaic.apache[50167]: AH00526: Syntax error on line 17 of /snap/lxdmosaic/258/conf/ssl.conf: 2022-12-06T19:22:39+09:00 lxdmosaic.apache[50167]: SSLCertificateFile: file '/var/snap/lxdmosaic/258/certs/live/cert.pem' does not exist or is empty 2022-12-06T19:22:39+09:00 systemd[1]: snap.lxdmosaic.apache.service: Main process exited, code=exited, status=1/FAILURE 2022-12-06T19:22:39+09:00 systemd[1]: snap.lxdmosaic.apache.service: Failed with result 'exit-code'. 2022-12-06T19:22:39+09:00 systemd[1]: snap.lxdmosaic.apache.service: Service RestartSec=100ms expired, scheduling restart. 2022-12-06T19:22:39+09:00 systemd[1]: snap.lxdmosaic.apache.service: Scheduled restart job, restart counter is at 5. 2022-12-06T19:22:39+09:00 systemd[1]: Stopped Service for snap application lxdmosaic.apache. 2022-12-06T19:22:39+09:00 systemd[1]: snap.lxdmosaic.apache.service: Start request repeated too quickly. 2022-12-06T19:22:39+09:00 systemd[1]: snap.lxdmosaic.apache.service: Failed with result 'exit-code'. 2022-12-06T19:22:39+09:00 systemd[1]: Failed to start Service for snap application lxdmosaic.apache.

`

k9943004 commented 1 year ago

I did it by editing the hosts file.

[root@LXD-server lxdmosaic]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 LXD-server ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 [root@LXD-server lxdmosaic]#

[root@LXD-server certs]# pwd /var/snap/lxdmosaic/258/certs

[root@LXD-server certs]# ll total 0 drwxr-x---. 2 root root 58 Dec 6 19:57 self-signed [root@LXD-server certs]# cp -rp self-signed live

[root@LXD-server certs]# snap refresh lxdmosaic --edge snap "lxdmosaic" has no updates available [root@LXD-server certs]# snap restart lxdmosaic Restarted. [root@LXD-server certs]# systemctl restart snap.lxdmosaic.apache

turtle0x1 commented 1 year ago

Nice fix but it needs to be addressed properly for new installs, re-opening.

k9943004 commented 1 year ago

Nice fix but it needs to be addressed properly for new installs, re-opening.

When installing from scratch, an error occurs in apache even if you install with option "--edge".

turtle0x1 commented 1 year ago

Please leave this open, its an issue that needs to be addressed.

turtle0x1 commented 1 month ago

Fixed here 5f52c12d0f4e342962e884fb0c5dafb74f90210e