{"id":118,"date":"2012-01-30T17:45:02","date_gmt":"2012-01-30T17:45:02","guid":{"rendered":"http:\/\/www.davidhedges.info\/?p=118"},"modified":"2018-06-03T17:45:56","modified_gmt":"2018-06-03T17:45:56","slug":"symantec-antivirus-for-suse-linux-install-remove-build-kernel-modules-script","status":"publish","type":"post","link":"https:\/\/www.davidhedges.info\/index.php\/2012\/01\/30\/symantec-antivirus-for-suse-linux-install-remove-build-kernel-modules-script\/","title":{"rendered":"Symantec Antivirus for SuSE Linux install \/ remove \/ build kernel modules script"},"content":{"rendered":"<p>I had run into issues getting consistency installing Symantec AV on all of the Linux servers. Because all of ours are SuSE, I wrote this specifically for SuSE, but it should be easy to modify for redhat or other distributions (ex. instead of using yast, use yum).<br \/>\nThis script is designed to make antivirus install, removal and kernel module updates quick and easy, while keeping your install on a central server that is easy to get to.<br \/>\nIf you use it, let me know if it works well, or you run into issues&#8230;<\/p>\n<p>&#8212;- here it is&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>#Version *** update if you make a change!!<br \/>\nVER=1.3<\/p>\n<p>#install locations (this uses wget and must have http:\/\/ or ftp:\/\/)<br \/>\n#RPM PATH<br \/>\nRPMPATH=&#8221;<a href=\"ftp:\/\/server.fqdn.or.ip\/symantec\/rpm\/*%22\">ftp:\/\/server.fqdn.or.ip\/symantec\/rpm\/*&#8221;<\/a><\/p>\n<p>#Kernel Mod source Path<br \/>\nKMPATH=&#8221;<a href=\"ftp:\/\/server.fqdn.or.ip\/symantec\/ap-kernelmodule-1.0.10-26.tar.gz%22\">ftp:\/\/server.fqdn.or.ip\/symantec\/ap-kernelmodule-1.0.10-26.tar.gz&#8221;<\/a><\/p>\n<p># ******************** verify we are using a root account<br \/>\nif [ $UID != 0 ]<br \/>\nthen<br \/>\necho &#8220;You need to run this as root! exiting&#8230;&#8221;<br \/>\nexit 1;<br \/>\nfi<\/p>\n<p># ******************* check if this is a 32-bit or 64-bit system<\/p>\n<p>ARCH=`uname -m`<\/p>\n<p># ****************** Generate a random key<\/p>\n<p># generate a random key<br \/>\nRANDOM=`date &#8216;+%s&#8217;`<br \/>\nRAND1=$[($RANDOM % 999) + 1]<\/p>\n<p># **&#8211;**&#8211;: End of startup variables \/ starting menus :&#8211;**&#8211;**<\/p>\n<p>_info () {<\/p>\n<p>dialog &#8211;title &#8220;Installer $VER Info&#8221; &#8211;msgbox &#8220;Contact &lt;your name here&gt; for updates or questions \\n your conatct info here &#8221; 6 50<br \/>\n_main<br \/>\n}<\/p>\n<p>_rmav () {<\/p>\n<p>exec 3&gt;&amp;1<br \/>\n# Stop all AV services<br \/>\n\/etc\/init.d\/autoprotect stop 2&gt;$1 ; dialog &#8211;infobox &#8220;Stopping autoprotect&#8221; 3 45<br \/>\n\/etc\/init.d\/symcfgd stop 2&gt;$1 ; dialog &#8211;infobox &#8220;Stopping symcfgd&#8221; 3 45<br \/>\n\/etc\/init.d\/rtvscand stop 2&gt;$1 ; dialog &#8211;infobox &#8220;Stopping rtvscand&#8221; 3 45<\/p>\n<p># Remove RPM&#8217;s<br \/>\nrpm -ev savui ; dialog &#8211;infobox &#8220;removing RPMs [savui]&#8221; 3 45<br \/>\nrpm -ev savjlu ; dialog &#8211;infobox &#8220;removing RPMs [savjlu]&#8221; 3 45<br \/>\nrpm -ev savap ; dialog &#8211;infobox &#8220;removing RPMs [savap]&#8221; 3 45<br \/>\nrpm -ev sav ; dialog &#8211;infobox &#8220;removing RPMs [sav]&#8221; 3 45<\/p>\n<p># remove symantec av files<br \/>\nrm -f \/etc\/init.d\/autoprotect ; dialog &#8211;infobox &#8220;removing files .&#8221; 3 45<br \/>\nrm -f \/etc\/init.d\/symcfgd ; dialog &#8211;infobox &#8220;removing files ..&#8221; 3 45<br \/>\nrm -f \/etc\/init.d\/rtvscand ; dialog &#8211;infobox &#8220;removing files &#8230;&#8221; 3 45<br \/>\nrm -f \/etc\/symantec\/VPREG*.* ; dialog &#8211;infobox &#8220;removing files &#8230;.&#8221; 3 45<br \/>\nrm -f \/etc\/ld.so.conf.d\/symav.conf ; dialog &#8211;infobox &#8220;removing files &#8230;..&#8221; 3 45<br \/>\nrm -rf \/etc\/symantec\/NLS ; dialog &#8211;infobox &#8220;removing files &#8230;&#8230;&#8221; 3 45<br \/>\nrm -rf \/opt\/Symantec\/symantec_antivirus ; dialog &#8211;infobox &#8220;removing files &#8230;&#8230;.&#8221; 3 45<br \/>\nrm -rf \/opt\/Symantec\/autoprotect ; dialog &#8211;infobox &#8220;removing files &#8230;&#8230;&#8221; 3 45<br \/>\nrm -rf \/root\/sav*install.log* ; dialog &#8211;infobox &#8220;removing files . &#8230;..&#8221; 3 45<br \/>\nrm -f \/var\/lock\/subsys\/symcfgd ; dialog &#8211;infobox &#8220;removing files .. &#8230;.&#8221; 3 45<br \/>\nrm -f \/var\/lock\/subsys\/rtvscand ; dialog &#8211;infobox &#8220;removing files &#8230; &#8230;&#8221; 3 45<br \/>\nrm -rf \/var\/symantec\/Quarantine ; dialog &#8211;infobox &#8220;removing files &#8230;. ..&#8221; 3 45<br \/>\nrm -rf \/var\/symantec\/Logs ; dialog &#8211;infobox &#8220;removing files &#8230;.. .&#8221; 3 45<br \/>\nrm -rf \/var\/tmp\/I2_LDVP.TMP ; dialog &#8211;infobox &#8220;removing files &#8230;&#8230; &#8221; 3 45<br \/>\nrm -rf \/var\/symantec ; dialog &#8211;infobox &#8220;removing files &#8230;&#8230;&#8221; 3 45<br \/>\nrm -f \/etc\/Symantec.conf ; dialog &#8211;infobox &#8220;removing files . &#8230;..&#8221; 3 45<br \/>\nrm -rf \/etc\/symantec ; dialog &#8211;infobox &#8220;removing files .. &#8230;.&#8221; 3 45<br \/>\nrm -rf \/opt\/Symantec ; dialog &#8211;infobox &#8220;removing files &#8230; &#8230;&#8221; 3 45<\/p>\n<p>dialog &#8211;title &#8220;Uninstall Complete&#8221; &#8211;msgbox &#8220;AV removal has completed&#8221; 6 50<\/p>\n<p>_main<\/p>\n<p>}<\/p>\n<p>_instav () {<\/p>\n<p>#Get credentials to login and get the files needed<br \/>\nexec 3&gt;&amp;1<br \/>\nUNAME=$(dialog &#8211;title &#8220;AD Account credentials&#8221; &#8211;inputbox &#8220;Username:&#8221; 10 40 2&gt;&amp;1 1&gt;&amp;3)<br \/>\nPASS=$(dialog &#8211;title &#8220;AD Account Credentials&#8221; &#8211;insecure &#8211;passwordbox &#8220;Password:&#8221; 10 40 2&gt;&amp;1 1&gt;&amp;3)<\/p>\n<p># Download the files we need<br \/>\nwget -q -P \/tmp\/$RAND1 &#8211;ftp-user=$UNAME &#8211;ftp-password=&#8221;$PASS&#8221; $RPMPATH ; dialog &#8211;infobox &#8220;Downloading RPMs&#8221; 3 34<br \/>\nwget -q -P \/tmp\/$RAND1 &#8211;ftp-user=$UNAME &#8211;ftp-password=&#8221;$PASS&#8221; $KMPATH ; dialog &#8211;infobox &#8220;Downloading Kernel patch&#8221; 3 34<\/p>\n<p>if [ -d \/opt\/Symantec\/autoprotect ]<br \/>\nthen<br \/>\ndialog &#8211;infobox &#8220;Detected AV a reboot will be needed to apply kernel modules&#8221; 3 45<br \/>\nelse<br \/>\nmkdir \/opt\/Symantec<br \/>\nmkdir \/opt\/Symantec\/autoprotect<br \/>\nfi<\/p>\n<p>cd \/tmp\/$RAND1<br \/>\ntar -zxf ap-kernelmodule-1.0.10-26.tar.gz<br \/>\ncd ap-kernelmodule-1.0.10-26<br \/>\n.\/build.sh &#8211;kernel-dir \/lib\/modules\/$(uname -r)\/build &gt; \/tmp\/$RAND1\/mod.log 2&gt;&amp;1 ; dialog &#8211;infobox &#8220;Building Kernel Modules&#8221; 3 34<br \/>\ncd bin.ira<br \/>\nmv .\/* \/opt\/Symantec\/autoprotect<\/p>\n<p>#Install the AV RPMs<br \/>\nif [ $ARCH = x86_64 ]; then<br \/>\ncd \/tmp\/$RAND1<br \/>\nrpm -i sav-*.i386.rpm savap-x64-*.x86_64.rpm savjlu-*.i386.rpm savui-*.i386.rpm ; dialog &#8211;infobox &#8220;intalling Symantec AV&#8221; 3 34<br \/>\necho &#8220;$ARCH&#8221;<br \/>\nelse<br \/>\ncd \/tmp\/$RAND1<br \/>\nrpm -i sav-*.i386.rpm savap-*.i386.rpm savjlu-*.i386.rpm savui-*.i386.rpm ; dialog &#8211;infobox &#8220;intalling Symantec AV&#8221; 3 34<br \/>\necho &#8220;$ARCH&#8221;<br \/>\nfi<\/p>\n<p>dialog &#8211;title &#8220;Install Complete&#8221; &#8211;msgbox &#8220;AV and Kernel Modules have been installed&#8221; 6 50<\/p>\n<p>rm -R \/tmp\/$RAND1<br \/>\n_main<br \/>\n}<\/p>\n<p>_upmods () {<\/p>\n<p>#Get credentials to login and get the files needed<br \/>\nexec 3&gt;&amp;1<br \/>\nUNAME=$(dialog &#8211;title &#8220;AD Account credentials&#8221; &#8211;inputbox &#8220;Username:&#8221; 10 40 2&gt;&amp;1 1&gt;&amp;3)<br \/>\nPASS=$(dialog &#8211;title &#8220;AD Account Credentials&#8221; &#8211;insecure &#8211;passwordbox &#8220;Password:&#8221; 10 40 2&gt;&amp;1 1&gt;&amp;3)<\/p>\n<p># Download the files we need<br \/>\nwget -q -P \/tmp\/$RAND1 &#8211;ftp-user=$UNAME &#8211;ftp-password=&#8221;$PASS&#8221; $KMPATH ; dialog &#8211;infobox &#8220;Downloading Kernel patch&#8221; 3 34<\/p>\n<p>if [ -d \/opt\/Symantec\/autoprotect ]<br \/>\nthen<br \/>\ndialog &#8211;infobox &#8220;Detected AV a reboot will be needed to apply kernel modules&#8221; 3 45<br \/>\nelse<br \/>\nmkdir \/opt\/Symantec<br \/>\nmkdir \/opt\/Symantec\/autoprotect<br \/>\nfi<\/p>\n<p>cd \/tmp\/$RAND1<br \/>\ntar -zxf ap-kernelmodule-1.0.10-26.tar.gz<br \/>\ncd ap-kernelmodule-1.0.10-26<br \/>\n.\/build.sh &#8211;kernel-dir \/lib\/modules\/$(uname -r)\/build &gt; \/tmp\/$RAND1\/mod.log 2&gt;&amp;1 ; dialog &#8211;infobox &#8220;Building Kernel Modules&#8221; 3 34<br \/>\ncd bin.ira<br \/>\nmv .\/* \/opt\/Symantec\/autoprotect<\/p>\n<p>dialog &#8211;title &#8220;Install Complete&#8221; &#8211;msgbox &#8220;Kernel Modules have been installed \\n You will need to reboot for them to &#8221; 6 50<\/p>\n<p>rm -R \/tmp\/$RAND1<br \/>\n_main<br \/>\n}<\/p>\n<p>_main () {<br \/>\nexec 3&gt;&amp;1<br \/>\nM1=$(dialog &#8211;title &#8220;Symantec AV installer $VER&#8221; \\<br \/>\n&#8211;menu &#8220;Choose from one of the following options:&#8221; 15 55 5 \\<br \/>\n1 &#8220;Install Symantec AV&#8221; \\<br \/>\n2 &#8220;Update Kernel Modules&#8221; \\<br \/>\n3 &#8220;Remove Symantec AV&#8221; \\<br \/>\n4 &#8220;Info&#8221; 2&gt;&amp;1 1&gt;&amp;3)<br \/>\n#retv=$?<br \/>\n#[ $retv -eq 1 -o $retv -eq 255 ] &amp;&amp; exit<\/p>\n<p>case $M1 in<br \/>\n1) _instav ;;<br \/>\n2) _upmods ;;<br \/>\n3) _rmav ;;<br \/>\n4) _info ;;<br \/>\nesac<br \/>\n}<\/p>\n<p>_gcc () {<\/p>\n<p>GCC=`rpm -qa |grep ^gcc-[0-9] |awk -F &#8220;-[0-9]&#8221; &#8216;{print $1}&#8217;` ; dialog &#8211;infobox &#8220;Checking gcc and installing if needed&#8221; 3 45<\/p>\n<p>if [ &#8220;$GCC&#8221; != &#8220;gcc&#8221; ] ; then<br \/>\n#echo &#8220;gcc is not installed&#8221;<br \/>\nyast -i gcc<br \/>\nfi<\/p>\n<p>_pkg-test<br \/>\n}<\/p>\n<p>_kernel () {<\/p>\n<p>KSOURCE=`rpm -qa |grep kernel-source |awk -F &#8220;-[0-9]&#8221; &#8216;{print $1}&#8217;` ; dialog &#8211;infobox &#8220;Checking kernel source and installing if needed&#8221; 3 45<\/p>\n<p>if [ &#8220;$KSOURCE&#8221; != &#8220;kernel-source&#8221; ] ; then<br \/>\n# echo &#8220;kernel-source is not installed&#8221;<br \/>\nyast -i kernel-source<br \/>\nfi<\/p>\n<p>_pkg-test<br \/>\n}<\/p>\n<p>_pkg-test () {<\/p>\n<p>GCC=`rpm -qa |grep ^gcc-[0-9] |awk -F &#8220;-[0-9]&#8221; &#8216;{print $1}&#8217;` ; dialog &#8211;infobox &#8220;Checking if gcc is installed&#8221; 3 45<br \/>\nif [ &#8220;$GCC&#8221; != &#8220;gcc&#8221; ] ; then<br \/>\n_gcc<br \/>\nfi<\/p>\n<p>KSOURCE=`rpm -qa |grep kernel-source |awk -F &#8220;-[0-9]&#8221; &#8216;{print $1}&#8217;` ; dialog &#8211;infobox &#8220;Checking if kernel source is installed&#8221; 3 45<br \/>\nif [ &#8220;$KSOURCE&#8221; != &#8220;kernel-source&#8221; ] ; then<br \/>\n_kernel<br \/>\nfi<\/p>\n<p>_main<br \/>\n}<\/p>\n<p>_pkg-test<\/p>\n<p>exit<\/p>\n<p>&#8212;&#8211;end &#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had run into issues getting consistency installing Symantec AV on all of the Linux servers. Because all of ours are SuSE, I wrote this specifically for SuSE, but it should be easy to modify for redhat or other distributions (ex. instead of using yast, use yum). This script is designed to make antivirus install, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-118","post","type-post","status-publish","format-standard","category-it-blog","entry"],"_links":{"self":[{"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":1,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":119,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/posts\/118\/revisions\/119"}],"wp:attachment":[{"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}