inverse-inc / packetfence

PacketFence is a fully supported, trusted, Free and Open Source network access control (NAC) solution. Boasting an impressive feature set including a captive-portal for registration and remediation, centralized wired and wireless management, powerful BYOD management options, 802.1X support, layer-2 isolation of problematic devices; PacketFence can be used to effectively secure networks small to very large heterogeneous networks.
https://packetfence.org
GNU General Public License v2.0
1.27k stars 274 forks source link

export import script is broken #8105

Open JeGoi opened 2 months ago

JeGoi commented 2 months ago

Describe the bug This PR https://github.com/inverse-inc/packetfence/pull/7754 has probably broken the import script since this one is based on /usr/local/pf and this PR pushed everything on ./

To Reproduce

  1. Do the backup script
  2. Extract the file
  3. See that it is directly in ./ and no more under usr/local/pf

Expected behavior Fix backup file OR fix the import script

Additional context Add any other context about the problem here.

JeGoi commented 2 months ago

Still broken. import from deb13.1 to el813.2

/usr/local/pf/addons/full-import/import.sh -f /root/export_24_may_2.tgz 
/tmp/tmp.Kkkon20yLo ~
=================================================================================
Extracting archive...
Found the following content in the archive:
total 336480
-rw-r--r--. 1 root root       519 May  2 12:35 add_files.txt
-rw-r--r--. 1 root root      1083 May  2 12:35 grants.sql
-rw-r--r--. 1 root root     77288 May  2 04:30 packetfence-db-dump-2024-05-02_00h30.sql.gz
-rw-r--r--. 1 root root 172842068 May  2 04:30 packetfence-files-dump-2024-05-02_00h30.tgz
-rw-r--r--. 1 root root      1630 May  2 12:35 stored_config_files.txt
drwxr-xr-x. 3 root root      4096 May  2 12:35 usr
=================================================================================
Found files dump 'packetfence-files-dump-2024-05-02_00h30.tgz'
Extracting files dump
=================================================================================
Found compressed database dump 'packetfence-db-dump-2024-05-02_00h30.sql.gz'
Uncompressed database dump 'packetfence-db-dump-2024-05-02_00h30.sql'
=================================================================================
Get PF version in PacketFence export
13.1.0
=================================================================================
Stopping PacketFence services
=================================================================================
The database dump uses mysqldump
---------------------------------------------------------------------------------
Recreating database pf
---------------------------------------------------------------------------------
Dump file was made without triggers and procedures
Importing bare schema for 13.1
---------------------------------------------------------------------------------
Replacing create statements from the dump and removing drop statements
---------------------------------------------------------------------------------
Importing packetfence-db-dump-2024-05-02_00h30.sql into pf
ERROR 1062 (23000) at line 1214: Duplicate entry '1' for key 'PRIMARY'
Cleaning temporary directory
[root@139-144-196-10 ~]

It looks like a tenant issue...

JeGoi commented 2 weeks ago

The fix #8106 is only working from 13.1 to 13.2. I confirm that it causes an issue with import from previous version of PF.

JeGoi commented 2 weeks ago
root@172-234-130-112:~# /usr/local/pf/addons/full-import/import.sh -f /tmp/export.tgz
/tmp/tmp.cZTZCAwkNA ~
=================================================================================
Extracting archive...
Found the following content in the archive:
total 199100
-rw-r--r-- 1 root root       519 Jun 25 16:24 add_files.txt
-rw-r--r-- 1 root root      1083 Jun 25 16:24 grants.sql
-rw-r--r-- 1 root root    107499 Jun 25 16:15 packetfence-db-dump-2024-06-25_12h15.sql.gz
-rw-r--r-- 1 root root 102269720 Jun 25 16:15 packetfence-files-dump-2024-06-25_12h14.tgz
-rw-r--r-- 1 root root      1640 Jun 25 16:24 stored_config_files.txt
drwxr-xr-x 3 root root      4096 Jun 25 16:24 usr
=================================================================================
Found files dump 'packetfence-files-dump-2024-06-25_12h14.tgz'
Extracting files dump
Your version is comming from packetfence < 13.2
=================================================================================
Found compressed database dump 'packetfence-db-dump-2024-06-25_12h15.sql.gz'
Uncompressed database dump 'packetfence-db-dump-2024-06-25_12h15.sql'
=================================================================================
Get PF version in PacketFence export
12.2.0
=================================================================================
Stopping PacketFence services
Synchronizing state of monit.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable monit

So, I found a fix.