Can't Access Ajenti Web Panel Port in VirtualBox Debian 8 - linux

I'm trying to install Anjenti Server Admin Panel on Debian 8 and NGINX. I have removed Apache.
The website connects at 127.0.0.1:8888, but I cannot access Ajenti.
I used the Ajenti Automatic Installation. It completed with:
But it does not connect in the browser:
Unable to connect
Firefox can’t establish a connection to the server at 127.0.0.1:8000.
VirtualBox Server
Portforwading
Address in use
sudo netstat -tlnp | grep 8000
Config
Digital Ocean answer says to disable SSL in the config. It is already disabled.
config.yml
auth:
allow_sudo: true
emails: {}
provider: os
bind:
host: 0.0.0.0
mode: tcp
port: 8000
color: default
max_sessions: 9
name: debian
ssl:
certificate:
client_auth:
certificates: []
enable: false
force: false
enable: false
I changed the Host to 127.0.0.1 and Port to 7000. It says Binding to [127.0.0.1]:7000.
I get the same connection error:
Unable to connect
Firefox can’t establish a connection to the server at 127.0.0.1:7000.
I tried adding it to Portfowarding. I tries to connect but the loading icon just keeps spinning.

You may want to add the port in IP tables.
root#debian:/# iptables -A INPUT -p tcp --dport 8888 --jump ACCEPT
root#debian:/# iptables-save

Related

MQTT doesn't work with global ip

