Setup proxy config for emacs using PAC script - emacs

I am trying to access Gmail using gnus in emacs for windows behind a corporate firewall. I connect to the internet using a Proxy Auto-Config script.
Is there a way that I can directly use the URL to the PAC script in emacs?
something like
(setq url-proxy-pac "http://mypacscript.pac")
I tried to figure out the proxy from the script and plugged it into emacs using the following (with modified values as per the PAC script)
(setq url-proxy-services
'(("no_proxy" . "^\\(localhost\\|10.*\\)")
("http" . "proxy.com:8080")
("https" . "proxy.com:8080")))
With that proxy, I can connect to the internet using my browser but I can't connect Gmail from emacs gnus. And, I am able to connect to Gmail from emacs at home network without a proxy. I am not sure what I am missing.

Related

Expose Ngrok Web interface in same LAN

I have some issue to configurate Ngrok.
I have installed the Ngrok on linux CentOS server dedicated (IP 192.168.1.124), it works correctly the tunneling is ok.
My question is: how i can reach the web page on 127.0.0.1:4040 in order to check the traffic on my Ngrok server?
The web interface page is only accessible on the server where ngrok is running, but if this is a linux minimal server (without gui and any type of browser) I can't see it.
is there a way to make it accessible also in LAN?
e.g. I have another client that can reach the IP where ngrok is running but if i put on web browser http:\192.168.1.124:4040 nothing is showing.
I see from netstat that this port is not listening so isn't a firewall problem or other.
Is possible to change config of Ngrok? otherwise are there other possibilities ? do i have to use a reverse proxy or something like?
Any ideas?
thanks for your help,
Luca
Locate your ngrok's config file:
$ ngrok config check
Valid configuration file at /home/youruser/.config/ngrok/ngrok.yml
Add to the config file the following line:
web_addr: 192.168.1.124:4040
In case you want to expose it to all interfaces, you can replace that value with 0.0.0.0:4040

NetBeans 8.1 Remote Connections SFTP Error: Connection closed by foreign host

I'm developing a website on a server using NetBean's HTML5, CSS3, JavaScript and PHP support. I am trying to set up the remote connection so I don't have to use something like Filezilla every time to transfer my files to the server. However, NetBeans is unable to connect to my server over SFTP.
I'm unable to share screenshots with the actual information because this is for work and must be kept confidential.
Host Name is in the form: subdomain.domain.com
Username is just the plain username, it's NOT in the form username#subdomain.domain.com.
I am using a password, not a key.
I am behind my work's proxy but I don't think that could be the cause because NetBeans connecting to my server is the only thing that isn't working.
Filezilla works, Putty (SSH) works, Aptana remote connections (SFTP) works, all my browsers work. Even testing the proxy settings in the NetBeans general options works in NetBeans:
Anyway...
After entering in all of the server's information, I click "Test Connection". After 30 seconds (the timeout), this error pops up:
I tried looking in the NetBeans log to gather more information but it doesn't appear to be logging this error. Is there a certain debug flag I need to enable?
Like I said earlier, Filezilla and Aptana Studio can both connect to my server using the same login credentials.
Any suggestions?
Thanks for reading.
It turns out my system proxy settings (which were configured for my work's proxy) were preventing me from connecting to a server on my work's local intranet.
I had to add a proxy exception for the server and everything worked after that.

Linux/CMD environment and terminal on website

I am looking for a way to incorporate a command line interface into my website. Specifically I have 2 servers, one running Linux distro and the other Windows. People can request accounts and if I approve them they get a user partition on either of the servers.
They can then sign in on the website and access the servers through a command line interface. I saw a couple of repos that do something similar for the Amazon EC2 servers but was wondering if there is anything more general?
You can use shellinabox. This runs a daemon on the server and can be accessed through a specified port. You simply have to enter the IP of your server and the port number and you can log in over a browser.

replacing ssh+screen+editor with emacs

My goal is to remotely write code. So far, I have been using ssh + screen + an editor (e.g. vim).
I understand using a local emacs (or vim), one can edit remote files. But once the local emacs is closed and I want to reopen it (or open it using another computer), I would need to reopen all the buffers again.
Is there a way to set up a emacs server on the remote machine and I could simply access it using a local emacs client? Which essentially simulate the screen behavior.
I think you might find your answer here;
http://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html
According to http://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html#emacsclient-Options ;
An Emacs server usually uses an operating system feature called a “local socket” to listen for connections. Some operating systems, such as Microsoft Windows, do not support local sockets; in that case, Emacs uses TCP instead. When you start the Emacs server, Emacs creates a server file containing some TCP information that emacsclient needs for making the connection. By default, the server file is in ~/.emacs.d/server/. On Microsoft Windows, if emacsclient does not find the server file there, it looks in the .emacs.d/server/ subdirectory of the directory pointed to by the APPDATA environment variable. You can tell emacsclient to use a specific server file with the ‘-f’ or ‘--server-file’ option, or by setting the EMACS_SERVER_FILE environment variable.
Even if local sockets are available, you can tell Emacs to use TCP by setting the variable server-use-tcp to t. One advantage of TCP is that the server can accept connections from remote machines. For this to work, you must (i) set the variable server-host to the hostname or IP address of the machine on which the Emacs server runs, and (ii) provide emacsclient with the server file. (One convenient way to do the latter is to put the server file on a networked file system such as NFS.)
When the Emacs server is using TCP, the variable server-port determines the port number to listen on; the default value, nil, means to choose a random port when the server starts.
Of course, make sure to adjust your firewall settings on the server side, so that clients may connect to the machine running the emacs-server.
I've attempted the method mentioned in the other post many times and have never had any success with it.
One nice thing that emacs is able to do is desktop-save-mode which will store all of your open buffers when you kill emacs and restore them when you open emacs again. By default it won't restore tramp buffers, but you can tweak the settings to allow this to happen. More information can be found in this Stack Overflow question.
You can login locally and then ssh to a remote machine. On the remote machine, you can have 'screen session, that you can join'. In this session, you have emacs running, with all buffers as you had left. You can also use the desktop-save in combination to this, in the case that remote machine need to be restarted, and you can lose your session. This is the most practical solution, I use. You can change the 'client computer' any time. You don't need to use local emacs client. You can also make multiple session for different projects and join screen session for a particular project on different terminal.

How can I set the port that the Emacs Server uses?

I use Emacs to do most of my development work, I'd like to be able to connect to the Emacs server running on my office workstation from home. I connect to my office network over a VPN, I think this is mostly safe.
Anyway, I have a script that copies the server authentication file out, but it looks like the port changes every time. Our VPN is pretty locked down, I need to tell our sysadmin what ports I want open to which machines.
Is there a way to set the port that the Emacs server listens on?
Looks like this is now fixed. I'm using Emacs 24.3.1 and there is now a variable server-port:
C-h v server-port RET
gives the following documentation:
Documentation:
The port number that the server process should listen on.
This variable only takes effect when the Emacs server is using
TCP instead of local sockets. A nil value means to use a random
port number.
You can customize this variable.
This variable was introduced, or its default value was changed, in
version 24.1 of Emacs.
so a (setq server-port 12345) in your init file should do the trick.
Someone posted a small patch to allow customizing the server port to the Emacs Bugs list in September 2008. However, the patch didn't make it into Emacs 23.1 nor does it appear in CVS Emacs as of yet. Your best bet for now might be to patch your version of server.el locally.