-
Notifications
You must be signed in to change notification settings - Fork 295
/
Copy pathPacketFence_Upgrade_Guide.asciidoc
1745 lines (1191 loc) · 59.8 KB
/
PacketFence_Upgrade_Guide.asciidoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
= PacketFence Upgrade Guide
////
This file is part of the PacketFence project.
See docs/includes/global-attributes.asciidoc
for authors, copyright and license information.
////
include::includes/global-attributes.asciidoc[]
== About this Guide
This guide covers procedures to upgrade PacketFence servers.
=== Other sources of information
<<PacketFence_Clustering_Guide.asciidoc#,Clustering Guide>>::
Covers installation in a clustered environment.
<<PacketFence_Developers_Guide.asciidoc#,Developer's Guide>>::
Covers API, captive portal customization, application code customizations and
instructions for supporting new equipment.
<<PacketFence_Installation_Guide.asciidoc#,Installation Guide>>::
Covers installation and configuration of PacketFence.
<<PacketFence_Network_Devices_Configuration_Guide.asciidoc#,Network Devices Configuration Guide>>::
Covers switches, WiFi controllers and access points configuration.
https://packetfence.org/news.html[PacketFence News]::
Covers noteworthy features, improvements and bug fixes by release.
These files are included in the package and release tarballs.
== General Upgrade Tips
=== Prerequisites
The MariaDB root password that was provided during the initial configuration is required.
=== Database and configurations backup
NOTE: Starting from PacketFence 11.0.0, this step is not necessary for
doing an
<<PacketFence_Installation_Guide.asciidoc#_automation_of_upgrades,automated
upgrade>>.
Taking a complete backup of the current installation is strongly recommended.
Perform a backup using:
.For PacketFence versions prior to 9.0.0:
[source,bash]
----
/usr/local/pf/addons/database-backup-and-maintenance.sh
----
.For PacketFence versions 9.0.0 and later:
[source,bash]
----
/usr/local/pf/addons/backup-and-maintenance.sh
----
=== Disable monit alerts (only if monit is installed)
NOTE: Starting from PacketFence 11.0.0, this step is not necessary for
doing an
<<PacketFence_Installation_Guide.asciidoc#_automation_of_upgrades,automated
upgrade>>.
If `monit` is installed and running, stop and disable it with:
[source,bash]
----
systemctl stop monit
systemctl disable monit
----
== Type of upgrades
Starting from PacketFence 11.0.0, the PacketFence installation can be upgraded in two ways:
* <<#_apply_maintenance_patches,Apply maintenance patches>>
* <<#_upgrade_to_another_version_major_or_minor,Upgrade to another version (major or minor)>>
For all PacketFence versions prior to 11.0.0, follow the steps described in the <<_upgrade_procedure,Upgrade procedure>>.
== Apply maintenance patches
=== Important note for cluster environments
In cluster environments, you need to perform following steps on **one server
at a time**. To avoid multiple moves of the virtual IP addresses, you can start with
nodes which don't own any virtual IP addresses first. You must ensure all
services have been restarted correctly before moving to the next node.
=== Disable monit alerts (only if monit is installed)
If `monit` is installed and running, shut it down with:
[source,bash]
----
systemctl stop monit
systemctl disable monit
----
=== Stop all PacketFence services
It is recommended to stop all PacketFence services that are currently running before proceeding any further:
[source,bash]
----
/usr/local/pf/bin/pfcmd service pf stop
systemctl stop packetfence-config
----
=== Upgrade packages
WARNING: All non-configuration files will be overwritten by new packages. All changes made to any other files will be lost during the upgrade.
include::common/upgrade_packages.asciidoc[]
=== New versions of config files
include::common/new_config_files.asciidoc[]
=== Rebooting after services have been stopped (optional)
include::common/reboot.asciidoc[]
=== Restart PacketFence services
include::common/restart.asciidoc[]
== Upgrade to another version (major or minor)
=== For a standalone server
Follow instructions related to <<PacketFence_Installation_Guide.asciidoc#_automation_of_upgrades,automation of upgrades>>.
=== For a cluster
Please refer to the <<PacketFence_Clustering_Guide.asciidoc#,PacketFence Clustering Guide>>, more specifically the <<PacketFence_Clustering_Guide.asciidoc#_performing_an_upgrade_on_a_cluster,Performing an upgrade on a cluster>>.
== Upgrading from a version prior to 10.0.0
=== Kernel development package
NOTE: This step needs to be done *before* packages upgrade.
In this version we need to have the kernel development package that matches your current kernel version in order to build the Netflow kernel module.
==== RHEL / CentOS based systems
[source,bash]
----
yum install kernel-devel-$(uname -r)
----
The headers for your specific kernel may not be published anymore in the CentOS repository. If that is the case, then perform the following prior to the upgrade:
[source,bash]
----
yum update kernel
reboot
yum install kernel-devel-$(uname -r)
----
NOTE: Be sure to follow instructions in <<_rebooting_after_services_have_been_stopped>> section to ensure services will not restart.
==== Debian-based systems
[source,bash]
----
apt install linux-headers-$(uname -r)
----
=== Timezone
The timezone set in pf.conf will be set on the operating system every time PacketFence reloads its configuration.
For this reason, you should review the timezone setting in the general section of pf.conf (System Configuration -> General Configuration in the admin).
If its empty, PacketFence will use the timezone that is already set on the server and you don't have anything to do.
Otherwise, it will set the timezone in this setting on the operating system layer for consistency which may modify the timezone setting of your operating system.
In this case you should ensure that you reboot the server after completing all the steps of the upgrade so that the services start with the right timezone.
=== Tracking configuration service enabled by default
`packetfence-tracking-config` service is now enabled by default. It means that all
manual changes to configuration files will be recorded, including passwords.
You can disable this service from PacketFence web admin if you don't want such behavior.
=== New PacketFence PKI in Golang
NOTE: If you do not use the PacketFence PKI, you can safely ignore this step
PacketFence-pki is deprecated in favour of the new PacketFence PKI written in Golang.
If you previously used the PacketFence-pki you will need to migrate from the SQLite database to MariaDB.
To migrate, be sure that the database is running and the new PKI too and do the following:
/usr/local/pf/addons/upgrade/to-10.0-packetfence-pki-migrate.pl
Next edit the PKI providers (Configuration -> PKI Providers) and redefine the profile to use.
Finally, if you use OCSP then change the URL to use this one:
http://127.0.0.1:22225/api/v1/pki/ocsp
=== New MariaDB Galera recovery service
This release adds a new service that will automatically attempt to recover broken Galera cluster members and can also perform a full recovery of a Galera cluster.
These automated decisions may lead to potential data loss.
If this is not acceptable for you disable the galera-autofix service in pf.conf or in "System Configuration->Services".
More details and documentation is available in the "The galera-autofix service" section of the clustering guide.
=== Removal of currently-at file and configurator display
The file [filename]`/usr/local/pf/conf/currently-at` is no longer needed, it can be removed:
[source,bash]
----
rm /usr/local/pf/conf/currently-at
----
You also need to disable access to configurator by running:
[source,bash]
----
printf '\n[advanced]\nconfigurator=disabled\n' >> /usr/local/pf/conf/pf.conf
----
=== Database Privileges
Some queries now need CREATE TEMPORARY TABLE privilege.
You will be prompted for the MariaDB root password when running this script:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.0-upgrade-pf-privileges.sh
----
=== Filter Engine
We are now using a new format for the VLAN/DNS/DHCP/RADIUS/Switch filters.
This script will convert the old format to the new one:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.0-filter_engines.pl
----
=== httpd.admin daemon disabled by default
Starting from now, `httpd.admin` daemon is disabled by default and web admin
interface is managed by HAProxy using `haproxy-admin` daemon.
It means that if you use a dedicated SSL certificate (different from captive
portal certificate) for web admin interface, this one has been replaced by
your captive portal certificate. You can find it at
[filename]`/usr/local/pf/conf/ssl/server.pem`.
=== Database schema
Changes have been made to the database schema. You will need to update it accordingly.
An SQL upgrade script has been provided to upgrade the database from the 9.3 schema to 10.0.
To upgrade the database schema, run the following command:
[source,bash]
----
mysql -u root -p pf -v < /usr/local/pf/db/upgrade-9.3.0-10.0.0.sql
----
== Upgrading from a version prior to 10.1.0
=== RADIUS attributes in authentication sources
RADIUS attributes used in rules of authentication sources are now prefixed by `radius_request`.
This script will add the prefix:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.1-authentication-prefix.pl
----
=== Changes in RADIUS configuration for better LDAP support
In order to improve LDAP support when using RADIUS, new files and configuration parameters have been added.
This script will update your current configuration:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.1-move-radius-configuration-parmeters.pl
----
=== RADIUS filter templates
RADIUS filters now support templated values like switch templates.
This script will update your RADIUS filters to new format:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.1-radius-filter-template.pl
----
=== New EAP configuration parameter in realm.conf file
A new EAP parameter has been added to [filename]`realm.conf` file.
This script will add this parameter to your current configuration file:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.1-realm-conf.pl
----
=== Status of rules
It's now possible to enable/disable rules in authentication sources.
This script will add the new `status` parameter:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.1-rule-status.pl
----
=== Support for CoA in Unifi controllers
Support for CoA for Unifi AP is now supported but requires to have the latest controller and AP firmware available.
Make sure you run the latest version of the controller and firmware if you use Ubiquiti equipment.
=== Database schema
Changes have been made to the database schema. You will need to update it accordingly.
An SQL upgrade script has been provided to upgrade the database from the 10.0.0 schema to 10.1.0.
To upgrade the database schema, run the following command:
[source,bash]
----
mysql -u root -p pf -v < /usr/local/pf/db/upgrade-10.0.0-10.1.0.sql
----
== Upgrading from a version prior to 10.2.0
=== Backup of pfmon.conf (Debian-based systems only)
NOTE: This step needs to be done *before* packages upgrade.
Debian packages upgrades will remove [filename]`/usr/local/pf/conf/pfmon.conf` file in favor of [filename]`/usr/local/pf/conf/pfcron.conf`.
In order to keep your configuration in place, you need to make a backup of your `pfmon.conf` file *before* running packages upgrades:
[source,bash]
----
cp /usr/local/pf/conf/pfmon.conf /root/pfmon.conf.rpmsave
----
After packages upgrades have been performed, you can move file to its original location:
[source,bash]
----
mv /root/pfmon.conf.rpmsave /usr/local/pf/conf/pfmon.conf.rpmsave
----
Configuration will be moved to [filename]`/usr/local/pf/conf/pfcron.conf` file during configuration migration step.
WARNING: `rpmsave` extension is not an error, script `to-10.2-pfmon-maintenance.pl` will migrate configuration using this filename.
=== Self registration portal
The parameter device_registration_role has been renamed device_registration_roles, in order to apply the change run the following script:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.2-selfservice-conf.pl
----
=== Switch type needs to be defined
If switch type was not defined, this script will set it to `Generic`:
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.2-default-switch-packetfence-standard.pl
----
=== Convert the pfmon configuration file to pfcron
Convert the pfmon configuration file to pfcron
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.2-pfmon-maintenance.pl
----
=== Rename PFMON* actions to PFCRON*
Rename PFMON actions to the PFCRON actions
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.2-adminroles-conf.pl
----
=== Syslog parsers are now tenant aware
Add the tenant_id to pfdetect
[source,bash]
----
/usr/local/pf/addons/upgrade/to-10.2-pfdetect-conf.pl
----
=== Database schema
Changes have been made to the database schema. You will need to update it accordingly.
An SQL upgrade script has been provided to upgrade the database from the 10.1.0 schema to 10.2.0.
To upgrade the database schema, run the following command:
[source,bash]
----
mysql -u root -p pf -v < /usr/local/pf/db/upgrade-10.1.0-10.2.0.sql
----
== Upgrading from a version prior to 10.3.0
=== MariaDB Upgrade to 10.2
NOTE: This step needs to be done *before* packages upgrade.
PacketFence now depends of the MariaDB version 10.2. In order to upgrade the
MariaDB version you need to execute the following steps before upgrading
PacketFence.
==== Standalone MariaDB upgrade
In order to be able to work on the server, we first need to stop all the
PacketFence application services on it, see
<<PacketFence_Upgrade_Guide.asciidoc#_stop_all_packetfence_services,Stop all
PacketFence services section>>.
Now stop `packetfence-mariadb`:
[source,bash]
----
systemctl stop packetfence-mariadb
----
Now proceed with the MariaDB upgrade
.RHEL / CentOS based systems
[source,bash]
----
rpm -e --nodeps MariaDB-client MariaDB-common MariaDB-server MariaDB-shared
yum install --enablerepo=packetfence MariaDB-server
----
.Debian-based systems
[source,bash]
----
dpkg -r --force-depends mariadb-server mariadb-client-10.1 mariadb-client-core-10.1 \
mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 libmariadbclient18 mysql-common
apt update
apt install mariadb-server mariadb-client-10.2 mariadb-client-core-10.2 \
mariadb-common mariadb-server-10.2 mariadb-server-core-10.2 libmariadbclient18 libmariadb3 \
mysql-common
----
NOTE: If you manually installed Percona XtraBackup to take your backups, you
need to install `MariaDB-backup` (rpm) and `mariadb-backup-10.2` (deb) as a
replacement.
NOTE: On Debian, ignore prompts related to change of `root` password during package upgrade.
At this moment you have the newest version of MariaDB installed on your system.
Ensure MariaDB is running:
.RHEL / CentOS based systems *only*
[source,bash]
----
systemctl unmask mariadb
systemctl start mariadb
----
You can check you are running MariaDB 10.2 version with following command:
[source,bash]
----
mysql -u root -p -e "show variables where Variable_name='version';"
----
Next step is to upgrade your databases:
[source,bash]
----
mysql_upgrade -u root -p
----
NOTE: If the following error appears "Recovering after a crash using tc.log" then delete the file [filename]`/var/lib/mysql/tc.log`
After databases have been upgraded, you can disable default MariaDB service:
.RHEL / CentOS based systems
[source,bash]
----
systemctl stop mariadb
systemctl mask mariadb
----
.Debian-based systems
[source,bash]
----
systemctl stop mysql
pkill -u mysql
systemctl mask mysql
----
`packetfence-mariadb` service will be started later by upgrade of PacketFence package(s).
At this step you have now the MariaDB 10.2 database ready.
You can now upgrade the PacketFence version by following instructions in <<_packages_upgrades,Packages upgrades>> section.
==== Cluster MariaDB upgrade
CAUTION: Performing a live upgrade on a PacketFence cluster is not a straightforward operation and should be done meticulously.
In this procedure, the 3 nodes will be named A, B and C and they are in this order in [filename]`cluster.conf`. When we referenced their hostnames, we speak about hostnames in [filename]`cluster.conf`.
===== Backups
First, ensure you have taken backups of your data. We highly encourage you to perform snapshots of all the virtual machines prior to the upgrade. You should also take a backup of the database and the `/usr/local/pf` directory using <<PacketFence_Upgrade_Guide.asciidoc#_database_and_configurations_backup,database and configurations backup instructions>>
===== Disabling the auto-correction of configuration
The PacketFence clustering stack has a mechanism that allows configuration conflicts to be handled accross the servers. This will come in conflict with your upgrade, so you should disable it.
In order to do so, go in _Configuration->System Configuration->Maintenance_ and disable the _Cluster Check_ task.
Once this is done, restart `pfmon` or `pfcron` on all nodes using:
.For PacketFence versions prior to 10.2
[source,bash]
----
/usr/local/pf/bin/pfcmd service pfmon restart
----
.For PacketFence version 10.2 and later
[source,bash]
----
/usr/local/pf/bin/pfcmd service pfcron restart
----
===== Disabling galera-autofix (for PacketFence version 10.0 and later)
You should disable the `galera-autofix` service in the configuration to disable the automated resolution of cluster issues during the upgrade.
In order to do so, go in _Configuration->System Configuration->Services_ and disable the `galera-autofix` service.
Once this is done, stop `galera-autofix` service on *all* nodes using:
[source,bash]
----
/usr/local/pf/bin/pfcmd service galera-autofix updatesystemd
/usr/local/pf/bin/pfcmd service galera-autofix stop
----
===== Migrating service on node C
In order to be able to work on node C, we first need to stop all the
PacketFence application services on it:
[source,bash]
----
/usr/local/pf/bin/pfcmd service pf stop
----
`packetfence-config` needs to stay up to disable node A and B in configuration.
NOTE: The steps below will cause a temporary loss of service.
====== Detach node C from the cluster
First, we need to tell A and B to ignore C in their cluster configuration. In order to do so, execute the following command **on A and B** while changing `node-C-hostname` with the actual hostname of node C:
[source,bash]
----
/usr/local/pf/bin/cluster/node node-C-hostname disable
----
Once this is done proceed to restart the following services on nodes A and B **one at a time**. This will cause service failure during the restart on node A
[source,bash]
----
/usr/local/pf/bin/pfcmd service radiusd restart
/usr/local/pf/bin/pfcmd service pfdhcplistener restart
/usr/local/pf/bin/pfcmd service haproxy-admin restart
/usr/local/pf/bin/pfcmd service haproxy-db restart
/usr/local/pf/bin/pfcmd service haproxy-portal restart
/usr/local/pf/bin/pfcmd service keepalived restart
----
Then, we should tell C to ignore A and B in their cluster configuration. In order to do so, execute the following commands on node C while changing `node-A-hostname` and `node-B-hostname` by the hostname of nodes A and B respectively.
[source,bash]
----
/usr/local/pf/bin/cluster/node node-A-hostname disable
/usr/local/pf/bin/cluster/node node-B-hostname disable
----
The commands above will make sure that nodes A and B will not be forwarding
requests to C even if it is alive. Same goes for C which won't be sending
traffic to A and B. This means A and B will continue to have the same database
informations while C will start to diverge from it when it goes live. We'll
make sure to reconcile this data afterwards.
====== MariaDB upgrade on node C
Now stop `packetfence-mariadb` on node C:
[source,bash]
----
systemctl stop packetfence-mariadb
----
Now proceed with the MariaDB upgrade
.RHEL / CentOS based systems *only*
[source,bash]
----
rpm -e --nodeps MariaDB-client MariaDB-common MariaDB-server MariaDB-shared
yum install --enablerepo=packetfence MariaDB-server MariaDB-backup
----
.Debian-based systems
[source,bash]
----
dpkg -r --force-depends mariadb-server mariadb-client-10.1 mariadb-client-core-10.1 \
mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 libmariadbclient18 \
mysql-common
apt update
apt install mariadb-server-10.2 mariadb-common mariadb-client-10.2 \
mariadb-client-core-10.2 mariadb-server-core-10.2 libmariadb3 \
libmariadbclient18 mariadb-server mariadb-backup-10.2 mysql-common
----
NOTE: On Debian, ignore prompts related to change of `root` password during package upgrade.
At this moment you have the newest version of MariaDB installed on your system. Ensure MariaDB is running:
.RHEL / CentOS based systems *only*
[source,bash]
----
systemctl unmask mariadb
systemctl start mariadb
----
You can check you are running MariaDB 10.2 version with following command:
[source,bash]
----
mysql -u root -p -e "show variables where Variable_name='version';"
----
Next step is to upgrade your databases:
[source,bash]
----
mysql_upgrade -u root -p
----
NOTE: If the following error appear "Recovering after a crash using tc.log" then delete the file /var/lib/mysql/tc.log
After databases have been upgraded, you can disable default MariaDB service:
.RHEL / CentOS based systems *only*
[source,bash]
----
systemctl stop mariadb
systemctl mask mariadb
----
.Debian-based systems
[source,bash]
----
systemctl stop mysql
pkill -u mysql
systemctl mask mysql
----
At this step you have now the MariaDB 10.2 database ready.
In order to start MariaDB as standalone on node C, you need to regenerate MariaDB config
(`packetfence-mariadb` service will be started later by upgrade of packetfence package(s))
[source,bash]
----
/usr/local/pf/bin/pfcmd generatemariadbconfig
----
====== Upgrading node C
Next, you can upgrade your operating system and/or PacketFence on node C by
following instructions of
<<PacketFence_Upgrade_Guide.asciidoc#_packages_upgrades,Packages upgrades
section>>.
IMPORTANT: If you are on a RHEL/CentOS based systems, the command to install
`packetfence-release` released with 10.3.0 version will be:
[source,bash]
----
https://www.packetfence.org/downloads/PacketFence/RHEL7/packetfence-release-7.stable.noarch.rpm
----
====== Maintenance patches (on node C)
include::common/maintenance_patches.asciidoc[][]
====== Configuration migration and database schema updates (on node C)
Now, make sure you follow the directives in the <<PacketFence_Upgrade_Guide.asciidoc#,upgrade guide>> as you would on a standalone server **including** the database schema updates.
====== Start service on node C
Now, start the application service on node C using following instructions:
[source,bash]
----
/usr/local/pf/bin/pfcmd fixpermissions
/usr/local/pf/bin/pfcmd pfconfig clear_backend
systemctl restart packetfence-config
/usr/local/pf/bin/pfcmd configreload hard
/usr/local/pf/bin/pfcmd service pf restart
----
====== Stop services on nodes A and B
Next, stop all application services on node A and B:
* Stop all PacketFence services:
+
[source,bash]
----
/usr/local/pf/bin/pfcmd fixpermissions
/usr/local/pf/bin/pfcmd pfconfig clear_backend
systemctl restart packetfence-config
/usr/local/pf/bin/pfcmd configreload hard
/usr/local/pf/bin/pfcmd service pf stop
----
* Stop database:
+
[source,bash]
----
systemctl stop packetfence-mariadb
----
===== Validate migration
You should now have full service on node C and should validate that all functionnalities are working as expected. Once you continue past this point, there will be no way to migrate back to nodes A and B in case of issues other than to use the snapshots taken prior to the upgrade.
====== If all goes wrong
If your migration to node C goes wrong, you can fail back to nodes A and B by stopping all services on node C and starting them on nodes A and B
.On node C
[source,bash]
----
systemctl stop packetfence-mariadb
/usr/local/pf/bin/pfcmd service pf stop
----
.On nodes A and B
[source,bash]
----
systemctl start packetfence-mariadb
/usr/local/pf/bin/pfcmd service pf start
----
Once you are feeling confident to try your failover to node C again, you can do the exact opposite of the commands above to try your upgrade again.
====== If all goes well
If you are happy about the state of your upgrade, you can continue on the steps below in order to complete the upgrade of the two remaining nodes.
===== MariaDB upgrade on nodes A and B
Now proceed with the MariaDB upgrade:
.RHEL / CentOS based systems
[source,bash]
----
rpm -e --nodeps MariaDB-client MariaDB-common MariaDB-server MariaDB-shared
yum install --enablerepo=packetfence MariaDB-server MariaDB-backup
----
.Debian-based systems
[source,bash]
----
dpkg -r --force-depends mariadb-server mariadb-client-10.1 mariadb-client-core-10.1 \
mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 libmariadbclient18 \
mysql-common
apt update
apt install mariadb-server-10.2 mariadb-common mariadb-client-10.2 \
mariadb-client-core-10.2 mariadb-server-core-10.2 libmariadb3 \
libmariadbclient18 mariadb-server mariadb-backup-10.2 mysql-common
----
NOTE: On Debian, ignore prompts related to change of `root` password during package upgrade.
To let nodes A and B rejoin cluster **before** upgrading PacketFence packages,
you need to update MariaDB configuration:
[source,bash]
----
sed -i "s/xtrabackup/mariabackup/g" /usr/local/pf/conf/mariadb/mariadb.conf.tt
----
At this moment you have the newest version of MariaDB installed on nodes A and B.
On Debian-based systems **only**, you need to stop default `mysql` service:
.Debian-based systems **only**
[source,bash]
----
systemctl stop mysql
pkill -u mysql
systemctl mask mysql
----
At this step you have now the MariaDB 10.2 database ready.
===== Reintegrating nodes A and B
====== Optional step: Cleaning up data on node C
When you will re-establish a cluster using node C in the steps below, your environment will be set in read-only mode for the duration of the database sync (which needs to be done from scratch).
This can take from a few minutes to an hour depending on your database size.
We highly suggest you delete data from the following tables if you don't need it:
* `radius_audit_log`: contains the data in _Auditing->RADIUS Audit Logs_
* `ip4log_history`: Archiving data for the IPv4 history
* `ip4log_archive`: Archiving data for the IPv4 history
* `locationlog_history`: Archiving data for the node location history
You can safely delete the data from all of these tables without affecting the functionnalities as they are used for reporting and archiving purposes. Deleting the data from these tables can make the sync process considerably faster.
In order to truncate a table:
[source,bash]
----
mysql -u root -p pf
MariaDB> truncate TABLE_NAME;
----
====== Elect node C as database master
In order for node C to be able to elect itself as database master, we must tell it there are other members in its cluster by re-enabling nodes A and B
[source,bash]
----
/usr/local/pf/bin/cluster/node node-A-hostname enable
/usr/local/pf/bin/cluster/node node-B-hostname enable
----
Next, enable node C on nodes A and B by executing the following command on the two servers:
[source,bash]
----
systemctl start packetfence-config
/usr/local/pf/bin/cluster/node node-C-hostname enable
----
Now, stop `packetfence-mariadb` on node C, regenerate the MariaDB configuration and start it as a new master:
NOTE: Before starting this step, be sure that the galera_replication_username has grant permission PROCESS
[source,bash]
----
mysql -u root -p
select * from information_schema.user_privileges where PRIVILEGE_TYPE="PROCESS";
# If it's not the case
GRANT PROCESS ON *.* TO '`galera_replication_username`'@localhost;
----
[source,bash]
----
systemctl stop packetfence-mariadb
/usr/local/pf/bin/pfcmd generatemariadbconfig
/usr/local/pf/sbin/pf-mariadb --force-new-cluster
----
You should validate that you are able to connect to the MariaDB database even
though it is in read-only mode using the MariaDB command line:
[source,bash]
----
mysql -u root -p pf -h localhost
----
If its not, make sure you check the MariaDB log
([filename]`/usr/local/pf/logs/mariadb_error.log`)
====== Sync nodes A and B
On each of the servers you want to discard the data from, stop `packetfence-mariadb`, you must destroy all the data in `/var/lib/mysql` and start `packetfence-mariadb` so it resyncs its data from scratch.
[source,bash]
----
systemctl stop packetfence-mariadb
rm -fr /var/lib/mysql/*
/usr/local/pf/bin/pfcmd generatemariadbconfig
systemctl start packetfence-mariadb
----
Should there be any issues during the sync, make sure you look into the MariaDB log ([filename]`/usr/local/pf/logs/mariadb_error.log`)
Once both nodes have completely synced (try connecting to it using the MariaDB
command line), then you can break the cluster election command you have
running on node C and start node C normally (using `systemctl start
packetfence-mariadb`).
====== Upgrading nodes A and B
Next, you can upgrade your operating system and/or PacketFence on nodes A and B by
following instructions of
<<PacketFence_Upgrade_Guide.asciidoc#_packages_upgrades,Packages upgrades
section>>.
WARNING: You only need to merge changes of new configuration files that will not be synced by `/usr/local/pf/bin/cluster/sync` command described below.
IMPORTANT: If you are on a RHEL/CentOS based systems, the command to install
`packetfence-release` released with 10.3.0 version will be:
[source,bash]
----
https://www.packetfence.org/downloads/PacketFence/RHEL7/packetfence-release-7.stable.noarch.rpm
----
====== Maintenance patches (on nodes A and B)
include::common/maintenance_patches.asciidoc[]
====== Configuration synchronisation
You do not need to follow the upgrade procedure when upgrading these nodes. You should instead do a sync from node C on nodes A and B:
[source,bash]
----
/usr/local/pf/bin/cluster/sync --from=192.168.1.5 --api-user=packet --api-password=anotherMoreSecurePassword
/usr/local/pf/bin/pfcmd configreload hard
----
Where:
* `_192.168.1.5_` is the management IP of node C
* `_packet_` is the webservices username (_Configuration->Webservices_)
* `_fence_` is the webservices password (_Configuration->Webservices_)
====== Start nodes A and B
Before starting PacketFence services on nodes A and B, `packetfence-mariadb`
need to be restarted again to take into account changes introduced by packages
upgrades:
[source,bash]
----
systemctl restart packetfence-mariadb
----
You can now safely start PacketFence on nodes A and B using following instructions:
[source,bash]
----
/usr/local/pf/bin/pfcmd fixpermissions
/usr/local/pf/bin/pfcmd pfconfig clear_backend
systemctl restart packetfence-config
/usr/local/pf/bin/pfcmd configreload hard
/usr/local/pf/bin/pfcmd service pf restart
----
===== Restart node C
Now, you should restart PacketFence on node C using following instructions:
[source,bash]
----
/usr/local/pf/bin/pfcmd fixpermissions
/usr/local/pf/bin/pfcmd pfconfig clear_backend
systemctl restart packetfence-config
/usr/local/pf/bin/pfcmd configreload hard
/usr/local/pf/bin/pfcmd service pf restart
----
So it becomes aware of its peers again.
You should now have full service on all 3 nodes using the latest version of PacketFence.
===== Reactivate the configuration conflict handling
Now that your cluster is back to a healthy state, you should reactivate the configuration conflict resolution.
In order to do, so go in _Configuration->System Configuration->Maintenance_ and re-enable the _Cluster Check_ task.