9 |
)) |
)) |
10 |
{ |
{ |
11 |
templates2events("/etc/cacti/db.php", $event); |
templates2events("/etc/cacti/db.php", $event); |
12 |
@@ -22,3 +23,35 @@ |
@@ -22,3 +23,34 @@ |
13 |
} |
} |
14 |
|
|
15 |
templates2events("/etc/e-smith/sql/init/80cacti", "post-upgrade"); |
templates2events("/etc/e-smith/sql/init/80cacti", "post-upgrade"); |
35 |
+event_actions($event, |
+event_actions($event, |
36 |
+'cacti-conf' => '2', |
+'cacti-conf' => '2', |
37 |
+'cacti-install' => '94', |
+'cacti-install' => '94', |
|
+'cacti-ldap' => '95' |
|
38 |
+); |
+); |
39 |
+ |
+ |
40 |
+ |
+ |
496 |
+ if (($cacti{'status'} || 'disabled') eq 'enabled'){ |
+ if (($cacti{'status'} || 'disabled') eq 'enabled'){ |
497 |
+ my $max_upload_size = ($cacti{MaxUploadSize} || '4096'); |
+ my $max_upload_size = ($cacti{MaxUploadSize} || '4096'); |
498 |
+ $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/); |
+ $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/); |
499 |
+ my $memory_limit = ($cacti{MemoryLimit} || '5555500M'); |
+ my $memory_limit = ($cacti{MemoryLimit} || '500M'); |
500 |
+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/); |
+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/); |
501 |
+ my $open_basedir= $cacti{PHPBaseDir} || ''; |
+ my $open_basedir= $cacti{PHPBaseDir} || ''; |
502 |
+ $open_basedir = "/tmp/:/share/:/var/log/cacti:/etc/cacti/db.php:/usr/share/cacti:/var/lib/cacti:/var/log/cacti.log:/var/lib/php/cacti:/home/e-smith/files/cacti:/dev/urandom:/proc/meminfo:$open_basedir"; |
+ $open_basedir = "/tmp/:/share/:/var/log/cacti:/etc/cacti/db.php:/usr/share/cacti:/var/lib/cacti:/var/log/cacti.log:/var/lib/php/cacti:/home/e-smith/files/cacti:/dev/urandom:/proc/meminfo:$open_basedir"; |
583 |
+# move to cli dir |
+# move to cli dir |
584 |
+cd /usr/share/cacti/cli |
+cd /usr/share/cacti/cli |
585 |
+ |
+ |
586 |
+#install, we put away, it seems that inside the event it just do not work |
+#install, we put away, it fails in the temp event in yum at first, so here is a dirty hack |
587 |
+/usr/bin/php74 install_cacti.php --accept-eula --install --path=php_binary:/usr/bin/php74 & |
+/usr/bin/php install_cacti.php & |
588 |
+pids=$! ; wait $pid; |
+pids=$!; sleep 3; kill -9 $pids; |
589 |
+ |
+/usr/bin/php install_cacti.php --accept-eula --install || exit 0 |
590 |
+ |
+ |
591 |
+#TODO: |
+#TODO: |
592 |
+#--automationmode |
+#--automationmode |
598 |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap |
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap |
599 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap 2022-07-27 22:43:12.847000000 -0400 |
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap 2022-07-27 22:43:12.847000000 -0400 |
600 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap 2022-07-27 23:58:46.807000000 -0400 |
+++ smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap 2022-07-27 23:58:46.807000000 -0400 |
601 |
@@ -19,24 +19,25 @@ |
@@ -19,24 +19,26 @@ |
602 |
#ldap_group_require 'on' or '' |
#ldap_group_require 'on' or '' |
603 |
# then set our admin password |
# then set our admin password |
604 |
/usr/bin/mysql <<EOF |
/usr/bin/mysql <<EOF |
635 |
+REPLACE INTO ${db}.settings VALUES ('auth_method','3') ; |
+REPLACE INTO ${db}.settings VALUES ('auth_method','3') ; |
636 |
+REPLACE INTO ${db}.settings VALUES ('cn_full_name','cn') ; |
+REPLACE INTO ${db}.settings VALUES ('cn_full_name','cn') ; |
637 |
+REPLACE INTO ${db}.settings VALUES ('cn_email','mail') ; |
+REPLACE INTO ${db}.settings VALUES ('cn_email','mail') ; |
638 |
|
+REPLACE INTO ${db}.settings VALUES ('path_php_binary','/usr/bin/php74') ; |
639 |
|
|
640 |
+REPLACE INTO ${db}.settings VALUES ('user_template','3'); |
+REPLACE INTO ${db}.settings VALUES ('user_template','3'); |
641 |
|
|
642 |
# set password of admin |
# set password of admin |
643 |
UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1'; |
UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1'; |
644 |
|
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-install smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-install |
645 |
|
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-install 2022-07-28 00:24:34.405000000 -0400 |
646 |
|
+++ smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-install 2022-07-28 00:26:59.373000000 -0400 |
647 |
|
@@ -15,3 +15,39 @@ |
648 |
|
# using this to set ldap ? --ldap:dn:... |
649 |
|
# do we need a --mode=upgrade and a --mode=install |
650 |
|
|
651 |
|
+db=$(config getprop cacti DbDatabase || echo 'cacti_sme'); |
652 |
|
+user=$(config getprop cacti DbUser || echo 'cacti'); |
653 |
|
+pass=$(config getprop cacti DbPassword || echo 'changeme'); |
654 |
|
+adminpass=$(config getprop cacti AdminPassword || echo 'changeme'); |
655 |
|
+domain=$(config get DomainName) |
656 |
|
+DN=$(perl -Mesmith::util -e "print esmith::util::ldapBase(\"$domain\");") |
657 |
|
+ |
658 |
|
+# set ldap auth with optional group |
659 |
|
+# ldap_group_require 'on' or '': user will enable if needed. |
660 |
|
+# then set our admin password |
661 |
|
+/usr/bin/mysql <<EOF |
662 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_group_attrib','memberUid') ; |
663 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_group_dn','uid=cactigroup,ou=Groups,$DN') ; |
664 |
|
+ |
665 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_tls_certificate','0') ; |
666 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_version','3') ; |
667 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_server','localhost') ; |
668 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_search_filter','objectClass=inetOrgPerson') ; |
669 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_search_base','ou=Users,$DN') ; |
670 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_referrals','0') ; |
671 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_port_ssl','636') ; |
672 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_port','389') ; |
673 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_mode','0') ; |
674 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_encryption','0') ; |
675 |
|
+REPLACE INTO ${db}.settings VALUES ('ldap_dn','uid=<username>,ou=Users,$DN') ; |
676 |
|
+REPLACE INTO ${db}.settings VALUES ('auth_method','3') ; |
677 |
|
+REPLACE INTO ${db}.settings VALUES ('cn_full_name','cn') ; |
678 |
|
+REPLACE INTO ${db}.settings VALUES ('cn_email','mail') ; |
679 |
|
+REPLACE INTO ${db}.settings VALUES ('path_php_binary','/usr/bin/php74') ; |
680 |
|
+ |
681 |
|
+REPLACE INTO ${db}.settings VALUES ('user_template','3'); |
682 |
|
+ |
683 |
|
+# set password of admin |
684 |
|
+UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1'; |
685 |
|
+EOF |
686 |
|
+ |
687 |
|
diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap |
688 |
|
--- smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap 2022-07-28 00:24:34.405000000 -0400 |
689 |
|
+++ smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap 1969-12-31 19:00:00.000000000 -0500 |
690 |
|
@@ -1,46 +0,0 @@ |
691 |
|
-#!/bin/bash |
692 |
|
- |
693 |
|
-#use esmith::ConfigDB; |
694 |
|
-#use esmith::util; |
695 |
|
-#my $cdb = esmith::ConfigDB->open_ro(); |
696 |
|
-#my $domain = $cdb->get_value('DomainName'); |
697 |
|
-#my $baseDN = esmith::util::ldapBase($cdb->get_value('DomainName')); |
698 |
|
-#print $baseDN . "\n"; |
699 |
|
- |
700 |
|
-db=$(config getprop cacti DbDatabase || echo 'cacti_sme'); |
701 |
|
-user=$(config getprop cacti DbUser || echo 'cacti'); |
702 |
|
-pass=$(config getprop cacti DbPassword || echo 'changeme'); |
703 |
|
-adminpass=$(config getprop cacti AdminPassword || echo 'changeme'); |
704 |
|
-domain=$(config get DomainName) |
705 |
|
-DN=$(perl -Mesmith::util -e "print esmith::util::ldapBase(\"$domain\");") |
706 |
|
- |
707 |
|
- |
708 |
|
-# set ldap auth with optional group |
709 |
|
-#ldap_group_require 'on' or '' |
710 |
|
-# then set our admin password |
711 |
|
-/usr/bin/mysql <<EOF |
712 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_group_attrib','memberUid') ; |
713 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_group_dn','uid=cactigroup,ou=Groups,$DN') ; |
714 |
|
- |
715 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_tls_certificate','0') ; |
716 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_version','3') ; |
717 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_server','localhost') ; |
718 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_search_filter','objectClass=inetOrgPerson') ; |
719 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_search_base','ou=Users,$DN') ; |
720 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_referrals','0') ; |
721 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_port_ssl','636') ; |
722 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_port','389') ; |
723 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_mode','0') ; |
724 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_encryption','0') ; |
725 |
|
-REPLACE INTO ${db}.settings VALUES ('ldap_dn','uid=<username>,ou=Users,$DN') ; |
726 |
|
-REPLACE INTO ${db}.settings VALUES ('auth_method','3') ; |
727 |
|
-REPLACE INTO ${db}.settings VALUES ('cn_full_name','cn') ; |
728 |
|
-REPLACE INTO ${db}.settings VALUES ('cn_email','mail') ; |
729 |
|
-REPLACE INTO ${db}.settings VALUES ('path_php_binary','/usr/bin/php74') ; |
730 |
|
- |
731 |
|
-REPLACE INTO ${db}.settings VALUES ('user_template','3'); |
732 |
|
- |
733 |
|
-# set password of admin |
734 |
|
-UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1'; |
735 |
|
-EOF |
736 |
|
- |