missing polipo/config file in /usr/local/etc/ - config

I use brew to install polipo through Mac OS terminal. It seems successfully install, but I can not find the config file and edit it.Can anyone help me figure out the reason?

The config file will not be created automatically. You need to get sample config file. Run this command in Terminal:
curl -o ~/.polipo https://raw.githubusercontent.com/jech/polipo/master/config.sample
and for forbidden URLs:
curl -o ~/.polipo-forbidden https://raw.githubusercontent.com/jech/polipo/master/forbidden.sample
Then restart polipo to ensure that it will use the config file:
launchctl unload /usr/local/opt/polipo/homebrew.mxcl.polipo.plist
launchctl load /usr/local/opt/polipo/homebrew.mxcl.polipo.plist
If it produced Service is disabled error, try this command to restart polio:
brew services restart polipo
Now open this address in your browser:
http://127.0.0.1:8123/polipo/config
You should see this line at the top:
configFile /Users/YourUserName/.polipo Configuration file.
If so, you need to modify ~/.polipo to configure your polipo instance.
There is another way that is not recommended. You can make your config file at /usr/local/etc/polipo/config and then create soft link to /etc/polipo/config with these commands:
mkdir /usr/local/etc/polipo/
curl -o /usr/local/etc/polipo/config https://raw.githubusercontent.com/jech/polipo/master/config.sample
sudo ln -sfv /usr/local/etc/polipo/config /etc/polipo/config
Then restart polipo and ensure that your config file location is correct. You can modify config file at /usr/local/etc/polipo/config.

I also used the brew to install polipo on Mac OS. Same problem as you met.
In fact, you need create the config file. The fail's path is ~/.polipo.
After you start the polipo service(brew services start polipo)
Open the link: http://127.0.0.1:8123/polipo/config
This is my config:
socksParentProxy = "127.0.0.1:1086"
socksParentProxy
socksProxyType = socks5
proxyAddress = "::0" # both IPv4 and IPv6
proxyPort = 8123

