/opt/dedrads/__pycache__
NameSizeModeActions
alp.cpython-313.pyc188170644editdlrm
check_prov.cpython-313.pyc63940644editdlrm
clean_exim.cpython-313.pyc89020644editdlrm
cmspass.cpython-313.pyc63780644editdlrm
cms_check.cpython-313.pyc140790644editdlrm
cms_counter.cpython-313.pyc329480644editdlrm
cpanel_postgres_manager.cpython-313.pyc407620644editdlrm
docroot.cpython-313.pyc54920644editdlrm
envinfo.cpython-313.pyc81840644editdlrm
exclude_rbl.cpython-313.pyc66820644editdlrm
first_setup.cpython-313.pyc204930644editdlrm
fixwpcron.cpython-313.pyc72230644editdlrm
innodb_converter.cpython-313.pyc143470644editdlrm
mail_sources.cpython-313.pyc99690644editdlrm
modsec_disable.cpython-313.pyc158380644editdlrm
mysql_selector.cpython-313.pyc867480644editdlrm
show-conns-adv.cpython-313.pyc684140644editdlrm
sparta.cpython-313.pyc4909030644editdlrm
vhost_data.cpython-313.pyc69830644editdlrm
Edit: /opt/dedrads/__pycache__/first_setup.cpython-313.pyc (20493B)
}jJSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r SSK r "SS5r Sr \S:Xa\ "5 gg)a$ script to resolve known issues with new vps/dedi and improve thier default configurations it is to be ran with -c on provision to alert of issues via STR/stdout -c is fast, but without flag does all the stuff that is slow (~30s) will not send STRs unless the -s flag is used Author: MathewL Nc\rSrSrSrSrSSjrSrSrSSjr Sr S r S r S r S rS rSrSrSrSrSSjrSrSrg) FirstSetupcSUlSUlUR5 UR5 UR 5 [ R "5Ulg)N)str_msgrun_logget_argsis_a_vps get_mem_totalsocket gethostname host_nameselfs /opt/dedrads/first_setup.py__init__FirstSetup.__init__s>     ++-c<[R"5nURSSSSSS9 URSSSSS S9 URS S SSS S9 URS SSSSS9 URSSSSSS9 URSSSSSS9 UR5Ulg)z argz -sz --send-str store_trueFz2Silence most output, sends STR to T2S for errors. )actiondefaulthelpz-nz--no-ea4z(Skips installing missing apache modules z-v --verbosezEnables verbose output with -s z-cz--checkz1Performs the new server checks instead of tweaks -az--allzDoes both server tweaks -dz --dns-clusterzChecks dns clustering N)argparseArgumentParser add_argument parse_argsargs)rparsers rr FirstSetup.get_argss((*  G     =     4     F     -     +  %%' rcU(aUnO[R"U5nURSUS35 [R"U[R SUSS9nWRnURS US3SS 9 U$![ a5nSUSUS3nURU5 URU5 SnAN\SnAff=f) z1 runs subprocess, builds log var, returns stdout zEXEC:  TF)stdouttextshellcheckzError on cmd: z Output: NzOUT: end) shlexjoinlogsprunPIPE Exceptionlog_strr()rcmdr* input_strrete error_strresults rrun_cmdFirstSetup.run_cmdPs I 3I 6)B'( $&&BGG$e5C 5#.  $))Ks"EI HHY  LL # # $s&A?? B> +B99B>c UR(aSnOSn[R"SSUSUR3SURSURS3S9 g ![R anUR S U35 S nAg S nAff=f) z create an STR ticket VPSzDedicated Serverzstr@imhadmin.netzNew z with errors: z0Errors encountered during first_setup.py: Host: r')destsubjectbodyzFailed to create STR ticket - N)is_vpsrads make_ticketrr TicketErrorr0)r server_stringexcs rmake_strFirstSetup.make_stres ;;!M.M =   '}o^DNN;KL ~~  = HH5cU; < < =sAAB .BB cUR(a<URR(a!URS5 UR 5 UR(d1URR(a[ R "S5 [UR=(d S5 [ R "S5 g)z8 finishes program and handles final output (str/stdout) z creating str rzfirst_setup complete.N)rr#send_strr0rIsysexitprintrs r final_outputFirstSetup.final_outputysh <? 45 89 ,- ?@rcvURS5nURS5(aURS5 gg)N)durz/var/cpanel/clusterz4 zBError: DNS clustering is not set up, /var/cpanel/cluster is empty )r< startswithr5)routputs rcheck_clusteringFirstSetup.check_clusterings8AB   U # # LL1  $rc 6URSSSUR45nU(dURS5 SnURR(aSnOSnSU3nUR S 5n[ R"S S S US 4[ R[ R[ RS9nURU5upgUR5(aURSU35 SSS5 SnSn URS5nSU;aAURSRUSRU5SRU 555 gURU 5 URU5 URSSS9 g!,(df  N=f)z checks a few things so the customer wont have to contact us for them makes an str if issues are found and the -s flag is used (vps auto prov) otherwise the errors go to stdout (dedi manual prov) intended to run after user provisioning. digz+shortz@nsz'Error: A record for hostname not found 15z-dsrz/opt/dedrads/first_setup.py utf-8atnow+minutes)stdinr(stderrz5Failed to schedule DNS cluster check with atd. Error:N)whmapi1set_tweaksettingz&key=mycnf_auto_adjust_maxallowedpacketzvalue=0)z&/usr/local/cpanel/bin/checkallsslcertsz --allow-retryr)z/usr/local/cpanel/cpkeycltzUpdate succeededzsError: New server with invalid cPanel license. stdout: {}Run these commands after fixing cPanel the license: {} {}  z"service cpanel restart &>/dev/nullTr*)r<rr5r# dns_clusterencoder1Popenr3DEVNULL communicatepollformatr/) rrgdelayflagsp_cmdproc_rs tweak_cmdssl_cmds r check_thingsFirstSetup.check_thingsspuht~~FG LLC D 99 EE.ug6 W% XX 5#ui 0''::77  ((/IAyy{{ #H&    => V + LL"6HHY'HHW%  LL ! LL # LL=TL JW  s 6=F  Fc[RRS5(aURS5 UR(a"URS5 URSSS9 g URS5 URS5 g ) z These operations are kinda slow (30 seonds or so) So they are best to be ran before the customer pays They also do not require a valid cpanel license "/usr/sbin/yum-complete-transaction)rr\)yumr\installzperl-File-Slurpz perl-YAMLzperl-YAML-Syckzperl-Template-Toolkitzfyes y | cpan -i Switch LWP::Protocol::https IO::Scalar Date::Parse Text::Template CDB_File &>/dev/nullTrw)cpanz-izJSON::XS)kcarectlz-uN)r`pathexistsr<rCrs r tune_systemFirstSetup.tune_systemsv 77>>> ? ? LLE F ;; LL  LL+   LL3 4 LL+ ,rcUR(agUR/SQ5 URS5 URSS/5 URSS/5 g)z8Sets swappiness to 0 and clears swap if dedicated serverN)sysctlz-wzvm.swappiness=0zSwap is now clearing swapoffrswapon)rCr<r0rs rset_swappinessFirstSetup.set_swappinesssH ;;  89 )* i&' h%&rc@URR(agSn[RR U5(dUR SR U5SS9 SnSnUHnSUS 3nS US 3nURXTXS 9 M! URS SU45 g)z! Installs missing Apache modules Nz(/etc/cpanel/ea4/profiles/custom/imh.jsonz>missing ea4 profile, skipping apache module install. path: {} Tr,)zea-apache24-mod_headerszea-apache24-mod_envzea-apache24-mod_suexeczea-apache24-mod_versionzea-apache24-mod_proxy_fcgizea-apache24-mod_remoteipz"ea-apache24",z \s*("|')?z("|')?,z "z",)afterz!/usr/local/bin/ea_install_profilez --install) r#no_ea4r`risfiler0r~conf_setr<)rea_fileea4_tuprvaluesearchs rtune_ea4FirstSetup.tune_ea4s 99   <ww~~g&& HH99?   !E#E7'4Fwb+E MM&M > 0+w G rcfSnSn[[R"URS- S- 55nUS:aSnOUS:aSnUS-nS nUR S S US 3US S9 UR SS US 3US S9 UR SS US 3US S9 UR SS US 3US S9 UR (acUR S5 Sn[R"S5 UR S5 Sn[USSS9n U RU5 SSS5 OUR S5 URS/5 URSS/5 URS /5 URS!S"S#9 g![[4anUR US35 SnANSnAff=f!,(df  N=f)$z'Does math to figure out Apache settingsi z/etc/cpanel/ea4/ea4.confz+(^\s*"minspareservers"\s*:\s*"?)\d+("?)[^$]z\g<1>z\g<2>,F)fallbackz+(^\s*"maxspareservers"\s*:\s*"?)\d+("?)[^$]z'(^\s*"serverlimit"\s*:\s*"?)\d+("?)[^$]z&(^\s*"maxclients"\s*:\s*"?)\d+("?)[^$]z"Setting FPM default pool settings z3pm_process_idle_timeout : 30 pm_max_requests : 128 z/var/cpanel/ApachePHPFPMr'NzSetting Apache global config z2/var/cpanel/ApachePHPFPM/system_pool_defaults.yamlwrmencodingz0Skipping FPM default pool settings on Dedicated z/scripts/rebuildhttpdconfz/scripts/php_fpm_configz --rebuildz"/scripts/restartsrv_apache_php_fpmz&/scripts/restartsrv_apache &>/dev/nullTrw)intmathfloor mem_totalrrCr0r`makedirsOSErrorFileExistsErroropenwriter<) r min_spare max_spare server_limit max_workers conf_file fpm_configr9rfhs rtune_apache_phpFirstSetup.tune_apache_php=s  4::dnnu& :;< =T J_- #A3b"" #32s$ E1=F"1FFF" F0cSnSnSnSnSnSnUHnURXq:a XsnXrnM O SUS3nSUS 3nS nURS XX5 URS UU5 UR/S Q5 g)zx sets innodb buffer pool size and instances maxes out at 4GB of innodb buffer pool every 1GB gets another pool instance r))i@Br)i-ri)ijri)iri)irirzinnodb_buffer_pool_size=zM zinnodb_buffer_pool_instances=r'z /etc/my.cnfz$^\s*innodb_buffer_pool_size\s*=[^$]*z)^\s*innodb_buffer_pool_instances\s*=[^$]*)servicemysqlr^N)rrr<) rmem_gate pool_count pool_size mem_tiers buffer_poolpool_instancestierrs r tune_mysqlFirstSetup.tune_mysqls     D~~."o !%!1  1 SA 88HK!  3[  8   45rcSnURUSS9n[U5nU(d&URSSS9 [R"S5 X lg)zV Gets total memory switched to free because /proc/meminfo may not be kb in the future z)free |sed -e 1d -e 3d | awk '{print $2}' Trwz!Failed to check available memory r,rN)r<rr0rMrNr)rr6rs rr FirstSetup.get_mem_totalsH >LLDL1  N  HH9tH D HHQK"rc SnSn[RRU5n SU S3n [U SSS9n [USS9n U R 5n X,;a)UR SUSUS 3S S 9 S S S 5 S S S 5 g U R S 5n U GH"n U(a9U(d2[R"XM5(aS nUR SUS 35 U(dUS:wdU(aU(aU(dU(d[R"X5(dUS:XaUS:Xa6UR SUSUS 3S S 9 U US 3nU RU5 US - nMUR SUSUS 3S S 9 [R"XU 5nU RU5 US - nGMU RU 5 GM% S S S 5 U(dU(aU(d9UR SRU5S S 9 US - nU RUS 35 OCUR S5 [R"U 5 URSX#USS9 S S S 5 g S S S 5 U(d7UR SRXX45S S 9 [R"U 5 g [R"X5 g !,(df  N=f!,(df  Nt=f)z# configuration management function rz/tmp/z.tmprrmrzSetting already set in file z: r'Tr,Nrzafter line found: APPENDz appending z after z"doing traditional search/replace: z -> z)appending to end of file as fallback: {} z,doing recurisve conf_set for after fallback F)rrzSWarning: Failed to replace (fallback False): search:{} replace:{} file:{} after:{} )r`rbasenamerreadr0 splitlinesrerrsubr~rarshutilmove)r_search_replace_filermultipler after_found replace_countbase_fntmp_fntmp_fhog_fhog_linenew_lines rrFirstSetup.conf_sets   ''""5) & &# 0Feg.% $HH6ugS "M /1 0((.$G[RYYu5N5N&' #5eWB!?@"'7h+> %+%]YYw88Gx>+ , ,DKDKr)r#rrCrr rN)F)rFT)__name__ __module__ __qualname____firstlineno__rr r<rIrPr0r5rbrhrrrrrrr rr __static_attributes__rrrrso./(b*=(  # A?KB#-J' @@KD#6J #LPT#l rrc[5nURR(aqUR5 UR 5 UR 5 UR 5 UR5 UR5 UR5 OURR(aAUR 5 UR5 UR5 UR5 O\URR(aUR5 O0UR5 UR 5 UR 5 UR5 g)zif -c is used, the first section runs this is intended to be ran after the customers user is added without -c is meant to be ran before the customer is provisioned (clonevps /ready dedi)N)rr#allrrrrbrrrr+rxrhrP)setups rmainrs LE zz~~                         r__main__)__doc__r. subprocessr1r`rMrrrrr rDrrrrrrrsP   u u p< zFr