Configuring mitmproxy in OSX High Sierra 10.13.1 - mitmproxy

I'm struggling configuring mitmproxy on OSX (10.13.1).
pfctl command always returns syntax error when trying to set forwarding rules.
I tried rdr on en2 inet proto tcp to any port 80 -> 127.0.0.1 port 8080
rdr on en2 inet proto tcp to any port 443 -> 127.0.0.1 port 8080
from the official guide as well as similar commands from other resources, but with the same error.
I also get No ALTQ support in kernel
ALTQ related functions disabled even though the firewall is enabled.
Is it some specifics related to the OS version?

Oddly, a newline character is actually required at the end of the config file, and not only will pfctl fail without it, but it also will only tell you "syntax error". (That's what the issue was for me at least.)
Apparently this has been causing grief since at least 2010.

Related

postgres doesnt restart after making the necessary .conf file changes

apologies first. On a steep learning curve more like a wall and will be verbose and lacking in jargon but too old to change that now. I'm trying to access a Postgresql-13 (with postgis-3 extensions) database from a machine other than the one where it is hosted. Before doing anything at all other than install, create and consume a spatial data file, this is the partial screen dump from
sudo netstat -ltpn
Proto
Recv-Q
Send-Q
Local Address
Foreign Address
State
PID/Program name
tcp
0
0
127.0.0.1:5432
0.0.0.0:*
LISTEN
993/postgres
... and the database is accessible from pgadmin4 on the Ubuntu 20.04 machine which is hosting it. I can also connect to the database in QGIS on the same Ubuntu machine through 127.0.0.1 and port 5432. Nothing special about that other than knowing it works. What I want to do is connect to that database from any machine running QGIS (or another GIS platform which can consume postgis).
Port forwarding rules on the router are set for 80, 8080 and 5900 to point to 10.0.0.55 which is the IP for the Ubuntu 20.04 which is hosting. I have a dynamic DNS pointing the routers IP to give it the name http://blah.blah.net (not actually that, but close).
pgadmin4 is installed and configured to run in server and I can access the database through pgadmin4 from the host or any other computer using http://blah.blah.net/pgadmin4. Not sure I got this config quite right but it works. Geoserver is also running smoothly on Tomcat9 accessible from anywhere through http://blah.blah.net:8080/Geoserver/web/. And a fancy front end in the making on http://blah.blah.net.
Have then done the following mods to the two .conf files in etc/postgresql/13/main which are well noted and documented already ...
host all all 0.0.0.0/0 md5
in the pg_hba.conf
and also ...
listen_addresses='*' (and removed the leading #)
port = 5432 (was already)
in the postgresql.conf
Then restarted postgres with ...
sudo service postgresql restart
... and then port 5432 disappears completely and the database is not accessible from anywhere. Not even the host computer. Checked that postgresql was running with ...
sudo systemctl status postgresql
... which it appears to be. But am getting nothing from QGIS or pgadmin4. Not even from the host machine.
Got a lot of questions but the most obvious is am I missing something? Not sure if I need a rule at the router for port 5432 - did try that in a similar fashion to the rules above but it didn't change anything. Appreciate any help. Cheers ... R
The local address in the netstat output:
127.0.0.1:5432
indicates that PostgreSQL is only listening on the loopback interface. Since you changed listen_addresses in postgresql.conf, I conclude that you forgot to restart PostgreSQL.
To confirm, run this query:
SELECT setting, pending_restart
FROM pg_settings
WHERE name = 'listen_addresses';
It should either show the wrong value (if you didn't reload or changed the wrong file altogether) or show pending_restart as TRUE (if you reloaded, but didn't restart).

error in connecting irc through xchat

I installed X-chat on Ubuntu 14.04.
in the first step I enter all the details (nickname, realname etc) and choose freenode as server and click Connect.
But I see the following error:
Looking up irc.freenode.net
* Connecting to chat.freenode.net (94.125.182.252) port 8001...
and nothing happens and there is a timeout error.
and when I type:
/join #python
I see the following:
Not connected. Try /server <host> [<port>]
You aren't connecting to the IRC port. Your client is specifying port 8001 but you need to connect to 6667
Check that you and your provider are not blocking port 6667.
To test this, fire up a terminal and type:
telnet chat.freenode.net 6667
Examine the output to see if the command succeeds (if it does, you'll be presented with freenode's welcome banner):
$ telnet chat.freenode.net 6667
Trying 35.156.219.172...
Connected to chat.freenode.net.
Escape character is '^]'.
:jackson.freenode.net NOTICE * :*** Looking up your hostname...
:jackson.freenode.net NOTICE * :*** Checking Ident
:jackson.freenode.net NOTICE * :*** Found your hostname
If it does not, examine your network configuration, firewall, router and anything at your provider that may block that outbound port.
Some providers, especially schools and colleges, block port 6667 for security and you should try one of freenode's many other ports instead: https://freenode.net/kb/answer/chat

WAMP server doesnt work, no listening sockets avalible, unable to open logs

My WAMP server isn't working, when I hover over the orange W icon i get "1 of two services running".
I did the right click on the icon, selected tools, selected test port 80
I got:
***** Test which uses port 80 *****
===== Tested by command netstat filtered on port 80 =====
'find' is not recognized as internal or external command,
operable program or batch file.
Port 80 is not associated with TCP protocol
'find' is not recognized as internal or external command,
operable program or batch file.
Port 80 is not associated with TCP protocol
===== Tested by attempting to open a socket on port 80 =====
Your port 80 is actually used by :
Server: Apache/2.4.17 (Win64) PHP/5.6.16
Press Enter to exit...
Then I tested port 3306 (that is supposed to be used by MySQL if Im not mistaken) in the same way as port 80.
I got:
***** Test which uses port 3306 *****
===== Tested by command netstat filtered on port 3306 =====
'find' is not recognized as internal or external command,
operable program or batch file.
Port 3306 is not associated with TCP protocol
'find' is not recognized as internal or external command,
operable program or batch file.
Port 3306 is not associated with TCP protocol
Press Enter to exit...
I went on the internet in search of a solution, none helped so far. I found some helpfull advice on stackoverflow so I did the folowing few things:
Run cmd in administrator mode.
Went to:
C:\wamp64\bin\apache\apache2.4.17\bin
and run:
httpd.exe -e debug
At the end of the output I got:
H01575: loaded module php5_module from C:/wamp64/bin/php/php5.6.16/php5apache2_4.dll
(OS 10048)Only one usage of each socket adress (protocol/network adress/port) is normally permitted. AH00072: make_sock: could not bind to adress [ : : ]:80
(OS 10048)Only one usage of each socket adress (protocol/network adress/port) is normally permitted. AH00072: make_sock: could not bind to adress 0.0.0.0:80
AH00451: no listening socket avalible, shutting down
AH00015: Unable to open logs
Than I run resmon.exe in Start menu. There I saw that port 80 is used by httpd.exe. When I canged the port of the server to 8080, port 80 (in resmon view) disappeared and 8080 was taken over by httpd.exe. The above output also changed accordingly. Port 3306 was nowhere to be seen.
Iam confused. Is port 80 taken or not? Im geting mixed messages here. Any help would be greatly appreciated or at least a point of direction where to look.
Maybe I should also add that because of this persistant problem I reinstalled my WAMP server. Did not help. Running WAMP as an admin didnt help as well and I do not have Skype on my desktop.
Slana,
I think I had a similar problem with Wamp server in the past. Even though I kept changing localhost port number to 80, 8080, and etc. it did not work. So, this is what I did:
Clicked on the Wamp Server icon.
Apache -> Service -> Remove Service
MySQL -> Service -> Remove Service
Then reinstall both Apache and MySQL service.
Restart the Wamp Server.
Sorry, I wish I could help you more.. I am a beginner in programming and still learning. I hope this helps with fixing the error.

Opening port so that pgAdmin on Windows 7 can connect to PostgreSQL on Debian on VirtualBox

Hello all :) I'm a having a little trouble connecting this.
On Windows 7 about my Debian 6 on VitualBox configured with Host-only Adapter:
>nmap -T4 -A -v 192.168.56.1
[...]
5432/tcp unknown postgresql
On the Debian, PostgreSQl is listening:
>netstat -tulpn
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 2432/postgres
tcp6 0 0 :::5432 :::* LISTEN 2432/postgres
.. and the port is opened
>iptables -nL
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0./0 tcp dpt:5432
.. and Postgres is accepting all the connections in postgresql.conf
listen-addresses = '*'
port = 5432
In Windows I have this error message from pdAdmin:
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 "192.168.56.1" 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.
Best regards
What about your pg_hba.conf file?
Have you configured it to accept connections from hosts in the 192.168.56.0 network?
Try to add this line and restart Postgres:
# VitualBox Host-Only Adapter
host all all 192.168.56.0/24 md5
If it's a testing environment you could even replace 192.168.56.0/24 with 0.0.0.0/0 and forget about it.

clojure swank server opens public port?

(This question has been downvoted, which I find strange. How have I offended?)
Am I right to think that running a swank server usually opens port 4005 to the world, not bound to localhost-only connections?
So anyone hacking in a café is not only allowing passers-by to execute arbitrary code on their computer, but is giving them a nice interface to do it with.
It appears that when I run a swank server with either 'mvn clojure:swank', or 'lein swank', or (swank.swank/start-server "/tmp/yo")
then I get something like (thanks Mike!):
$lsof -i -P
java 11693 john 13r IPv6 6701891 0t0 TCP *:34983 (LISTEN)
and indeed I can connect from an emacs running on another machine on the same network.
(swank.swank/start-server "/tmp/yo")
If I start the server by hand, it produces the following output
Connection opened on local port 34983
#<ServerSocket ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=34983]>
Whereas:
(swank.swank/start-server "/tmp/yo" :host "localhost")
produces:
Connection opened on local port 40368
#<ServerSocket ServerSocket[addr=localhost/127.0.0.1,port=0,localport=40368]>
Which seems more like I was expecting.
Is there any good reason for doing this?
Any ideas on how it the more conventional ways of starting it could be persuaded to only accept connections from local processes?
Totally valid question.
After opening a slime server, you'll notice:
eames:~:% lsof -i -P | grep 4005
java 41477 mjd 33u IPv6 0x0b8956d0 0t0 TCP [::127.0.0.1]:4005 (LISTEN)
The connection is listening on the local address at port 4005. This interface isn't exposed to the network, so other devices on the network can't connect to your slime server.
edit:
This was my result of starting swank using leiningen, which provides "localhost" as an argument to swank.swank/start-server. You may want to double check that the leiningen plugin is opening non-local ports.
You're right that swank opens the connection on every address if a host isn't explicitly provided. The relevant code is swank.util.net.sockets/make-server-socket, and this behavior is documented. I agree, it seems like the wrong default.
it only accepts one connection so even if it is exposed to the world it stops listening once you connect.
If you're using the clojure-maven-plugin, version 1.3.4 was recently released which now start the swank server against localhost to prevent this problem.
This behaviour can be configured in your pom.xml file with:
<configuration>
<swankHost>someotherhostname</swankHost>
</configuration>
or from the command line with:
mvn clojure:swank -Dclojure.swank.host=someotherhostname