If polipo does not work:
I wanted to install polipo too, but even with the configuration files provided here, I was getting:
Error: polipo has been disabled because it is not supported upstream!
(MacBook Pro M1 chip. My socks proxy was generated with ssh -D 8000 -C -N myuser#statichost because of some static IP requirement).
So, I found out that you can also use an npm package to convert socks proxy to http proxy: https://www.npmjs.com/package/http-proxy-to-socks
# install hpts:
npm install -g http-proxy-to-socks
# launch http proxy:
hpts -s 127.0.0.1:8000 -p 8001
# here my socks5 proxy is at 127.0.0.1:8000 and the http proxy is now on port 8001
Npm does not support socks5 proxies, for example. So I used hpts to get an http proxy. After, I told npm to use that proxy with:
npm config set proxy http://127.0.0.1:8001
npm config set https-proxy http://127.0.0.1:8001

Related

can't make http request to docker container?

I am having an issue where my docker container, a simple api, is reachable from the browser if I open localhost:5000 it works fine and I get my dummy test, that means it's online, but when I go to postman to test my post request I get
Could not get any response
There was an error connecting to http://localhost:5000/test
I already tried disabling proxy settings and SSl certificates in postman and in my dockerfile my flask runs with the 0.0.0.0 host setting and the 5000 port is being exposed in the same dockerfile, I already ran out of ideas of why I can make or at least get responses from the docker container when it works just fine in the browser.
Edit.
the docker file is
FROM python:alpine3.7
RUN apk add --no-cache gcc
RUN apk add alpine-sdk
COPY . /src
WORKDIR /src
RUN apk update && apk add curl make gnupg gcc g++ unixodbc-dev
RUN pip install -r ./src/requirements.txt
RUN pip install pyodbc==4.0.27
ENV FLASK_APP=./src/app.py
EXPOSE 5000
CMD flask run --host 0.0.0.0
the start command is docker run -p 5000:5000 -t -d ms
the result of all that is
01bfd6b0bc6b ms "/bin/sh -c 'flask r…" About a minute ago Up About a minute 0.0.0.0:5000->5000/tcp elastic_lovelace

Unable to start docker - httpd (pid 1) already running

I have hosted one docker with PHP in a shared server of our office environments. Previously it was working fine without any issue. All the users were able to access the site via port forwarding to 8080. Here is my docker file details -
# Choose Repo from Docker Hub
FROM centos:latest
# Provide details of maintainer
MAINTAINER ritu
#Install necessary software
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum -y install yum-utils
RUN yum-config-manager --enable remi-php56
RUN yum -y install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo php-devel php-pear make gcc systemtap-sdt-devel httpd unzip postfix
RUN export PHP_DTRACE=yes
RUN curl -sS https://getcomposer.org/installer | php
RUN mv -f composer.phar /usr/local/bin/composer
RUN chmod +x /usr/local/bin/composer
RUN composer require phpmailer/phpmailer
COPY phpinfo.php /var/www/html/
COPY php.ini /var/www/
COPY httpd.conf /var/www/
RUN cp -f /var/www/httpd.conf /etc/httpd/conf/
COPY *.rpm /var/www/
#Install & Configure OCI for PHP
COPY oci8-2.0.12.tgz /
RUN tar -xvf oci8-2.0.12.tgz
RUN yum -y localinstall /var/www/*.rpm --nogpgcheck
COPY client.sh /etc/profile.d/
RUN chmod +x /etc/profile.d/client.sh
RUN cp -f /var/www/php.ini /etc/
COPY php_oci8_int.h oci8-2.0.12/
COPY Log_Check.zip /
RUN unzip Log_Check.zip
RUN cp -a -R /Log_Check/* /var/www/html/
WORKDIR /oci8-2.0.12
RUN phpize
RUN ./configure --with-oci8=/usr/lib/oracle/12.2/client64
RUN cp -f /usr/include/oracle/12.2/client64/*.h /oci8-2.0.12/include/
RUN make
RUN make install
RUN ls /var/www/html/
RUN rm -rf /var/run/apache2/apache2.pid
#Expose necessary ports
EXPOSE 80
EXPOSE 1521
EXPOSE 25
#Provide Entrypoint
CMD ["-D", "FOREGROUND"]
ENTRYPOINT ["/usr/sbin/httpd"]
Suddenly one of my friend added another docker with same port 8080 in the same server. After that my docker got stopped. with below error -
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
httpd (pid 1) already running
After several hours of googling and after trying lots of commands, I found that its easy to remove the entire container as well as images from the server. Hence I removed all containers with docker rm followed by image deletion with docker rmi. Again i have recreated the docker image on my local system (its working here) and transferred to server. Again I tried to run the docker. But faced same issue again.
Unable to find out the cause & solution. Need some help.
first remove ENTRYPOINT from your Dockerfile and just use:
CMD [ "/usr/sbin/httpd", "-X" ]
the warning regarding AH00558 is comming from your configuration and it i complaining about you do not use www.test.com you can ignore that for now and apache will still working. if you want to read more see this

Gentoo install mod_proxy_balancer

I installed in Apache in Gentoo and i need to use it like a proxy but i am unable to install mod_proxy_balancer. If i restart apache it display the following:
apache2 has detected an error in your setup: AH00526: Syntax error
on line 4 of /etc/apache2/vhosts.d/jira.conf: Invalid command
'ProxyRequests', perhaps misspelled or defined by a module not
included in the server configuration * ERROR: apache2 failed to stop
Any suggestion how to?
May seems a easy question for Gentoo expert, but not for beginners.
Please create a new file if not existing:
nano /etc/portage/package.use/apache2
Add the line containing the following:
www-servers/apache apache2_modules_proxy_balancer apache2_modules_slotmem_shm apache2_modules_proxy slotmem_shm mod_proxy_balancer mod_proxy apache2_modules_lbmethod_byrequests apache2_modules_proxy_balancer apache2_modules_slotmem_shm apache2_modules_proxy apache2_modules_proxy_ajp apache2_modules_proxy_balancer apache2_modules_proxy_http
Please run the following command in order to update the packages:
emerge -avDU #world
The purpose of this file is to add the following modules when apache2 ( www-servers/apache ) will be installed with the following command:
emerge www-servers/apache
After apache is installed with the requested modules need to add ( -D PROXY )
nano /etc/conf.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PROXY "
Now we should be ok with the apache modules.

error apache2.service" and "journalctl -xe"

Last time I try add new domain on localhost and I leave it on few weeks so now I try run my apache this command /etc/init.d/apache2 start and I get error
[....] Starting apache2 (via systemctl): apache2.serviceJob for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.
failed!
If i tried to do reinstall apache2 but it is still not work.
I just did these two lines.It worked.
Two web servers cannot be active on the one port at the same time
this code for apache & nginx:
or
if error journalctl -xe used this code
sudo apt-get install psmisc
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill
Virtual Host configuration might cause this error
I solved this same problem by configuring my virtual host .conf files properly.
I created a virtual host & then removed the exapmle.conf file form /etc/apache2/sites-avalable/ but I didn't deleted the examle.conf file from /etc/apache2/sites-enabled/ for this reason i was getting this error.
Then I removed the example.conf file from both the folders( ../sites-enabled & ../sites-available ) and solved this issue.
If you tried to setup any virtual host recently, then try this solution.
Best of Luck
Kill the running process on the port. Hope it will work!
sudo apt-get install psmisc
sudo fuser 80/tcp
sudo lsof -i tcp:80
sudo lsof -i tcp:80 -s tcp:listen
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill
Go
sudo nano /etc/apache2/apache2.conf
remove this line:
Include /etc/phpmyadmin/apache.conf
Then
service apache2 start/restart
This problem may be a result of some configuration files in apache missing. One of the solutions would be to purge the apache2 file.
You can type:
sudo apt-get purge apache2
Then reinstall apache2 by typing:
sudo apt-get install apache2
As stated in the error message, we just have to execute :
systemctl status apache2.service
or
journalctl -xe
And you will have more detail about the error (line of the error, or command misspelled, or module not included in the configuration, ...) :
for example you can have following detail Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration ==> you then need to execute a2enmod ssl, and then execute service apache2 restart
Also I notice a difference between service apache2 reload and service apache2 restart commands. In case of persisting errors you should execute service apache2 restart, and then execute journalctl -xe.
You type
sudo netstat -pant
You check are you using port 80. If used, `
sudo service 'service_name' stop
and
sudo service apache2 start
The problem is because some configuration files are deleted.
You can use the following command to replace configuration files that have been deleted, without purging the package:
sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
execute sudo service apache2 status and check the result. it might be trying to bind to a port that is already in use

Scrapy Torproject

On Ubuntu,
[guy#guy-laptop tmp]$ sudo /etc/init.d/tor status
tor is running
[guy#guy-laptop tmp]$ sudo /etc/init.d/polipo start
Starting polipo: /usr/bin/polipo already running -- doing nothing
polipo.
also:
$ python -c 'import urllib; print urllib.getproxies()'
{'ftp': 'ftp://127.0.0.1:8118/', 'all': 'socks://127.0.0.1:8118/',
'http': 'http://127.0.0.1:8118/', 'https': 'https://127.0.0.1:8118/',
'no': 'localhost,127.0.0.0/8,*.local'}
When running scrapy I get:
ERROR: Error downloading https://registration.example.com/login.fcc:
[Failure instance: Traceback (failure with no frames): : [('SSL routines', 'SSL23_READ', 'ssl handshake
failure')]
]
While on the same time FireFox managed to get the page correctly
through proxy
Any help will be appreciated,
Thanks,
Guy
Have you tried running the script through proxychains? To install on ubuntu:
:~$ sudo apt-get install proxychains
then configure the /etc/proxychains.conf file to work with TOR (socks4/5).
# defaults set to "tor"
socks4 127.0.0.1 9050
Then you can run anything though TOR
:~$ proxychains scriptwhatever.py target
Once you know TOR is working correctly, I recommend quiet mode in the proxychains.conf file.
# Quiet mode (no output from library).
quiet_mode