- Introduced `auth.setup.js` to handle authentication against the live site and store the session state. - Created `live-race.spec.js` to test loading a live race page with an authenticated session, including cookie validation. - Added utility functions in `live-site-test-utils.js` for managing authentication, dismissing cookie banners, and checking UI states. - Included a temporary JSON file for live state inspection. - Updated deployment manifest to reflect new and modified files. - Implemented `_inc_faceai_identity.jsp` for managing FaceAI identity cookies and included it in relevant JSP files. - Added language management JavaScript in `lang.js`. - Adjusted `fotoCR-en.jsp` and `fotoCR.jsp` to include the FaceAI identity logic. - Created a tarball for staging deployment.
12 KiB
| description | applyTo |
|---|---|
| Use when: deploying, staging, copying, or promoting regalamiunsorriso site files on server 83.149.164.4, especially for sync/** and www/** changes. | sync/**, www/** |
Regalami Un Sorriso Server 83.149.164.4
Instructions in this file are specific to the regalamiunsorriso site hosted on server 83.149.164.4 over SSH port 410.
Server Access
- SSH user:
marco - SSH key:
C:\Users\Maddo\.ssh\id_rsa - SSH port:
410 - Direct SSH login works with the key above.
- The login banner before authentication is expected.
Preferred SSH Workflow
Use an interactive TTY when a command may need sudo:
ssh -tt -i C:\Users\Maddo\.ssh\id_rsa -p 410 marco@83.149.164.4
For root access, use:
sudo tcsh
If you need a single elevated command:
ssh -tt -i C:\Users\Maddo\.ssh\id_rsa -p 410 marco@83.149.164.4 "sudo tcsh -c 'command here'"
From PowerShell on Windows, prefer invoking the SSH binary directly instead of wrapping it in cmd /c:
& 'C:\Windows\System32\OpenSSH\ssh.exe' -tt -i 'C:\Users\Maddo\.ssh\id_rsa' -p 410 'marco@83.149.164.4'
Shell Behavior On This Host
- The remote login shell behaves as
tcsh. - POSIX shell constructs like
for ...; do ...; donefail unless you explicitly run them throughsh -c. - The server
shdoes not support-l, so usesh -c, notsh -lc. tcshtreats redirection and pipelines differently from POSIX shells; commands likefind ... 2>/dev/null | headcan fail withAmbiguous output redirectunless the whole payload runs undersh -c.- Prefer one remote command per SSH invocation when doing reconnaissance. Complex commands with pipes, grouped expressions, or escaped parentheses are much more likely to break under PowerShell-to-SSH-to-
tcshquoting. - On Windows PowerShell, avoid
cmd /c "ssh ..."andcmd /c "scp ..."wrappers for anything nontrivial. Nested quoting can collapse before SSH runs and spill later tokens into the local PowerShell session, which leads to misleading local errors such assudo: The term 'sudo' is not recognizedor local attempts to runcksum. - Prefer the PowerShell call operator form
& 'C:\Windows\System32\OpenSSH\ssh.exe' ...and pass the remote command as a single argument when you must stay non-interactive. - If PowerShell shows the continuation prompt
? >, the command was malformed locally before SSH executed it. Cancel it and rerun a simpler command instead of trying to answer the prompt. - If
sudoreports that a terminal is required, reconnect with-tt. - When running remote commands from PowerShell, quoting can break if the command contains both nested quotes and file paths with spaces.
- For read-only verification commands from PowerShell, prefer
ssh ... --% <remote command>so the remote command is passed verbatim. - For
promote-file.shcalls that target paths with spaces, prefer a local PowerShell loop that passes the full remote command as a single SSH argument instead of building one long nested quoted command. - For multi-step privileged work, prefer opening one interactive SSH session, then running
sudo tcsh, then issuing commands sequentially inside that shell. This is more reliable than trying to encode severalsudo tcsh -c 'a ; b ; c'operations through PowerShell quoting. - In an interactive
tcshroot shell, do not re-send a password or any other text starting with!after the password prompt has already succeeded.tcshinterprets!as history expansion and will emitEvent not found. - If repeated SSH commands start cancelling or interleaving poorly in the same terminal, rerun them sequentially instead of in parallel.
Mail Template Runtime Notes
- The server contains multiple
mailMessagetrees:- Live web root:
/home/sites/regalamiunsorriso/www/mailMessage - Staging copy:
/home/marco/regalamiunsorriso/incoming/www/mailMessage - Older duplicate trees:
/home/sites/regalamiunsorriso/wwwLang/mailMessageand/home/sites/regalamiunsorriso/wwwOld/www/mailMessage
- Live web root:
- During the 2026-04-16 reconnaissance, representative checksums differed between
www/mailMessageandwwwLang/mailMessage, so they are not interchangeable copies. - The Java application configuration lives under
/home/sites/regalamiunsorriso/rus/WEB-INF. rus/WEB-INF/web.xmldefines an older or alternate application DB connection asdbDriver=3,database=//localhost/pg,user=root,password=root.www/WEB-INF/web.xmlcontains the stronger live SQL lead:dbDriver=17,database=//192.168.10.250/pg,catalog=pg,user=root,password=root, with a description hint250658#that corresponds to the server password and an alternate endpoint hint//localhost:3308/pg.truckservice.propertiesdefines a second DB connection asdbDriver=3,dbName=//localhost/truckservice,user=root,password=root.- In this codebase,
dbDriver=3maps to MySQL Connector/J, not to a legacy non-MySQL driver. dbcomuni.properties,rus.properties, andtruckservice.propertiesall setUSE_PARM_HT=true, which means runtime values are expected to come from the applicationParmstore.- In code,
DBAdapter.getDocBase()resolves togetParm("DOCBASE").getTesto(), and mail-template lookups useParmvalues such asMAIL_REG,MAIL_NO_MORE,MAIL_NO_MORE_SCAD, andMAIL_MSG_PATH_MAILER. - In code,
Parm.findByCodice()reads fromPARMwithselect A.* from PARM AS A where A.codice='...', so the livePARMtable is the authoritative lookup point for these values. pg_src/com/ablia/pg/Users.javaseeds defaults forMAIL_MSG_RINNOVOasmailMessage/rinnovoMsg.htmlandMAIL_MSG_COUPON_OMAGGIOasmailMessage/couponOmaggioMsg.htmlwhen the parameters are missing.- Read-only validation plus later DBeaver confirmation established that the reachable live SQL path is
192.168.10.250:3306, databasepg, userroot, passwordroot. - The
250658#value should be treated as the server password hint noted inwww/WEB-INF/web.xml, not as the database password. - The validated live
PARMrows included:DOCBASE=/home/www/regalamiunsorriso/doMAIL_MSG_PATH_MAILER=phpmailer/regala_un_sorriso/MAIL_NO_MORE=mail_no_more.htmlMAIL_NO_MORE_SCAD=mail_no_more_scad.htmlMAIL_REG=mail_reg.html
- Because of that indirection, changing files under a
mailMessagedirectory is not sufficient proof that outbound mail content will change. The effectiveDOCBASEand mail-template parameter values must also be checked in the liveParmdata. - For mail-template reconnaissance, avoid recursing into
/mnt/da1/fotovia theRUSsymlink unless the task explicitly concerns photo storage. It adds permission noise and did not help identify the email-template source. 127.0.0.1:3308refused connections from the shell during the same investigation, so the localhost hint inwww/WEB-INF/web.xmlshould not be treated as the current working shell path without revalidation.- Do not upload, stage, or leave ad hoc PHP or SQL helper scripts on the server during reconnaissance. Any future live DB query method must be explicitly approved first.
MCP Limitation
- The MCP SSH tools have not been reliable for this host and previously failed authentication or transport checks.
- Prefer direct terminal SSH commands for this server unless the MCP path is revalidated.
Site Paths
- Incoming staging root:
/home/marco/regalamiunsorriso/incoming/www - Live site root:
/home/sites/regalamiunsorriso/www
Tomcat Logs And Runtime Clues
- The active Tomcat installation on this host is under
/usr/local/apache-tomcat-9.0. - The most useful live runtime log is
/usr/local/apache-tomcat-9.0/logs/catalina.out. - Rotated Tomcat logs are under
/usr/local/apache-tomcat-9.0/logs/, including files such ascatalina.YYYY-MM-DD.logandlocalhost.YYYY-MM-DD.log. - Access to generated JSP work files under
/usr/local/apache-tomcat-9.0/workmay require root. - A broken JSP on this host can still return
HTTP 200with a visibly truncated HTML body instead of a clean 500 response; when that happens, fetch part of the page body withcurl -L <url> | head -n ...and compare the cutoff point with recentcatalina.outoutput.
Staging Workflow
When www/** files need deployment:
- Build the file list from git changes after the initial
wwwimport baseline. - Include any required uncommitted working tree files explicitly if they must be deployed.
- Copy the selected files into
/home/marco/regalamiunsorriso/incoming/www, preserving thewww/...directory structure. - Prefer a streamed tar transfer over SSH for batches of files.
Example staging command pattern:
tar -cf - -C K:\various\regalamiunsorriso <file-list-under-www> | ssh -i C:\Users\Maddo\.ssh\id_rsa -p 410 marco@83.149.164.4 "tar -xf - -C /home/marco/regalamiunsorriso/incoming"
- The streamed tar extraction into
/home/marco/regalamiunsorriso/incomingworks as the unprivilegedmarcouser and avoids the permission problems seen when uploading an archive and trying to unpack it withsudo tar. - Do not rely on
sudo tarfor staging on this host.marcois not permitted to run that extraction as root.
Promotion Rules
- Promotion to the live site must happen through
sudo tcsh. - Do not copy directly as
marcointo/home/sites/regalamiunsorriso/www. - Before replacing an existing live file, capture its exact owner, group, and mode.
- After copy, restore the same owner, group, and mode exactly.
- For new files, use the permissions of surrounding live files of the same type in the same directory.
- If same-extension files in the directory have mixed modes, choose an explicit metadata source file and reuse its owner, group, and mode.
Promotion Automation
Use these scripts for this site:
- Local helper:
sync/promote-file.sh - Local batch helper:
sync/promote-www-remaining.sh - Remote helper:
/home/marco/promote-file.sh - Remote batch helper:
/home/marco/promote-www-remaining.sh
Single File Promotion
Run:
ssh -tt -i C:\Users\Maddo\.ssh\id_rsa -p 410 marco@83.149.164.4 "sudo tcsh -c '/home/marco/promote-file.sh <staged-path> <live-path> [metadata-source]'"
If the source or destination path contains spaces, prefer this PowerShell pattern so SSH receives the remote command as one argument:
$remote = "sudo tcsh -c \"/home/marco/promote-file.sh '<staged-path>' '<live-path>' [metadata-source]\""
& ssh -tt -i 'C:\Users\Maddo\.ssh\id_rsa' -p 410 'marco@83.149.164.4' $remote
If the deployment needs more than one privileged action or may prompt for a password, prefer this sequence instead of packing everything into one quoted SSH command:
- Open an interactive SSH session with
-tt. - Run
sudo tcsh. - Run
/home/marco/promote-file.sh ...commands one at a time. - Run
ls -l,stat -f, andcksumin that same root shell.
Behavior of promote-file.sh:
- If the destination already exists, it copies the file and restores that destination file's original owner, group, and mode.
- If the destination does not exist, it can use an optional third argument as the metadata source file.
- If no third argument is provided for a new file, it falls back to sampling sibling files in the destination directory.
New PHP Files In Live Root
Root-level PHP files on this site do not all share one mode.
/home/sites/regalamiunsorriso/www/_inc_footer.phpisjenkins:wwwwith mode775/home/sites/regalamiunsorriso/www/gallery1.phpisjenkins:wwwwith mode775/home/sites/regalamiunsorriso/www/test.phpisjenkins:wwwwith mode644
For the faceai_*.php files, use /home/sites/regalamiunsorriso/www/_inc_footer.php as the explicit metadata source.
Verification
After staging or promotion, verify with:
ls -lfor owner, group, and visible modestat -ffor exact metadatacksumto compare staged and live file contents- From PowerShell, prefer
ssh ... --% ls -l ...,ssh ... --% stat -f ..., andssh ... --% cksum ...for verification commands that include quoted paths.
Run verification commands separately if a parallel terminal run becomes unreliable.
Documentation Expectations
When performing deployments or promotions for this site:
- Record the list of changed files being deployed.
- Distinguish updated files from new files.
- Note whether any deployed file came from the working tree instead of a commit.
- Document every shell quirk or command failure encountered.
- Document the metadata source used for any new live file.
- Update
sync/www-deploy-manifest.mdwhen the deployment set or procedure changes.