Pfsense localization connecting on console or via SSH
-
Hello. This is my first (long) post.
I have been a long time and satisfied pfsense user. I just migrated my pfsense appliance from a pc engines apu3 mb to a VM running on VMware esxi.
Now, I'm more focused than before on interacting with pfsense via console or ssh. I've noticed that pfsense completely lacks localization support when it comes to using a shell on the console or via ssh.
I am Italian and I use a macbook pro with an Italian keyboard to configure pfsense. To some this may seem like a sheer exercise in skill considering that pfsense is designed to be used via the web interface. In part it is so but I think that for someone the solution of my problems can be useful.
These are the problems I have faced and solved (remember that I would like to troubleshoot both the shell on console and the shell via ssh).
Step 1) Keyboard mapping.
As pfsense doesn't suport the /etc/rc.conf file The only way I found to solve this problem was to install the "shellcmd" package and enter this command:/usr/sbin/kbdcontrol -l /usr/share/vt/keymaps/it.kbd.
Users of other keyboard type can enter the appropriate setting.
Point 2) Language localization.
I've discovered that the files .profile and .tcshrc get owerwrited after each reboot so the way to set language localization (that is also the suggested metod by FreeBSD, see https://www.freebsd.org/doc/handbook/using-localization.html) was to create a .login_conf file in the home directory of root with the following content:me:\ :charset=UTF-8:\ :lang=en_US.UTF-8:
and then execute:
cap_mkdb .login_conf
At this point the localization should work ... and instead nope!
Why?
Because the localization files in the pfsense distribution in each subdirectory of /usr/share/locale are completely missing. You need to copy the desired localization files (I dont know if the localization files get distributed as a package in FreeBSD) from an install DVD of FreBSD (attaching the ISO file as a DVD to the VM running pfsense or inserting the burned DVD in the physical machine in the DVD reader, if any, of the physica lmachine running pfsense) or from a running FreBSD machine (physical or virtual) trhough, for example, the scp command.
In my case I've created a FreBSD VM on my mac with VirtualBox and then, via scp, copied the wanted localization files, in my case the files for US localization. In other words from the console of my FreeBSD VM machine i've executed the following command:scp /usr/share/locale/en_US.UTF-8/* root@<ipaddress-of-pfsense>:/usr/share/locale/en_US.UTF-8/
Voilà! Now all my accented and special characters get correctly printed on the console and on the ssh terminal.
I dont know if the modified settings get preserved across updates of pfsense.
It would be useful if the pfsense distribution contain a minimal set of localization files and if the web GUI contain appropriate means to set the keyboard and the locale settings for who login from console or via ssh only only for the case (this is important) that secure passwords often must contain special charachetrs.Note:
For users of the Terminal.app on Mac OS. Once you have set pfsense as described above, make be sure that in the preferences of the application the checkbox "Escape non-ASCII input with Control-V" in the "Advanced" section for the terminal type chosen is NOT checked.Regards
Fabio -
yup it would be nice, we have discussed it here
https://forum.netgate.com/topic/148227/change-keyboard-layout-permanently?_=1609863007586
and there is already a request here
https://redmine.pfsense.org/issues/9942
they will do it sooner or later but it's not a priority -
@kiokoman
hi kickoman, In troubleshooting I saw the discussion you mentioned and the feature request for pfsense and both were very helpful. However, finding (to my surprise) that / usr / share / locale / <folder> was empty for each "folder" was the most time-consuming task :-).
Hopefully later versions of pfsense will provide a minimal configuration for localization files and for keyboard layout. -
@fog
yes but that folder isn't necessary for the keyboard layout afaik, that contain only translation/transformation like
yes=sì
January=Gennaio
and so on
LC_COLLATE String sort order
LC_CTYPE Character classification
LC_MESSAGES Language of messages
LC_MONETARY Formatting of currency amounts
LC_NUMERIC Formatting of numbers
LC_TIME Formatting of dates and times -
And, at the end, when things get bad, there's no escape from having a useful shell!
-
@kiokoman
yes, in fact I subdivided my problem into two subproblems.- keyboard mapping
- localization
-
@kiokoman
as you can see I've chosen (not by chance) lang=en_US.UTF-8 and NOT lang=it_IT.UTF-8. -
@kiokoman said in Pfsense localization connecting on console or via SSH:
@fog
yes but that folder isn't necessary for the keyboard layout afaik, that contain only translation/transformation like
yes=sì
January=Gennaio
and so on
LC_COLLATE String sort order
LC_CTYPE Character classification
LC_MESSAGES Language of messages
LC_MONETARY Formatting of currency amounts
LC_NUMERIC Formatting of numbers
LC_TIME Formatting of dates and timesAnyway, If the correct encoding is not correctly and consistently set (in this case UTF-8) you have trouble to type characters outside the ASCII range as, for example, accented characters.
-
This post is deleted!