Calling node.js package from web page


(Dan) #1

tl;dr: I’m a complete n00b to any sort of web development, and I’d like to come up with a way to use the capabilities of this node.js package in a web page.

I’ve recently been interested in simplifying/automating email client configuration for users–both to make it easier for them (particularly the less-tech-savvy folks), and also to try to ensure they’re using optimal configuration (encryption, proper services, proper ports, etc.). A copy of a five-year-old blog post on archive.org has a lot of good information, with pointers to other useful resources.

The mechanisms that would be used for Thunderbird and Outlook seem straightforward, even if they’d involve mild configuration changes. The method that would be used for iOS (iPhone/iPad/iPod) and the Mac OS Mail app is more complicated, but potentially more powerful.

Apple calls for configuring these devices using a .mobileconfig configuration profile, which would officially be created by the Apple Configurator software. Those configuration profiles can include a ton of settings, including wireless network, VPN, cellular carrier, etc., but for my purposes I’m interested in email account configuration.

The blog post I linked above discusses creating a bare-bones email profile with the predecessor to Apple Configurator, and using php to do a simple replacement of the email address so that a user can download a basic profile, which would need only the full name and password filled in. That works, but it’s an unsigned profile, and the system will complain. And, of course, the Apple Configurator software is Mac-only–the iPhone Configuration Utility linked in the blog post is long dead.

Enter the node.js package I linked above. It will generate properly-formatted .mobileconfig files for Email configuration, including account name, email address, servers, ports, protocols, logins, and passwords. It will also sign them. If your server has a trusted TLS cert (e.g., from Let’s Encrypt), the profile will be “green” and import without issues into the user’s device, automatically configuring the email account.

What I have in mind is a user-accessible web page where the user could log in and download a customized, signed, complete profile (ideally even pulling the full name out of the directory). I’ll probably be way over my head in trying something like this, but where should I start?


(Markus Neuberger) #2

Interesting idea. What about integrating it to NethServer profile page? So we reuse login and LDAP access. It could also be an own UI module/menu point so we can allow it to some users via delegation module. I think this is the easiest approach as we reuse a lot.

Alternatively to have a new webpage for that, I would start with putting a site to /var/www/html/mysite or to a virtual host. There are a many code snippets and frameworks for login and getting LDAP info.


(Stefano Zamboni) #3

autoconfig will be available briefly… ask @stephdl for detail (sorry Steph, I know now you have to work on it :-D)


(Dan) #4

I’ve argued elsewhere that we really need a separate page (that is, separate from the server manager) for users to change their passwords; I’d think this would be a natural fit for something like that–rather than just a “change password” page, it would be a “user control panel” page.


(Dan) #5

Sounds very interesting–looking forward to hearing more about it!


(Stéphane de Labrusse) #6

@Stefano_Zamboni sent me the work he already done in this area, I will publish it when I will have the time…now my mind thinks rspamd