Cannot_register user in ejabberd-21 (unknown virtual host) - ejabberd

I'my trying to simply register user using ejabberdctl:
ejabberdctl register admin 100.100.100.100 123456
and receive: unknown virtual host - same for every user.
Configuration:
ejabberd.yml:
hosts:
- "100.100.100.100"
auth_method:
-sql
-external
/etc/hosts
127.0.0.1 100.100.100.100
127.0.0.1 localhost
No errors in log files both in /opt/ejabberd/logs and /var/log/
No errors in debug mode.
ejabberd version - 21.07

I followed your configuration, with only this change (I don't have SQL or extauth configured):
auth_method:
- internal
And it works correctly:
ejabberdctl register admin 100.100.100.100 123456
User admin#100.100.100.100 successfully registered
Can you configure like I do, only internal, and check again?
If it works with internal, then enable only sql. Does it work?
If it works with sql, enable only external. Does it work?
If it works, then enable both sql and external as you desired. Does it work?

ejabberdctl register admin custom_hostname your_custom_password
it works and will create account like
hostname: admin#custom_hostname
password: your_custom_password

Related

connecting to MySQL server 8.0 from remote network (windows 10)

I want to have a database on my laptop and grant permissions and access to my friends so they can read/write from their home. What I have done so far:
Downloaded MySQL on both devices
set up user and granted permission on the local server using
CREATE USER 'MyUserName'#'%' IDENTIFIED BY 'MyPassword';
GRANT INSERT, SELECT ON *.* TO 'MyUserName'#'%';
FLUSH PRIVILEGES;
tried finding bind-address from my.ini file but there was no such line. I ran
show global variables like 'bind_address'; and I got the value * so I guess it allows remote access.
Restarted MySQL80 service on both devices
Checked that inbound firewall rules allow access to port 3306 (MySQL had already set a few rules so I left them as is)
Tried connecting from remote server using MySQL shell (i got the public IP from icanhazip.com)
\connect MyUserName#<public IP for my server 92.-.-.->
It prompts me for the password but after I enter it I get
MySQL Error 1045: Access denied for user 'MyUserName'#'<the IP address>' (using password: YES)
I tried testing connection using powershell:
test-netconnection -computername -port 3306
but it says:
WARNING: TCP connect to (<IP>) : 3306) failed
WARNING: Ping to <IP> failed with status: TimedOut
I even tried testing connection on the same local computer with the same command (using the public and private IPs) and it failed. I'm not sure where to go from here. I have looked at other similar questions on stack but they all seem to be addressing one of these things that I have done.
There was one more firewall that I forgot about which was on my default gateway. To get around this it really depends on the router but what I did was:
open cmd and type ipconfig and look for Default Gateway
type that IP in my browser and log into my router
find LAN IP Setup and reserve my IP for my device
find the security options and firewall rules and have allow inbound and outbound rules to my private IP and forward the port.

Access Denied for User 'username'#'IP' error - digtal ocean

I've currently set up a staging area for my app in Digital Ocean with LAMP stack. The Framework for my app is Laravel 5.5 and Vue 2x.
In development, I've been using remote MySQL and had no issues with the connection error. However, when I moved it to the staging env, it is giving me access denied error. When I looked at it closely to the error log, Access denied is for username#[digital-ocean-droplet-ip], whereas I have properly configured the MySQL credentials to the remote host IP under laravel's config/database file.
So, I am doubtful if I have to do any configuration under Apache to allow any external MySQL connection? I forgot the cmd but I did allow sfw firewall allow to any port 3306 to the remote server IP address in Apache.
Any help is appreciated.
Thanks!
MySQL by default does not create an user with access from remote connections.
First you need to create an user on database that allows connection from outside (%) or a specific IP
CREATE USER 'newuser'#'%' IDENTIFIED BY 'password';
Than give him privileges
GRANT ALL PRIVILEGES ON *.* TO 'newuser'#'%';
The *s could be replaced by your database and table name respectively
You might also check if in your mysql configuration(/etc/mysql/mysql.conf.d/mysqld.cnf in my case) has this line uncommented
bind-address = 127.0.0.1
Change the ip if necessary
restart mysql and apache
sudo service apache2 restart
sudo service mysql restart
Than update the user and password at your .env file and try again!

On Synology DS218play, WordPress cannot connect to the user database, but phpmyadmin can