General information:
IP: 1.2.3.4
Server: Raspian Stretch (Debian 9)
On the server is running apache2 with 2 website.
mosquitto user: user
moquittto password: psw
I've installed mosquitto on my server and set a user and a password.
When I use it in localhost I've no problem:
mosquitto_pub -h localhost -p 1883 -t topic -u "user" -P "psw" -m "new message"
mosquitto_sub -h localhost -p 1883 -t topic -u "user" -P "psw"
I receive new message without any problems
Unfortunately if I use my public ip it doesn't work anymore:
mosquitto_pub -h 1.2.3.4 -p 1883 -t topic -u "user" -P "psw" -m "new message"
mosquitto_sub -h 1.2.3.4 -p 1883 -t topic -u "user" -P "psw"
After few seconds both the subscriber and the publisher print this error: Error: Connection timed out
I can imagine is something like a closed port but I don't know how to unlock it.
I tried this but didn't change anything: sudo iptables -A INPUT -p tcp -m tcp --dport 1883 -j ACCEPT
These are my configuration file:
/etc/mosquitto/conf.d/default.conf
allow_anonymous false
password_file /etc/mosquitto/passwd
listener 1883
/etc/mosquitto/mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
I presume that the IP you're using is not actually 1.2.3.4 - if you don't own it and it's not listed as a private / internal IP, don't use it internally.
Equally, if you don't own it, don't try to use it externally / on the internet.
If you are behind a consumer NAT'ing router, and using the router's external IP address, then there are a couple of potential issues:
Most consumer routers do not support hairpin NAT - i.e: you cannot access services (even if you've setup port forwarding correctly) by using your external IP from behind the router.
To test this out, try connecting from a friend's house or via another internet connection (e.g: your phone).
The solution is to just connect to your internal server directly. If you're lucky your router can be configured to handle hairpinning, or you could upgrade your router.
You might need to setup port forwarding on the router so that incoming connections on port 1883 are forwarded to your server internally.

As I can, configure the firewall of ubuntu server for the server to accept connections of the terminals through PostgreSQL port 5432

Configuration: Server: Ubuntu server 16.04 LTS using webmin
Terminal: Windows 7 Using PgAmin III
I was unable to establish the connection between my terminal and my server through pgAdmin III on port 5432.
On my server I added:
in file postgresql.conf I edited
in #Connection Settings
listen_addresses = '*'
in file pg_hba.conf I added
in #IPv4 local connections
host all all 172.x.x.x/32 md5 //this is IP Terminal (Hidden x)
I checked the port, this is 5432 default and user is postgres
When I try to establish the connection on PgAdmin III:
Host: //My Server IP (Ping console successful)
Port: 5432
username: postgres
password: //My password
Show me the following message:
Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "Mi SERVER IP Hidden" and accepting TCP/IP connections on port 5432?
If you encounter this message, please check if the server you're trying to contact is actually running PostgreSQL on the given port. Test if you have network connectivity from your client to the server host using ping or equivalent tools. Is your network / VPN / SSH tunnel / firewall configured correctly?
For security reasons, PostgreSQL does not listen on all available IP addresses on the server machine initially. In order to access the server over the network, you need to enable listening on the address first.
For PostgreSQL servers starting with version 8.0, this is controlled using the "listen_addresses" parameter in the postgresql.conf file. Here, you can enter a list of IP addresses the server should listen on, or simply use '*' to listen on all available IP addresses. For earlier servers (Version 7.3 or 7.4), you'll need to set the "tcpip_socket" parameter to 'true'.
You can use the postgresql.conf editor that is built into pgAdmin III to edit the postgresql.conf configuration file. After changing this file, you need to restart the server process to make the setting effective.
If you double-checked your configuration but still get this error message, it's still unlikely that you encounter a fatal PostgreSQL misbehaviour. You probably have some low level network connectivity problems (e.g. firewall configuration). Please check this thoroughly before reporting a bug to the PostgreSQL community.

Solarium gets "Permission Denied" when trying to connect apache solr at local ip

I have a drupal 8 site on the same physical server as apache solr (5.2.1). Drupal 8 uses the search_api_solr contrib module, which uses Solarium (installed by composer) to talk to the solr server using the http api.
I have successfully installed solr and created a core. I can query the core using cUrl on the linux command line, using various linux users.
I can access the solr admin screen in a browser (over vpn with 192.168 ip or domain resolving to such) and view the core I created on the cli.
However, the drupal solr module cannot connect to the solr server core, and if I create an index using the drupal module, it throws a php error:
[error] Uncaught PHP Exception Solarium\Exception\HttpException: "Solr HTTP error: HTTP request failed, Failed to connect to 127.0.0.1: Permission denied" at modules/search_api_solr/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php line 248
My url is like this: http://127.0.0.1:8983/solr/mycore
I get the same error for
http://192.168.254.78:8983/solr/mycore
or
http://127.0.0.1:8080/solr/mycore << different port!
Why should Solarium not be able to send http to a local ip?
Note that nothing is listening on 8080, so I suspect that this http failure has nothing to do with the solr server.
The problem turns out to be that SELinux on this CentOS6 machine is not allowing apache to talk to port 8983.
# setenforce 0
and our error goes away.
# setenforce 1
error is back
Check /var/log/audit.log.
This is what we saw:
type=AVC msg=audit(1457115397.149:224568): avc: denied { name_connect } for pid=4029 comm="httpd" dest=8983 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket
Notice scontext is httpd_t (apache)
And tcontext is port_t (a port)
Now by default apache can only listen on ports that are http_port_t
SO -- we check to see if our desired port "8983"
But first we need "semanage" which is provided by :
yum install policycoreutils-python
Now check for existing http_port_r's:
# semanage port -l | grep 'http_port_t'
http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
Now let's add 8983
# semanage port -a -t http_port_t -p tcp 8983
And check again -- yup 8983 is there
# semanage port -l | grep 'http_port_t'
http_port_t tcp 8983, 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
No more error with SELinux enforcing

Vagrant port forwarding 80 to 8000 with Laravel Homestead

My Problem:
I can only access my sites through port 8000, but not 80, which makes me think it is not redirecting 80 to 8000 as it says it should be. I want to simply type local.kujif.com into my browser and it loads the site, which I read was port 80 by default. I am using curl to check it and it returns:
curl 'http://local.kujif.com'
curl: (7) Failed connect to local.kujif.com:80; No error
However if I add :8000 to the url then it works; it returns my index.php which simply prints 'test':
curl 'http://local.kujif.com:8000'
test
My Details:
I am using Laravel Homestead and Vagrant with Oracle VM VirtualBox.
In the Homestead.rb it has the port forwarding. I haven't edited it at all:
config.vm.network "forwarded_port", guest: 80, host: 8000
config.vm.network "forwarded_port", guest: 3306, host: 33060
config.vm.network "forwarded_port", guest: 5432, host: 54320
I also have Microsoft IIS installed for my work stuff. I obviously stop that service whenever I need vagrant to use the localhost.
"vagrant up" shows:
My Homestead.yaml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: /Users/Tyler/.ssh/id_rsa.pub
keys:
- /Users/Tyler/.ssh/id_rsa
folders:
- map: C:\DEV\Linux
to: /var/www/
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: local.kujif.com
to: /var/www/kujif
variables:
- key: APP_ENV
value: local
You should continue to use ports above 1024 since they are non-privileged ports, BUT if you do want you can run as port 80 on the Homestead VM, as long as you don't have anything holding on to that port on the host machine. Just tried it and it worked, with a few gotchas. First, you change that line in the .rb file from:
config.vm.network "forwarded_port", guest: 80, host: 8000
to
config.vm.network "forwarded_port", guest: 80, host: 80
When you fire your VM up after saving you will get a warning from vagrant:
==> default: You are trying to forward to privileged ports (ports <= 1024). Most
==> default: operating systems restrict this to only privileged process (typically
==> default: processes running as an administrative user). This is a warning in case
==> default: the port forwarding doesn't work. If any problems occur, please try a
==> default: port higher than 1024.
==> default: Forwarding ports...
default: 80 => 80 (adapter 1)
But it worked for me. Now, to actually get to the VM I had to use it's private IP instead of the localhost name:
http://192.168.10.10/
But sure enough my site was there and everything was working. If you decide to keep it that was you can add that IP address to your hosts file to give it a nice short name.
Hope this helps.
I see there is an accepted answer, but this alternative may also help someone.
If I understand correctly you really dislike the port "8000"!
Have you tried setting a private network?
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
/*other config stuff here */
config.vm.network :private_network, ip: "192.168.33.22"
This way you can simply use that IP address, or edit you hosts file to map the local domain to that IP.
Take a look at the Vagrant docs:Vagrant Private Networks
BTW, You shouldn't need to shutdown your IIS local server as that is running on a totally different IP range. I have Apache running locally while also accessing the VM server. This allows you to use tools like composer (to pull in laravel) on your local if needed.
I'm not sure what the confusion is - this is the way it's supposed to work.
The web server on the VM listens on port 80. Vagrant/VirtualBox forwards that port from 80 (on the VM) to 8000 (on localhost) so that you can access the site at http://localhost:8000.
Port 80 on the VM's domain name is not going to be available - that domain name probably resolves to localhost.
Try the following: dig local.kujif.com (or nslookup or even ping - I don't know what tools are available on Windows) to find out what IP address that name is resolving to. You will probably find that it's 127.0.0.1 (localhost).
You could try using the IP address set in the homestead file instead: http://192.168.10.10/ - this might work, but it will depend on how networking is configured in the VM.
Ideally, you need to set networking to "bridged" in the VM - this will make the VM look (to your network) like any other device on the network. Other networking options in the VM (sorry, I'm not familiar with the options in VirtualBox) will set the VM up with its own network that is not accessible outside the VM - this is why port forwarding is used to expose network services on the VM.
You can disable the default port forwarding completely by adding the following to the Homestead.yaml:
default_ports: false
Or configure however you like by adding something like:
ports:
- send: 80
to: 80

Enable HTTP TCP connection requests in Arch Linux for neo4j

My laptop is running a local neo4j server. I can use it with localhost:7474 but when i try connecting it with 192.168.1.12:7474 it is unreacheable.
Turns out linux is blocking connections other than web server port 80. Because i can access my Apache server on 192.168.1.12/
I am trying to allow TCP connections on port 7474 by using
iptables -A TCP -p tcp --dport 7474 -j ACCEPT
but it gives a response as -
iptables: No chain/target/match by that name.
How can i make other clients access neo4j server running at my laptop on port 7474. My laptop IP addr is 192.168.1.12.
I doubt that it is blocking it. Probably your neo4j server is only running at 127.0.0.1. You can check this out with netstat -nplt: you will probably see something (the apache) listening on 0.0.0.0:80 or :::80 (e.g. catchall address) but on port 7474 you will probably only see 127.0.0.1:7474 or ::1:7474. If this is the case you need to reconfigure your neo4j server to listen not only on localhost (don't know how, checkout the documentation).
Okay. I had uncommented the webserver address line but it still wasn't working.
So i reinstalled neo4j. That solved it. Weird but worked.

Resources