Categories
cPanel

Email accounts disappeared in cPanel

I am unsure why, but most likely this comes through via some sort of exploit of a plugin a user has. I have seen email accounts disappear in cPanel users email accounts page. Yet their email functions fine. I found this article and it spoke a little about the issue:

https://support.cpanel.net/hc/en-us/articles/360052477034-Email-accounts-are-missing

I found it was easiest to lay it out. My example shows user anthony@vivithemage.com was not there, and this is how to restore it. If you have the passwd file or if you recall what the usernames of the email accounts should be, you can get them back showing in cPanel to modify them. This will show you what user had an email account:

[root@madhost613 vivithemage.com]# cat /home/vivithem/etc/vivithemage.com/passwd
anthony:x:671:673::/home/vivithem/mail/vivithemage.com/anthony:/usr/local/cpanel/bin/noshell
[root@madhost613 vivithemage.com#

Or you can pull it out from your email_accounts.json file:

[root@madhost613 vivithemage.com]# cat /home/vivithem/.cpanel/email_accounts.json
{"vivithemage.com":{"quota_mtime":1676555934,"disk_mtime":1676530335,"account_count":1,"shadow_mtime":1676555934,"accounts":{"anthony":{"suspended_login":0,"disk_mtime":1494927201,"diskused":"8041555","diskmtime":1676530335}}},"__version":3,"vivithemage.net":{"accounts":{},"account_count":0},"vivithemage.org":{"accounts":{},"account_count":0}}
[root@madhost613 vivithemage.com]#

now create a new shadow file in the correct directory and change ownership to the ACCOUNT. In my case it is:

cd /home/vivithem/etc/vivithemage.com/
chown vivithem:vivithem shadow

and dump this line in for EACH user missing:

anthony:$6$eGMpFjEJEI3349z3$.dhfm1rs/ftxFa8Rt8zs4yAA5dHCBdOb7P2T42Pwi/i5GpXb45BjoXiDccRbtmrwwoQkAHWF3mOwOouloYvvS1:18635::::::

If you have a second user with Elyssa you would now have this:

anthony:$6$eGMpFjEJEI3349z3$.dhfm1rs/ftxFa8Rt8zs4yAA5dHCBdOb7P2T42Pwi/i5GpXb45BjoXiDccRbtmrwwoQkAHWF3mOwOouloYvvS1:18635::::::
elyssa:$6$eGMpFjEJEI3349z3$.dhfm1rs/ftxFa8Rt8zs4yAA5dHCBdOb7P2T42Pwi/i5GpXb45BjoXiDccRbtmrwwoQkAHWF3mOwOouloYvvS1:18635::::::

replace anthony with your username missing from passwd. The hash following is irrelevant, because once you do this, you can change the password via cPanel as you would normally.

Once done this auto populates them in cPanel with no restarts required. It’s a bit of a manual process, but at least this way you can get back on with your life and reset passwords.

Categories
linux minecraft

Minecraft Bedrock Server on CentOS 8 Stream error with libnsl.so.1

My Minecraft server was working great on my CentOS 8 Stream server for a few months. Then an update they must have added or modified a dependency. When I would go to start it, it would throw:

./bedrock_server: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

Did a little googling and discovered I needed to install libnsl package:

dnf install libnsl

Once I did that, I was back up and running! Hopefully this helps someone else.

Categories
Dell linux

ssh to reset dell idrac ip address and other variables

I was working on something with an IP conflict, and then locked myself out of routing via the VPN, so the quickest way to do a fix, was to change the IP of my idrac via command line. Apparently, you can do almost everything through command line.

First step is to get onto your idrac, replacing root and IP with your own information. Note, default username and password is root – calvin. If you have a newer idrac, I think starting around idrac8, there is a tab on the server that has the default idrac username and password:

  • ssh root@192.168.0.120
  • racadm
  • racadm getniccfg

You should now have a print out of your current configuration for your NIC. To change it, you just do the following:

  • racadm config -g cfgLanNetworking -o cfgNicIpAddress  192.168.0.140
  • racadm set iDRAC.IPv4.Address  192.168.0.140

Give it a few seconds, and it should kick you out, and now have the new IP address.

If you want a full subset of the documentation go here: http://ftp.dell.com/Manuals/all-products/esuprt_electronics/esuprt_software/esuprt_remote_ent_sys_mgmt/integrated-dell-remote-access-cntrllr-7-v1.30.30_User%27s%20Guide_en-us.pdf

Otherwise here is a snippet:

% Get all iDRAC settings in a file

racadm get -f config.txt

If you like you can change the contents of config.txt and apply it back to iDRAC
racadm set -f config.txt

% Set password for root user
racadm set iDRAC.Users.2.Password PASSWORD"

% List all ssh keys for root user
racadm sshpkauth -i 2 -v -k all

% Add ssh key to root user
racadm sshpkauth -i 2 -k 1 "CONTENTS OF PUBLIC KEY"

% Delete ssh key for root user
racadm sshpkauth -i 2 -d -k 1

% Get iDRAC IP config

racadm getniccfg
racadm get iDRAC.NIC

% set iDRAC IP

Using config command:
racadm config -g cfgLanNetworking -o cfgNicEnable 1
racadm config -g cfgLanNetworking -o cfgNicIpAddress x.x.x.x
racadm config -g cfgLanNetworking -o cfgNicNetmask 255.255.255.0
racadm config -g cfgLanNetworking -o cfgNicGateway x.x.x.x
racadm config -g cfgLanNetworking -o cfgNicUseDHCP 0
racadm config -g cfgLanNetworking -o cfgDNSServersFromDHCP 0
racadm config -g cfgLanNetworking -o cfgDNSServer1 y.y.y.y
racadm config -g cfgLanNetworking -o cfgDNSServer2 y.y.y.y
• Using set command:
racadm set iDRAC.Nic.Enable 1
racadm set iDRAC.IPv4.Address x.x.x.x
racadm set iDRAC.IPv4.Netmask 255.255.255.0
racadm set iDRAC.IPv4.Gateway x.x.x.x
racadm set iDRAC.IPv4.DHCPEnable 0
racadm set iDRAC.IPv4.DNSFromDHCP 0
racadm set iDRAC.IPv4.DNS1 y.y.y.y
racadm set iDRAC.IPv4.DNS2 y.y.y.y

% Set iDRAC DNS Name
racadm set iDRAC.NIC.DNSRacName iDRACNAME

% Set iDRAC domain name
racadm set iDRAC.NIC.DNSDomainName DOMAIN.NAME

% Set iDRAC DNS Server

racadm config -g cfgLanNetworking -o cfgDNSServer1 x.x.x.x
racadm config -g cfgLanNetworking -o cfgDNSServer2 y.y.y.y

% Set Front LCD to hostname
racadm set System.LCD.Configuration 16

% Reset iDRAC to factory defaults
racadm racresetcfg

% Reset/Reboot iDRAC

racadm racreset OPTIONS

Options : soft, hard, cold
or
racadm serveraction powercycle

% Get Serial number (service tag)
racadm getsvctag

% Get current system information
racadm getsysinfo

% Configure one-time-boot to PXE

racadm set BIOS.OneTimeBoot.OneTimeBootMode OneTimeBootSeq
racadm set BIOS.OneTimeBoot.OneTimeBootSeqDev NIC.Integrated.1-1-1

% Configure persistent Boot Device

racadm config -g cfgServerInfo -o cfgServerBootOnce 0
racadm config -g cfgServerInfo -i cfgServerFirstBootDevice HDD

% Check boot order list
racadm get BIOS.BiosBootSettings.bootseq

% Disable HyperThreading
racadm set BIOS.ProcSettings.LogicalProc Disabled

% Disable OS to iDRAC pass-thru for iDRAC service module (automatically create a pseudo NIC in OS)
racadm set iDRAC.OS-BMC.AdminState Disabled

% Change SNMP public community string
racadm set iDRAC.SNMP.AgentCommunity NEW STRING

% Disable ASR
racadm config -g cfgRacTuning -o cfgRacTuneAsrEnable 0

% Configure Serial redirection

racadm config -g cfgSerial -o cfgSerialConsoleEnable 1
racadm config -g cfgSerial -o cfgSerialBaudRate 115200
racadm config -g cfgSerial -o cfgSerialCom2RedirEnable 1
racadm config -g cfgSerial -o cfgSerialTelnetEnable 0
racadm config -g cfgSerial -o cfgSerialSshEnable 1

to access console via ssh console com2

% Disable Serial On Lan
racadm config -g cfgImpiSol -o cfgIpmiSolEnable 0

% Change Power Profile
racadm set BIOS.SysProfileSettings PerfPerWattOptimizedOs

% Set AC Power Recovery

racadm set BIOS.SysSecurity.AcPwdRcvry Last
racadm set BIOS.SysSecurity.AcPwdRcvryDelay Immediate

% Get RAID physical Disk information

racadm raid get pdisks
racadm raid get pdisks -o (all information)
racadm raid get pdisks -o -p state,size (specific information)

% Get RAID Virtual Disk Information
Racadm raid get vdisks

Categories
Linux linux pfsense

Creating firewall rules for pfsense to block cameras from going out

I installed pfSense 2.4.1, to replace my Asus AC68U as my router, and purchased an Ubiquiti UAP-AC-PRO for my wireless. So far so good, but I had one thing I REALLY wanted done with this new firewall, that my old one could not, and that was properly blocking all traffic going OUT, except NTP, and DNS to resolve those NTP entries. So my set up was as follows:

If you want me to get into each of the rules, let me know and I can. It works great, as I can see it allowing the NTP and DNS entries. This works best if your DNS server is your router/gateway. If it is not, you will have to substitute in what your DNS servers are. I am waiting for something to call home, so I can then report that to FDT, my camera manufacturer, and ask them WHY is it calling home?!

Categories
linux Operating System Deployment

error when copying or overwriting the same directory name linux

my directory structure in linux – centos:

/home/html/prod/wordpress/update/
/home/html/prod/wordpress/

/wordpress/ is my wordpress install, and /update/ is my unziped download files and directories.

The errors I kept getting when trying to move or copy the entire directory while sitting in /home/html/prod/wordpress/update/ was:

mv: cannot move `wp-admin’ to a subdirectory of itself, `../wp-admin’
mv: cannot move `wp-content’ to a subdirectory of itself, `../wp-content’

cp: omitting directory `wp-admin’
cp: omitting directory `wp-content’

what I ended up doing was staying in the same directory ( /home/html/prod/wordpress/update ) and running:

cp -fR * ../

f = force
R = recursive

all went well, replaced the entire directory like I wanted and I just removed the /update directory and done.

Categories
cPanel linux

How to delete all mail in queue for cPanel exim

I ran into an issue where a user was spamming and queue up thousands of email in our cPanel server. To clear it out, I did this:

/etc/init.d/exim stop

exim -bpru | awk {'print $3'} | xargs exim -Mrm

or

exim -bpru|grep frozen|awk {'print $3'}|xargs exim -Mrm

/etc/init.d/exim start

I had about 120k emails in queue and it took about 20 seconds to remove them all. If you want to fine tune it, you can have exim delete only specific emails in queue:

grep -lr 'a certain string' /var/spool/exim/input/ | \sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm

Credit to: http://bradthemad.org/tech/notes/exim_cheatsheet.php
 

To delete frozen emails from a specific email address:

exiqgrep -i -f luser@example.tld | xargs exim -Mrm

If you just want to delete mail queue directories, sometimes faster delete:

/var/spool/exim/input and the /var/spool/exim/msglog directories

Categories
cPanel linux

Fatal error: Allowed memory size of 134217728 bytes exhausted – MySQL error – PHPMyAdmin

I had a client trying to import a 200M zip file to phpmyadmin to import into his MySQL database, he kept receiving this error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 201380904 bytes) in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/zip_extension.lib.php on line 65

It ends up that phpmyadmin is using its own php.ini config, and defaults the memory size to 128M.

Edit the file : /usr/local/cpanel/3rdparty/etc/php.ini.dist

there is a line that says memory_limit, change that to what you’d like. I changed mine to 264M.

You will want to restart cPanel as well:

/etc/init.d/cpanel restart

You will lose this setting upon reboot, so if you want to keep it, you will want to run this:

echo "/usr/local/cpanel/3rdparty/etc/php.ini.dist" >> /etc/cpanelsync.exclude

This will exclude the file when it goes to sync/update with cPanel.

Categories
cPanel linux

Copying cPanel resller account to cPanel server with root access

So I was in the process of moving a users cPanel account from an old server where he only had Reseller access to, on to my server, where I have root access. Typically you can use the method of the built in transfer within cPanel, but it is required you have root access on both servers. Because of this, it makes reseller accounts tricky. We need to do the following :

On the old server, where you have the reseller, or shared account :

1. Login to accounts cpanel www.domain.com/cpanel (or http://10.10.10.10.:2082)

2. You will then search for backups and hit enter

3. Now click on back up wizard option

[zp src=”reseller.jpg” album=”blog/cpanel/transfers/” width=”600″]

You can select wherever you would like to store it, but I prefer to jut SCP it right over to my new server.

on the new server, where you have root access :

1. Login to your server via SSH using something like putty

2. cd /home

3. wget http://domain.com/backup-1.30.2007_06-36-16_durbidge

4. log in to WHM & /Backup Restore a Full Backup/cpmove file

Note that you do need to 0777 the back up file, or you will run into permission issues when copying (if doing the backup to HOME DIR).

If you want to re-assign the reseller account, you do need to go to the reseller central, and apply the accounts to the reseller that owns them now.