I am facing some issues while setting up my Synology DS218play. I hope you will be able to help me. Here is my current configuration :
I have a virtual host set with the Web Station app
Domain : blog.domain.com
Directory : web/blog.domain.com/wordpress/
HTTP Server : Nginx
PHP version : 7.0
HSTS and HTTP/2 checked
I have installed the MariaDB 10 and phpmyadmin packages from Synology Community repository.
I can log into phpmyadmin with root user, hence I created a blog user and a 'blog' database. blog user is granted with all privileges for blog database. I set localhost to hostname for blog user. I guess SQL Server is listening through 3306 port by default, I don't see where I can check or edit this.
I can log into phpmyadmin with my blog user, and I see only the blog database (and information_schema, I assume it is normal).
Here comes the problem : When I try to go to https://blog.domain.com, it redirects me to https://blog.domain.com/wp-admin/setup-config.php, I press 'Let's go!' and enter my credentials :
user : blog
password :
hostname : localhost
database name : blog
table prefix : wp_ (default value)
And when I validate, I go to an error page : error establishing a database connection. I triple checked user/password, it works into phpmyadmin and not with WordPress. So I assume the error comes from hostname, or phpmyadmin configuration to allow the connection from outside the phpmyadmin's interface. I would like to test directly on my NAS with mysql command line, but I have not found any solution to do that.
NB: I don't know if it is useful, but I set up my router to redirect the port 3306 to my NAS. It did not change anything.
Thank you for any help.
Using Apache instead of Nginx here, but I had the exact same problem on my Synology. It was solved by changing the hostname from localhost to 127.0.0.1:3307. This is the way to link to Maria DB 10. The port for Maria DB 5 would apparently be 3306 (not tested). Wordpress is now installed correctly and I can access the admin page.
But... this is not the end of the story. As soon as you will try to install a theme or a plugin, or update something, Wordpress will ask for FTP credentials to the Web Server. To make a long story short, Telnet your way as Default Admin (the SSH terminal and Admin Default User must be enabled) and type:
sudo su <--- To get root access
Use the same password
chown -R http:http /volume1/web/myfoldername <--- To give propre ownership
chmod -R 775 /volume1/web/myfoldername <--- To give propre access privileges
Everything works well from there.

error message while connecting to phpmyadmin

i can't connect to PhpMyAdmin on my local server as shown bellow, it shows me the message "#1130 - Host 'localhost' is not allowed to connect to this MySQL server", i think the problem is with MySql, someone can help pleas ?
try given link
#1130 - Host ‘localhost’ is not allowed to connect to this MySQL server
This sounds like it might be an IPV4/IPV6 issue. Modern browser will use either, why the decide to use IPV4 or IPV6 address ranges, I dont know yet.
You can test this theory by launching phpMyAdmin like this 127.0.0.1/phpmyadmin if that works and ::1/phpmyadmin does not, then the problem is probably related to phpMyAdmin not being allowed to be run from the ::1 IPV6 address.
First make sure you have these entries in your HOSTS file \windows\system32\drivers\etc\hosts
127.0.0.1 localhost
::1 localhost
These entries will associate the domain name localhost with both the IPV4 (127.0.0.1) and IPV6(::1) loopback ip address's i.e. connect to this machine when you see the domain name localhost.
If you have to change the HOSTS file you then need to reboot or run these 2 commands from a command windows that is started using "Run as Administrator" to refresh the dnscache and pick up your changes.
net stop dnscache
net start dnscache
Next check the Alias settings for phpMyAdmin.
Edit the \wamp\alias\phpmyadmin.conf file.
Make sure that both 127.0.0.1 and ::1 are allowed to connect to Apache
If you are using Apache 2.2.x then look for this section and make sure it contains this in the Allow from line
Order Deny,Allow
Deny from all
Allow from localhost ::1 127.0.0.1
If you are using Apache 2.2.4 then look for this section and make sure it contains this in the Require line. If you still have the old Apache 2.2 syntax in here, remove it and use this instead.
Require local
The Require local covers both localhost, 127.0.0.1 and ::1 in Apache 2.4
I would help, but I can't read the text in your image and there is no code either.

Allow remote access MySQL, Ubuntu

Im trying to allow remote accecss to MySQL on my Ubuntu server (VPS).
Im trying to access the database through an Java application Im building in Netbeans. Netbeans kick the following error message, when trying to connect:
Cannot establish a connection to
jdbc:mysql://xx.xxx.xxx.xxx:3306/xxxxxx?zeroDateTimeBehavior=convertToNull
using com.mysql.jdbc.Driver (null, message from server: "Host
'xx.xxx.xxx.xxx' is not allowed to connect to this MySQL server")
I have followed this guide when trying to connect to my MySQL server through Netbeans: https://www.youtube.com/watch?v=Fk2EkBs-Oq4
MySQL
MySQL running on standard port 3306.
In /etc/mysql/my.cnf I have comment out the following row:
bind-address = 127.0.0.1
So no bind-address exist in my my.cnf -file.
UFW
I have UFW installed on my server. ufw status numbered looks like this:
To Action From
-- ------ ----
[ 1] 22 ALLOW IN Anywhere
[ 2] 80/tcp ALLOW IN Anywhere
[ 3] Anywhere ALLOW IN MY-IP-ADDRESS*
[ 4] 3306/tcp ALLOW IN Anywhere
[ 5] 3306/tcp ALLOW IN MY-IP-ADDRESS*
[ 6] 22 (v6) ALLOW IN Anywhere (v6)
[ 7] 80/tcp (v6) ALLOW IN Anywhere (v6)
[ 8] 3306/tcp (v6) ALLOW IN Anywhere (v6)
*MY-IP-ADDRESS = The ip address I have "out" to the internet, which I recive from: http://whatismyipaddress.com/
What am I doing wrong and why cant I connect?
EDIT:
The thing is that if i bind in my.cnf I can only bind one IP. I need localhost access for my live websites running on the vps and also access from my dev-computer (which this thread is aiming). My thoughts was to remove bind in my.cnf to allow all and then grant access through my firewall UFW to localhost and my dev-computer.
if you want to use Connect via PuTTY and tunnel
look at the bottom of this answer
I assume you have a mysql administration tool.
The following will look depending on the tool used linux or something else, but work the same.
Login there and go into the user administration.
If you have installation a normal Mysql, then there should be only root without a host.
From the moment when you have created a localhost, then Mysql assume that you want to manage multiple hosts.
Create a existing host. A computer name exists in your network. Here root#dxxxxx-p. This should be created under the root user.
That's not all now you still have all your tables grant permissions.
Here pricelist has no assigned permissions
But sample has all permissions
With multiple host administration is for example.
A computer with two accessible names
myComp1 : IP 192.168.0.101
localhost : IP 127.0.0.1
If you now connect on the same computer with "mysql -h localhost -u root ...." you get the permissions you have assigned to localhost.
You might think because localhost and myComp1 is the same computer.
Now automatically myComp1 has the same permission as localhost .
But this is not so. So be careful.
Connect via `PuTTY` and tunnel
when you connect you with PuTTY, everything described above is not necessary.
With tunnel you connect as root#localhost on the ubuntu server.
Localhost is here somewhat misleading because it does not relate to your windows computer but on the localhost on the ubuntu server.
Access Your MySQL Server Remotely Over SSH
So you’ve got MySQL on your web server, but it’s only opened to local ports by default for security reasons.
If you want to access your database from a client tool like the MySQL Query Browser or Netbeans , normally you’d have to open up access from your local IP address… but that’s not nearly as secure.
So instead, we’ll just use port-forwarding through an SSH tunnel, so your MySQL client thinks it’s connecting to your localhost machine, but it’s really connecting to the other server through the tunnel.
Go to SSH->Tunnels
After clicked Save
Make sure that the MySQL server are off on the Windows computer.
I'm using MySQL System Tray Monitor.
With a right click, I see all the options.
click Open
If you have done all the settings for SSH on ubuntu right, that should appear here. (If NOT Search for Ubuntu SSH and Putty on the web)
Do not forget: Now that you've logged on ubuntu server you have all the right as root#localhost on the server itself, since root#localhost has all rights, you need not create a host and create permissions to schemas
Now on your windows computer open MySql Query Browser
Now connect to localhost (remember this localhost means localhost on ubuntu)
You can use in Netbeans the same settings to connect to Mysql on Ubuntu
Mysql Query Browser opens you can work on your Databases on UBUNTU
Netbeans
After closing New Connection Wizard
A new connection is created with all Databases On Mysql Ubuntu.
Change
bind-address = 127.0.0.1
To
bind-address = YOUR-IP-ADDRESS*
You need to grant access to that database :
GRANT ALL ON foo.* TO bar#xxx.xxx.xxx.xxx IDENTIFIED BY 'PASSWORD';
And also updated the firewall rules something like :
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT